summaryrefslogtreecommitdiff
path: root/test/CodeGen/X86/jump_sign.ll
diff options
context:
space:
mode:
authorManman Ren <mren@apple.com>2012-05-31 17:20:29 +0000
committerManman Ren <mren@apple.com>2012-05-31 17:20:29 +0000
commit91c5346d91973a1d3458a20f8c6b0e899b732e38 (patch)
treeeb29d9f46d2f9184cb248413cc98369f6179c089 /test/CodeGen/X86/jump_sign.ll
parent5ddc04caf25a649963c99be02646c3a9fc88d514 (diff)
downloadllvm-91c5346d91973a1d3458a20f8c6b0e899b732e38.tar.gz
llvm-91c5346d91973a1d3458a20f8c6b0e899b732e38.tar.bz2
llvm-91c5346d91973a1d3458a20f8c6b0e899b732e38.tar.xz
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@157755 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGen/X86/jump_sign.ll')
-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..cf5408e071 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 i64 @n(i64 %x, i64 %y) nounwind {
+entry:
+; CHECK: n:
+; CHECK-NOT: sub
+; CHECK: cmp
+ %sub = sub nsw i64 %x, %y
+ %cmp = icmp slt i64 %sub, 0
+ %y.x = select i1 %cmp, i64 %y, i64 %x
+ ret i64 %y.x
+}