summaryrefslogtreecommitdiff
path: root/test/CodeGen/X86/jump_sign.ll
diff options
context:
space:
mode:
authorManman Ren <mren@apple.com>2012-07-11 19:35:12 +0000
committerManman Ren <mren@apple.com>2012-07-11 19:35:12 +0000
commit84ae7e9034ef4dd0b9c88c5cf0e5e91ab50a7ef1 (patch)
tree5bc419a39de470473836a8472e717d50c3448310 /test/CodeGen/X86/jump_sign.ll
parent3fef29d88100881e7a52e570c30052e0d44c62ee (diff)
downloadllvm-84ae7e9034ef4dd0b9c88c5cf0e5e91ab50a7ef1.tar.gz
llvm-84ae7e9034ef4dd0b9c88c5cf0e5e91ab50a7ef1.tar.bz2
llvm-84ae7e9034ef4dd0b9c88c5cf0e5e91ab50a7ef1.tar.xz
X86: Update to peephole optimization to move Movr0 before (Sub, Cmp) pair.
When Movr0 is between sub and cmp, we move Movr0 before sub if it enables removal of Cmp. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@160066 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGen/X86/jump_sign.ll')
-rw-r--r--test/CodeGen/X86/jump_sign.ll12
1 files changed, 12 insertions, 0 deletions
diff --git a/test/CodeGen/X86/jump_sign.ll b/test/CodeGen/X86/jump_sign.ll
index b868218eca..49f41767a2 100644
--- a/test/CodeGen/X86/jump_sign.ll
+++ b/test/CodeGen/X86/jump_sign.ll
@@ -137,6 +137,18 @@ if.else:
%add = add nsw i32 %sub, 1
ret i32 %add
}
+; rdar://11830760
+; When Movr0 is between sub and cmp, we need to move "Movr0" before sub.
+define i32 @l4(i32 %a, i32 %b) nounwind {
+entry:
+; CHECK: l4:
+; CHECK: sub
+; CHECK-NOT: cmp
+ %cmp = icmp sgt i32 %b, %a
+ %sub = sub i32 %a, %b
+ %.sub = select i1 %cmp, i32 0, i32 %sub
+ ret i32 %.sub
+}
; rdar://11540023
define i32 @n(i32 %x, i32 %y) nounwind {
entry: