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