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