1; RUN: llc -march=x86 < %s | FileCheck %s 2 3define i32 @test1(i32 %a, i32 %b) nounwind readnone { 4 %not.cmp = icmp ne i32 %a, 0 5 %inc = zext i1 %not.cmp to i32 6 %retval.0 = add i32 %inc, %b 7 ret i32 %retval.0 8; CHECK-LABEL: test1: 9; CHECK: cmpl $1 10; CHECK: sbbl $-1 11; CHECK: ret 12} 13 14define i32 @test2(i32 %a, i32 %b) nounwind readnone { 15 %cmp = icmp eq i32 %a, 0 16 %inc = zext i1 %cmp to i32 17 %retval.0 = add i32 %inc, %b 18 ret i32 %retval.0 19; CHECK-LABEL: test2: 20; CHECK: cmpl $1 21; CHECK: adcl $0 22; CHECK: ret 23} 24 25define i32 @test3(i32 %a, i32 %b) nounwind readnone { 26 %cmp = icmp eq i32 %a, 0 27 %inc = zext i1 %cmp to i32 28 %retval.0 = add i32 %inc, %b 29 ret i32 %retval.0 30; CHECK-LABEL: test3: 31; CHECK: cmpl $1 32; CHECK: adcl $0 33; CHECK: ret 34} 35 36define i32 @test4(i32 %a, i32 %b) nounwind readnone { 37 %not.cmp = icmp ne i32 %a, 0 38 %inc = zext i1 %not.cmp to i32 39 %retval.0 = add i32 %inc, %b 40 ret i32 %retval.0 41; CHECK-LABEL: test4: 42; CHECK: cmpl $1 43; CHECK: sbbl $-1 44; CHECK: ret 45} 46 47define i32 @test5(i32 %a, i32 %b) nounwind readnone { 48 %not.cmp = icmp ne i32 %a, 0 49 %inc = zext i1 %not.cmp to i32 50 %retval.0 = sub i32 %b, %inc 51 ret i32 %retval.0 52; CHECK-LABEL: test5: 53; CHECK: cmpl $1 54; CHECK: adcl $-1 55; CHECK: ret 56} 57 58define i32 @test6(i32 %a, i32 %b) nounwind readnone { 59 %cmp = icmp eq i32 %a, 0 60 %inc = zext i1 %cmp to i32 61 %retval.0 = sub i32 %b, %inc 62 ret i32 %retval.0 63; CHECK-LABEL: test6: 64; CHECK: cmpl $1 65; CHECK: sbbl $0 66; CHECK: ret 67} 68 69define i32 @test7(i32 %a, i32 %b) nounwind readnone { 70 %cmp = icmp eq i32 %a, 0 71 %inc = zext i1 %cmp to i32 72 %retval.0 = sub i32 %b, %inc 73 ret i32 %retval.0 74; CHECK-LABEL: test7: 75; CHECK: cmpl $1 76; CHECK: sbbl $0 77; CHECK: ret 78} 79 80define i32 @test8(i32 %a, i32 %b) nounwind readnone { 81 %not.cmp = icmp ne i32 %a, 0 82 %inc = zext i1 %not.cmp to i32 83 %retval.0 = sub i32 %b, %inc 84 ret i32 %retval.0 85; CHECK-LABEL: test8: 86; CHECK: cmpl $1 87; CHECK: adcl $-1 88; CHECK: ret 89} 90