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