diff options
| author | Manman Ren <mren@apple.com> | 2012-06-07 00:42:47 +0000 |
|---|---|---|
| committer | Manman Ren <mren@apple.com> | 2012-06-07 00:42:47 +0000 |
| commit | ae02c5a93e43dc740979db0fc16290c0bcbe8316 (patch) | |
| tree | 0771ec60c1a7531f84b1f541e74eef63052290f4 /llvm/test | |
| parent | 79cc6f7a26649cc8812d6c97641fbfe5c37f7dc4 (diff) | |
| download | bcm5719-llvm-ae02c5a93e43dc740979db0fc16290c0bcbe8316.tar.gz bcm5719-llvm-ae02c5a93e43dc740979db0fc16290c0bcbe8316.zip | |
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
llvm-svn: 158126
Diffstat (limited to 'llvm/test')
| -rw-r--r-- | llvm/test/CodeGen/X86/jump_sign.ll | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/llvm/test/CodeGen/X86/jump_sign.ll b/llvm/test/CodeGen/X86/jump_sign.ll index 94cbe5d1937..d253e15774c 100644 --- a/llvm/test/CodeGen/X86/jump_sign.ll +++ b/llvm/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 +} |

