summaryrefslogtreecommitdiff
path: root/test/CodeGen/X86/bmi.ll
diff options
context:
space:
mode:
authorCraig Topper <craig.topper@gmail.com>2013-09-02 07:53:17 +0000
committerCraig Topper <craig.topper@gmail.com>2013-09-02 07:53:17 +0000
commit69c474ffa8a4b0186067e39d338a165d4165af2b (patch)
tree87ab20fb6bd0890ab5ddcfdd121599b78855173f /test/CodeGen/X86/bmi.ll
parentda0ce6eb8b11083b5cc1849b625509b87a7d9db9 (diff)
downloadllvm-69c474ffa8a4b0186067e39d338a165d4165af2b.tar.gz
llvm-69c474ffa8a4b0186067e39d338a165d4165af2b.tar.bz2
llvm-69c474ffa8a4b0186067e39d338a165d4165af2b.tar.xz
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
Diffstat (limited to 'test/CodeGen/X86/bmi.ll')
-rw-r--r--test/CodeGen/X86/bmi.ll25
1 files changed, 25 insertions, 0 deletions
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