Home | History | Annotate | Download | only in X86
      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: test1:
      7 ; CHECK: cmpl %ecx, %eax
      8 ; CHECK-NOT: addl
      9 ; CHECK: adcl $0, %eax
     10   %add4 = add i32 %x, %sum
     11   %cmp = icmp ult i32 %add4, %x
     12   %inc = zext i1 %cmp to i32
     13   %z.0 = add i32 %add4, %inc
     14   ret i32 %z.0
     15 }
     16 
     17 ; Instcombine transforms test1 into test2:
     18 ; CHECK: test2:
     19 ; CHECK: movl
     20 ; CHECK-NEXT: addl
     21 ; CHECK-NEXT: adcl $0
     22 ; CHECK-NEXT: ret
     23 define i32 @test2(i32 %sum, i32 %x) nounwind readnone ssp {
     24 entry:
     25   %uadd = call { i32, i1 } @llvm.uadd.with.overflow.i32(i32 %x, i32 %sum)
     26   %0 = extractvalue { i32, i1 } %uadd, 0
     27   %cmp = extractvalue { i32, i1 } %uadd, 1
     28   %inc = zext i1 %cmp to i32
     29   %z.0 = add i32 %0, %inc
     30   ret i32 %z.0
     31 }
     32 
     33 declare { i32, i1 } @llvm.uadd.with.overflow.i32(i32, i32) nounwind readnone
     34