summaryrefslogtreecommitdiffstats
path: root/llvm/test
diff options
context:
space:
mode:
authorChad Rosier <mcrosier@apple.com>2012-04-27 22:33:25 +0000
committerChad Rosier <mcrosier@apple.com>2012-04-27 22:33:25 +0000
commit32c2178ef3d7455b0d1f18f2f6d6c2e9546c2939 (patch)
tree8bc8e307ed7a7d51abb52f1b3ba4a81954c96799 /llvm/test
parentf5d6c74433220e444db44931429b9ee3ecbfd741 (diff)
downloadbcm5719-llvm-32c2178ef3d7455b0d1f18f2f6d6c2e9546c2939.tar.gz
bcm5719-llvm-32c2178ef3d7455b0d1f18f2f6d6c2e9546c2939.zip
Add x86-specific DAG combine to simplify:
x == -y --> x+y == 0 x != -y --> x+y != 0 On x86, the generated code goes from negl %esi cmpl %esi, %edi je .LBB0_2 to addl %esi, %edi je .L4 This case is correctly handled for ARM with "cmn". Patch by Manman Ren. rdar://11245199 PR12545 llvm-svn: 155739
Diffstat (limited to 'llvm/test')
-rw-r--r--llvm/test/CodeGen/X86/neg_cmp.ll22
1 files changed, 22 insertions, 0 deletions
diff --git a/llvm/test/CodeGen/X86/neg_cmp.ll b/llvm/test/CodeGen/X86/neg_cmp.ll
new file mode 100644
index 00000000000..866514ed9a2
--- /dev/null
+++ b/llvm/test/CodeGen/X86/neg_cmp.ll
@@ -0,0 +1,22 @@
+; RUN: llc < %s -march=x86-64 | FileCheck %s
+
+; rdar://11245199
+; PR12545
+define void @f(i32 %x, i32 %y) nounwind uwtable ssp {
+entry:
+; CHECK: f:
+; CHECK-NOT: neg
+; CHECK: add
+ %sub = sub i32 0, %y
+ %cmp = icmp eq i32 %x, %sub
+ br i1 %cmp, label %if.then, label %if.end
+
+if.then: ; preds = %entry
+ tail call void @g() nounwind
+ br label %if.end
+
+if.end: ; preds = %if.then, %entry
+ ret void
+}
+
+declare void @g()
OpenPOWER on IntegriCloud