summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorShuxin Yang <shuxin.llvm@gmail.com>2012-10-31 23:11:48 +0000
committerShuxin Yang <shuxin.llvm@gmail.com>2012-10-31 23:11:48 +0000
commita5526a9bffbd62a14d576f583c206a8a781cc2f1 (patch)
treee58a6a7c0baec3b6f947d8df16933e36fdc374ac /test
parente57b2cbce652d45ed5516e52ad82991bfa03cfd7 (diff)
downloadllvm-a5526a9bffbd62a14d576f583c206a8a781cc2f1.tar.gz
llvm-a5526a9bffbd62a14d576f583c206a8a781cc2f1.tar.bz2
llvm-a5526a9bffbd62a14d576f583c206a8a781cc2f1.tar.xz
(For X86) Enhancement to add-carray/sub-borrow (adc/sbb) optimization.
The adc/sbb optimization is to able to convert following expression into a single adc/sbb instruction: (ult) ... = x + 1 // where the ult is unsigned-less-than comparison (ult) ... = x - 1 This change is to flip the "x >u y" (i.e. ugt comparison) in order to expose the adc/sbb opportunity. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@167180 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
-rw-r--r--test/CodeGen/X86/add-of-carry.ll13
-rw-r--r--test/CodeGen/X86/jump_sign.ll1
2 files changed, 13 insertions, 1 deletions
diff --git a/test/CodeGen/X86/add-of-carry.ll b/test/CodeGen/X86/add-of-carry.ll
index a4abccba7e..4e30f2b05a 100644
--- a/test/CodeGen/X86/add-of-carry.ll
+++ b/test/CodeGen/X86/add-of-carry.ll
@@ -30,4 +30,17 @@ entry:
ret i32 %z.0
}
+; <rdar://problem/12579915>
+define i32 @test3(i32 %x, i32 %y, i32 %res) nounwind uwtable readnone ssp {
+entry:
+ %cmp = icmp ugt i32 %x, %y
+ %dec = sext i1 %cmp to i32
+ %dec.res = add nsw i32 %dec, %res
+ ret i32 %dec.res
+; CHECK: test3:
+; CHECK: cmpl
+; CHECK: sbbl
+; CHECK: ret
+}
+
declare { i32, i1 } @llvm.uadd.with.overflow.i32(i32, i32) nounwind readnone
diff --git a/test/CodeGen/X86/jump_sign.ll b/test/CodeGen/X86/jump_sign.ll
index 78d9e06f59..0e34222b94 100644
--- a/test/CodeGen/X86/jump_sign.ll
+++ b/test/CodeGen/X86/jump_sign.ll
@@ -219,7 +219,6 @@ entry:
; by sbb, we should not optimize cmp away.
define i32 @q(i32 %j.4, i32 %w, i32 %el) {
; CHECK: q:
-; CHECK: sub
; CHECK: cmp
; CHECK-NEXT: sbb
%tmp532 = add i32 %j.4, %w