OSDN Git Service

[X86] Add a blsr test case with a shift from PR35792. NFC
authorCraig Topper <craig.topper@intel.com>
Tue, 13 Feb 2018 05:33:39 +0000 (05:33 +0000)
committerCraig Topper <craig.topper@intel.com>
Tue, 13 Feb 2018 05:33:39 +0000 (05:33 +0000)
The blsr pattern here is missed because the add is shrunk, but the and is not. This leaves an any_extend between them.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@324986 91177308-0d34-0410-b5e6-96231b3b80d8

test/CodeGen/X86/bmi.ll

index 6b61441..ad43643 100644 (file)
@@ -822,3 +822,16 @@ define i64 @blsr_disguised_constant(i64 %x) {
   ret i64 %r
 }
 
+; The add here gets shrunk, but the and does not thus hiding the blsr pattern.
+define i64 @blsr_disguised_shrunk_add(i64 %x) {
+; CHECK-LABEL: blsr_disguised_shrunk_add:
+; CHECK:       # %bb.0:
+; CHECK-NEXT:    shrq $48, %rdi
+; CHECK-NEXT:    leal -1(%rdi), %eax
+; CHECK-NEXT:    andq %rdi, %rax
+; CHECK-NEXT:    retq
+  %a = lshr i64 %x, 48
+  %b = add i64 %a, -1
+  %c = and i64 %b, %a
+  ret i64 %c
+}