OSDN Git Service

[x86] add test to show failed recognition of commuted pattern; NFC
authorSanjay Patel <spatel@rotateright.com>
Sat, 4 Mar 2017 00:06:37 +0000 (00:06 +0000)
committerSanjay Patel <spatel@rotateright.com>
Sat, 4 Mar 2017 00:06:37 +0000 (00:06 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296931 91177308-0d34-0410-b5e6-96231b3b80d8

test/CodeGen/X86/conditional-indecrement.ll

index 8397c6b..1dc0832 100644 (file)
@@ -14,6 +14,20 @@ define i32 @test1(i32 %a, i32 %b) nounwind readnone {
   ret i32 %retval.0
 }
 
+define i32 @test1_commute(i32 %a, i32 %b) nounwind readnone {
+; CHECK-LABEL: test1_commute:
+; CHECK:       # BB#0:
+; CHECK-NEXT:    xorl %eax, %eax
+; CHECK-NEXT:    testl %edi, %edi
+; CHECK-NEXT:    setne %al
+; CHECK-NEXT:    addl %esi, %eax
+; CHECK-NEXT:    retq
+  %cmp = icmp ne i32 %a, 0
+  %inc = zext i1 %cmp to i32
+  %ret = add i32 %b, %inc
+  ret i32 %ret
+}
+
 define i32 @test2(i32 %a, i32 %b) nounwind readnone {
 ; CHECK-LABEL: test2:
 ; CHECK:       # BB#0: