aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorManman Ren <mren@apple.com>2012-06-07 00:42:47 +0000
committerManman Ren <mren@apple.com>2012-06-07 00:42:47 +0000
commit87253c2ebdae320ee24a2cbf10f8de9b3acba763 (patch)
tree4fde1630bccf2ca0978b056e2d827f687d9ee51b /test
parentd66ec52b62a61da2a5d65b8fe524bbffb3d541ef (diff)
X86: replace SUB with CMP if possible
This patch will optimize the following movq %rdi, %rax subq %rsi, %rax cmovsq %rsi, %rdi movq %rdi, %rax to cmpq %rsi, %rdi cmovsq %rsi, %rdi movq %rdi, %rax Perform this optimization if the actual result of SUB is not used. rdar: 11540023 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@158126 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
-rw-r--r--test/CodeGen/X86/jump_sign.ll11
1 files changed, 11 insertions, 0 deletions
diff --git a/test/CodeGen/X86/jump_sign.ll b/test/CodeGen/X86/jump_sign.ll
index 94cbe5d193..d253e15774 100644
--- a/test/CodeGen/X86/jump_sign.ll
+++ b/test/CodeGen/X86/jump_sign.ll
@@ -83,3 +83,14 @@ entry:
%cond = select i1 %cmp, i32 %sub, i32 0
ret i32 %cond
}
+; rdar://11540023
+define i32 @n(i32 %x, i32 %y) nounwind {
+entry:
+; CHECK: n:
+; CHECK-NOT: sub
+; CHECK: cmp
+ %sub = sub nsw i32 %x, %y
+ %cmp = icmp slt i32 %sub, 0
+ %y.x = select i1 %cmp, i32 %y, i32 %x
+ ret i32 %y.x
+}