Merging r261039:
[oota-llvm.git] / test / CodeGen / X86 / add-of-carry.ll
1 ; RUN: llc < %s -march=x86 | FileCheck %s
2 ; <rdar://problem/8449754>
3
4 define i32 @test1(i32 %sum, i32 %x) nounwind readnone ssp {
5 entry:
6 ; CHECK-LABEL: test1:
7 ; CHECK: movl
8 ; CHECK-NEXT: addl
9 ; CHECK-NEXT: adcl $0
10 ; CHECK-NEXT: ret
11   %add4 = add i32 %x, %sum
12   %cmp = icmp ult i32 %add4, %x
13   %inc = zext i1 %cmp to i32
14   %z.0 = add i32 %add4, %inc
15   ret i32 %z.0
16 }
17
18 ; <rdar://problem/12579915>
19 define i32 @test2(i32 %x, i32 %y, i32 %res) nounwind uwtable readnone ssp {
20 entry:
21   %cmp = icmp ugt i32 %x, %y
22   %dec = sext i1 %cmp to i32
23   %dec.res = add nsw i32 %dec, %res
24   ret i32 %dec.res
25 ; CHECK-LABEL: test2:
26 ; CHECK: cmpl
27 ; CHECK: sbbl
28 ; CHECK: ret
29 }