summaryrefslogtreecommitdiffstats
path: root/llvm/test/CodeGen/X86
diff options
context:
space:
mode:
authorLang Hames <lhames@gmail.com>2014-04-21 08:18:53 +0000
committerLang Hames <lhames@gmail.com>2014-04-21 08:18:53 +0000
commit5aa6ee80b699c2afc1e185148846e75af97eff98 (patch)
tree3280ecaf4503871888e275a1eb0205f629a9296b /llvm/test/CodeGen/X86
parent589441820e5047ebb64a91cebb283500dbc9d481 (diff)
downloadbcm5719-llvm-5aa6ee80b699c2afc1e185148846e75af97eff98.tar.gz
bcm5719-llvm-5aa6ee80b699c2afc1e185148846e75af97eff98.zip
[X86] ISEL (and X, <constant mask>) to BZHI when BMI2 is available.
Generating BZHI in the variable mask case, i.e. (and X, (sub (shl 1, N), 1)), was already supported, but we were missing the constant-mask case. This patch fixes that. <rdar://problem/15480077> llvm-svn: 206738
Diffstat (limited to 'llvm/test/CodeGen/X86')
-rw-r--r--llvm/test/CodeGen/X86/bmi.ll18
1 files changed, 18 insertions, 0 deletions
diff --git a/llvm/test/CodeGen/X86/bmi.ll b/llvm/test/CodeGen/X86/bmi.ll
index 242075a878b..1dc2edb7ea4 100644
--- a/llvm/test/CodeGen/X86/bmi.ll
+++ b/llvm/test/CodeGen/X86/bmi.ll
@@ -216,6 +216,24 @@ entry:
; CHECK: bzhiq
}
+define i32 @bzhi32_constant_mask(i32 %x) #0 {
+entry:
+ %and = and i32 %x, 1073741823
+ ret i32 %and
+; CHECK-LABEL: bzhi32_constant_mask:
+; CHECK: movb $30, %al
+; CHECK: bzhil %eax, %edi, %eax
+}
+
+define i64 @bzhi64_constant_mask(i64 %x) #0 {
+entry:
+ %and = and i64 %x, 4611686018427387903
+ ret i64 %and
+; CHECK-LABEL: bzhi64_constant_mask:
+; CHECK: movb $62, %al
+; CHECK: bzhiq %rax, %rdi, %rax
+}
+
define i32 @blsi32(i32 %x) nounwind readnone {
%tmp = sub i32 0, %x
%tmp2 = and i32 %x, %tmp
OpenPOWER on IntegriCloud