1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2; RUN: llc -mtriple=x86_64-linux-gnu    -global-isel -verify-machineinstrs < %s -o - | FileCheck %s --check-prefix=ALL
3
4define i32 @test_icmp_eq_i8(i8 %a, i8 %b) {
5; ALL-LABEL: test_icmp_eq_i8:
6; ALL:       # %bb.0:
7; ALL-NEXT:    cmpb %sil, %dil
8; ALL-NEXT:    sete %al
9; ALL-NEXT:    andl $1, %eax
10; ALL-NEXT:    retq
11  %r = icmp eq i8 %a, %b
12  %res =  zext i1 %r to i32
13  ret i32 %res
14}
15
16define i32 @test_icmp_eq_i16(i16 %a, i16 %b) {
17; ALL-LABEL: test_icmp_eq_i16:
18; ALL:       # %bb.0:
19; ALL-NEXT:    cmpw %si, %di
20; ALL-NEXT:    sete %al
21; ALL-NEXT:    andl $1, %eax
22; ALL-NEXT:    retq
23  %r = icmp eq i16 %a, %b
24  %res =  zext i1 %r to i32
25  ret i32 %res
26}
27
28define i32 @test_icmp_eq_i64(i64 %a, i64 %b) {
29; ALL-LABEL: test_icmp_eq_i64:
30; ALL:       # %bb.0:
31; ALL-NEXT:    cmpq %rsi, %rdi
32; ALL-NEXT:    sete %al
33; ALL-NEXT:    andl $1, %eax
34; ALL-NEXT:    retq
35  %r = icmp eq i64 %a, %b
36  %res =  zext i1 %r to i32
37  ret i32 %res
38}
39
40define i32 @test_icmp_eq_i32(i32 %a, i32 %b) {
41; ALL-LABEL: test_icmp_eq_i32:
42; ALL:       # %bb.0:
43; ALL-NEXT:    cmpl %esi, %edi
44; ALL-NEXT:    sete %al
45; ALL-NEXT:    andl $1, %eax
46; ALL-NEXT:    retq
47  %r = icmp eq i32 %a, %b
48  %res =  zext i1 %r to i32
49  ret i32 %res
50}
51
52define i32 @test_icmp_ne_i32(i32 %a, i32 %b) {
53; ALL-LABEL: test_icmp_ne_i32:
54; ALL:       # %bb.0:
55; ALL-NEXT:    cmpl %esi, %edi
56; ALL-NEXT:    setne %al
57; ALL-NEXT:    andl $1, %eax
58; ALL-NEXT:    retq
59  %r = icmp ne i32 %a, %b
60  %res =  zext i1 %r to i32
61  ret i32 %res
62}
63
64define i32 @test_icmp_ugt_i32(i32 %a, i32 %b) {
65; ALL-LABEL: test_icmp_ugt_i32:
66; ALL:       # %bb.0:
67; ALL-NEXT:    cmpl %esi, %edi
68; ALL-NEXT:    seta %al
69; ALL-NEXT:    andl $1, %eax
70; ALL-NEXT:    retq
71  %r = icmp ugt i32 %a, %b
72  %res =  zext i1 %r to i32
73  ret i32 %res
74}
75
76define i32 @test_icmp_uge_i32(i32 %a, i32 %b) {
77; ALL-LABEL: test_icmp_uge_i32:
78; ALL:       # %bb.0:
79; ALL-NEXT:    cmpl %esi, %edi
80; ALL-NEXT:    setae %al
81; ALL-NEXT:    andl $1, %eax
82; ALL-NEXT:    retq
83  %r = icmp uge i32 %a, %b
84  %res =  zext i1 %r to i32
85  ret i32 %res
86}
87
88define i32 @test_icmp_ult_i32(i32 %a, i32 %b) {
89; ALL-LABEL: test_icmp_ult_i32:
90; ALL:       # %bb.0:
91; ALL-NEXT:    cmpl %esi, %edi
92; ALL-NEXT:    setb %al
93; ALL-NEXT:    andl $1, %eax
94; ALL-NEXT:    retq
95  %r = icmp ult i32 %a, %b
96  %res =  zext i1 %r to i32
97  ret i32 %res
98}
99
100define i32 @test_icmp_ule_i32(i32 %a, i32 %b) {
101; ALL-LABEL: test_icmp_ule_i32:
102; ALL:       # %bb.0:
103; ALL-NEXT:    cmpl %esi, %edi
104; ALL-NEXT:    setbe %al
105; ALL-NEXT:    andl $1, %eax
106; ALL-NEXT:    retq
107  %r = icmp ule i32 %a, %b
108  %res =  zext i1 %r to i32
109  ret i32 %res
110}
111
112define i32 @test_icmp_sgt_i32(i32 %a, i32 %b) {
113; ALL-LABEL: test_icmp_sgt_i32:
114; ALL:       # %bb.0:
115; ALL-NEXT:    cmpl %esi, %edi
116; ALL-NEXT:    setg %al
117; ALL-NEXT:    andl $1, %eax
118; ALL-NEXT:    retq
119  %r = icmp sgt i32 %a, %b
120  %res =  zext i1 %r to i32
121  ret i32 %res
122}
123
124define i32 @test_icmp_sge_i32(i32 %a, i32 %b) {
125; ALL-LABEL: test_icmp_sge_i32:
126; ALL:       # %bb.0:
127; ALL-NEXT:    cmpl %esi, %edi
128; ALL-NEXT:    setge %al
129; ALL-NEXT:    andl $1, %eax
130; ALL-NEXT:    retq
131  %r = icmp sge i32 %a, %b
132  %res =  zext i1 %r to i32
133  ret i32 %res
134}
135
136define i32 @test_icmp_slt_i32(i32 %a, i32 %b) {
137; ALL-LABEL: test_icmp_slt_i32:
138; ALL:       # %bb.0:
139; ALL-NEXT:    cmpl %esi, %edi
140; ALL-NEXT:    setl %al
141; ALL-NEXT:    andl $1, %eax
142; ALL-NEXT:    retq
143  %r = icmp slt i32 %a, %b
144  %res =  zext i1 %r to i32
145  ret i32 %res
146}
147
148define i32 @test_icmp_sle_i32(i32 %a, i32 %b) {
149; ALL-LABEL: test_icmp_sle_i32:
150; ALL:       # %bb.0:
151; ALL-NEXT:    cmpl %esi, %edi
152; ALL-NEXT:    setle %al
153; ALL-NEXT:    andl $1, %eax
154; ALL-NEXT:    retq
155  %r = icmp sle i32 %a, %b
156  %res =  zext i1 %r to i32
157  ret i32 %res
158}
159
160