From 69c474ffa8a4b0186067e39d338a165d4165af2b Mon Sep 17 00:00:00 2001 From: Craig Topper Date: Mon, 2 Sep 2013 07:53:17 +0000 Subject: Create BEXTR instructions for (and ((sra or srl) x, imm), (2**size - 1)). Fixes PR17028. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@189742 91177308-0d34-0410-b5e6-96231b3b80d8 --- test/CodeGen/X86/bmi.ll | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'test/CodeGen/X86/bmi.ll') diff --git a/test/CodeGen/X86/bmi.ll b/test/CodeGen/X86/bmi.ll index 757e98d28d..242075a878 100644 --- a/test/CodeGen/X86/bmi.ll +++ b/test/CodeGen/X86/bmi.ll @@ -111,6 +111,23 @@ define i32 @bextr32_load(i32* %x, i32 %y) nounwind readnone { declare i32 @llvm.x86.bmi.bextr.32(i32, i32) nounwind readnone +define i32 @bextr32b(i32 %x) nounwind uwtable readnone ssp { + %1 = lshr i32 %x, 4 + %2 = and i32 %1, 4095 + ret i32 %2 +; CHECK-LABEL: bextr32b: +; CHECK: bextrl +} + +define i32 @bextr32b_load(i32* %x) nounwind uwtable readnone ssp { + %1 = load i32* %x + %2 = lshr i32 %1, 4 + %3 = and i32 %2, 4095 + ret i32 %3 +; CHECK-LABEL: bextr32b_load: +; CHECK: bextrl {{.*}}, ({{.*}}), {{.*}} +} + define i64 @bextr64(i64 %x, i64 %y) nounwind readnone { %tmp = tail call i64 @llvm.x86.bmi.bextr.64(i64 %x, i64 %y) ret i64 %tmp @@ -120,6 +137,14 @@ define i64 @bextr64(i64 %x, i64 %y) nounwind readnone { declare i64 @llvm.x86.bmi.bextr.64(i64, i64) nounwind readnone +define i64 @bextr64b(i64 %x) nounwind uwtable readnone ssp { + %1 = lshr i64 %x, 4 + %2 = and i64 %1, 4095 + ret i64 %2 +; CHECK-LABEL: bextr64b: +; CHECK: bextrq +} + define i32 @bzhi32(i32 %x, i32 %y) nounwind readnone { %tmp = tail call i32 @llvm.x86.bmi.bzhi.32(i32 %x, i32 %y) ret i32 %tmp -- cgit v1.2.3