1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -mtriple=x86_64-linux-gnu -run-pass=instruction-select -verify-machineinstrs %s -o - | FileCheck %s --check-prefix=CHECK
5 define i32 @test_icmp_eq_i8(i8 %a, i8 %b) {
7 %res = zext i1 %r to i32
11 define i32 @test_icmp_eq_i16(i16 %a, i16 %b) {
12 %r = icmp eq i16 %a, %b
13 %res = zext i1 %r to i32
17 define i32 @test_icmp_eq_i64(i64 %a, i64 %b) {
18 %r = icmp eq i64 %a, %b
19 %res = zext i1 %r to i32
23 define i32 @test_icmp_eq_i32(i32 %a, i32 %b) {
24 %r = icmp eq i32 %a, %b
25 %res = zext i1 %r to i32
29 define i32 @test_icmp_ne_i32(i32 %a, i32 %b) {
30 %r = icmp ne i32 %a, %b
31 %res = zext i1 %r to i32
35 define i32 @test_icmp_ugt_i32(i32 %a, i32 %b) {
36 %r = icmp ugt i32 %a, %b
37 %res = zext i1 %r to i32
41 define i32 @test_icmp_uge_i32(i32 %a, i32 %b) {
42 %r = icmp uge i32 %a, %b
43 %res = zext i1 %r to i32
47 define i32 @test_icmp_ult_i32(i32 %a, i32 %b) {
48 %r = icmp ult i32 %a, %b
49 %res = zext i1 %r to i32
53 define i32 @test_icmp_ule_i32(i32 %a, i32 %b) {
54 %r = icmp ule i32 %a, %b
55 %res = zext i1 %r to i32
59 define i32 @test_icmp_sgt_i32(i32 %a, i32 %b) {
60 %r = icmp sgt i32 %a, %b
61 %res = zext i1 %r to i32
65 define i32 @test_icmp_sge_i32(i32 %a, i32 %b) {
66 %r = icmp sge i32 %a, %b
67 %res = zext i1 %r to i32
71 define i32 @test_icmp_slt_i32(i32 %a, i32 %b) {
72 %r = icmp slt i32 %a, %b
73 %res = zext i1 %r to i32
77 define i32 @test_icmp_sle_i32(i32 %a, i32 %b) {
78 %r = icmp sle i32 %a, %b
79 %res = zext i1 %r to i32
90 - { id: 0, class: gpr }
91 - { id: 1, class: gpr }
92 - { id: 2, class: gpr }
93 - { id: 3, class: gpr }
98 ; CHECK-LABEL: name: test_icmp_eq_i8
99 ; CHECK: [[COPY:%[0-9]+]]:gr8 = COPY $dil
100 ; CHECK: [[COPY1:%[0-9]+]]:gr8 = COPY $sil
101 ; CHECK: CMP8rr [[COPY]], [[COPY1]], implicit-def $eflags
102 ; CHECK: [[SETCCr:%[0-9]+]]:gr8 = SETCCr 4, implicit $eflags
103 ; CHECK: [[SUBREG_TO_REG:%[0-9]+]]:gr32 = SUBREG_TO_REG 0, [[SETCCr]], %subreg.sub_8bit
104 ; CHECK: [[AND32ri8_:%[0-9]+]]:gr32 = AND32ri8 [[SUBREG_TO_REG]], 1, implicit-def $eflags
105 ; CHECK: $eax = COPY [[AND32ri8_]]
106 ; CHECK: RET 0, implicit $eax
109 %2(s1) = G_ICMP intpred(eq), %0(s8), %1
110 %3(s32) = G_ZEXT %2(s1)
116 name: test_icmp_eq_i16
119 regBankSelected: true
121 - { id: 0, class: gpr }
122 - { id: 1, class: gpr }
123 - { id: 2, class: gpr }
124 - { id: 3, class: gpr }
129 ; CHECK-LABEL: name: test_icmp_eq_i16
130 ; CHECK: [[COPY:%[0-9]+]]:gr16 = COPY $di
131 ; CHECK: [[COPY1:%[0-9]+]]:gr16 = COPY $si
132 ; CHECK: CMP16rr [[COPY]], [[COPY1]], implicit-def $eflags
133 ; CHECK: [[SETCCr:%[0-9]+]]:gr8 = SETCCr 4, implicit $eflags
134 ; CHECK: [[SUBREG_TO_REG:%[0-9]+]]:gr32 = SUBREG_TO_REG 0, [[SETCCr]], %subreg.sub_8bit
135 ; CHECK: [[AND32ri8_:%[0-9]+]]:gr32 = AND32ri8 [[SUBREG_TO_REG]], 1, implicit-def $eflags
136 ; CHECK: $eax = COPY [[AND32ri8_]]
137 ; CHECK: RET 0, implicit $eax
140 %2(s1) = G_ICMP intpred(eq), %0(s16), %1
141 %3(s32) = G_ZEXT %2(s1)
147 name: test_icmp_eq_i64
150 regBankSelected: true
152 - { id: 0, class: gpr }
153 - { id: 1, class: gpr }
154 - { id: 2, class: gpr }
155 - { id: 3, class: gpr }
160 ; CHECK-LABEL: name: test_icmp_eq_i64
161 ; CHECK: [[COPY:%[0-9]+]]:gr64 = COPY $rdi
162 ; CHECK: [[COPY1:%[0-9]+]]:gr64 = COPY $rsi
163 ; CHECK: CMP64rr [[COPY]], [[COPY1]], implicit-def $eflags
164 ; CHECK: [[SETCCr:%[0-9]+]]:gr8 = SETCCr 4, implicit $eflags
165 ; CHECK: [[SUBREG_TO_REG:%[0-9]+]]:gr32 = SUBREG_TO_REG 0, [[SETCCr]], %subreg.sub_8bit
166 ; CHECK: [[AND32ri8_:%[0-9]+]]:gr32 = AND32ri8 [[SUBREG_TO_REG]], 1, implicit-def $eflags
167 ; CHECK: $eax = COPY [[AND32ri8_]]
168 ; CHECK: RET 0, implicit $eax
171 %2(s1) = G_ICMP intpred(eq), %0(s64), %1
172 %3(s32) = G_ZEXT %2(s1)
178 name: test_icmp_eq_i32
181 regBankSelected: true
183 - { id: 0, class: gpr }
184 - { id: 1, class: gpr }
185 - { id: 2, class: gpr }
186 - { id: 3, class: gpr }
191 ; CHECK-LABEL: name: test_icmp_eq_i32
192 ; CHECK: [[COPY:%[0-9]+]]:gr32 = COPY $edi
193 ; CHECK: [[COPY1:%[0-9]+]]:gr32 = COPY $esi
194 ; CHECK: CMP32rr [[COPY]], [[COPY1]], implicit-def $eflags
195 ; CHECK: [[SETCCr:%[0-9]+]]:gr8 = SETCCr 4, implicit $eflags
196 ; CHECK: [[SUBREG_TO_REG:%[0-9]+]]:gr32 = SUBREG_TO_REG 0, [[SETCCr]], %subreg.sub_8bit
197 ; CHECK: [[AND32ri8_:%[0-9]+]]:gr32 = AND32ri8 [[SUBREG_TO_REG]], 1, implicit-def $eflags
198 ; CHECK: $eax = COPY [[AND32ri8_]]
199 ; CHECK: RET 0, implicit $eax
202 %2(s1) = G_ICMP intpred(eq), %0(s32), %1
203 %3(s32) = G_ZEXT %2(s1)
209 name: test_icmp_ne_i32
212 regBankSelected: true
214 - { id: 0, class: gpr }
215 - { id: 1, class: gpr }
216 - { id: 2, class: gpr }
217 - { id: 3, class: gpr }
222 ; CHECK-LABEL: name: test_icmp_ne_i32
223 ; CHECK: [[COPY:%[0-9]+]]:gr32 = COPY $edi
224 ; CHECK: [[COPY1:%[0-9]+]]:gr32 = COPY $esi
225 ; CHECK: CMP32rr [[COPY]], [[COPY1]], implicit-def $eflags
226 ; CHECK: [[SETCCr:%[0-9]+]]:gr8 = SETCCr 5, implicit $eflags
227 ; CHECK: [[SUBREG_TO_REG:%[0-9]+]]:gr32 = SUBREG_TO_REG 0, [[SETCCr]], %subreg.sub_8bit
228 ; CHECK: [[AND32ri8_:%[0-9]+]]:gr32 = AND32ri8 [[SUBREG_TO_REG]], 1, implicit-def $eflags
229 ; CHECK: $eax = COPY [[AND32ri8_]]
230 ; CHECK: RET 0, implicit $eax
233 %2(s1) = G_ICMP intpred(ne), %0(s32), %1
234 %3(s32) = G_ZEXT %2(s1)
240 name: test_icmp_ugt_i32
243 regBankSelected: true
245 - { id: 0, class: gpr }
246 - { id: 1, class: gpr }
247 - { id: 2, class: gpr }
248 - { id: 3, class: gpr }
253 ; CHECK-LABEL: name: test_icmp_ugt_i32
254 ; CHECK: [[COPY:%[0-9]+]]:gr32 = COPY $edi
255 ; CHECK: [[COPY1:%[0-9]+]]:gr32 = COPY $esi
256 ; CHECK: CMP32rr [[COPY]], [[COPY1]], implicit-def $eflags
257 ; CHECK: [[SETCCr:%[0-9]+]]:gr8 = SETCCr 7, implicit $eflags
258 ; CHECK: [[SUBREG_TO_REG:%[0-9]+]]:gr32 = SUBREG_TO_REG 0, [[SETCCr]], %subreg.sub_8bit
259 ; CHECK: [[AND32ri8_:%[0-9]+]]:gr32 = AND32ri8 [[SUBREG_TO_REG]], 1, implicit-def $eflags
260 ; CHECK: $eax = COPY [[AND32ri8_]]
261 ; CHECK: RET 0, implicit $eax
264 %2(s1) = G_ICMP intpred(ugt), %0(s32), %1
265 %3(s32) = G_ZEXT %2(s1)
271 name: test_icmp_uge_i32
274 regBankSelected: true
276 - { id: 0, class: gpr }
277 - { id: 1, class: gpr }
278 - { id: 2, class: gpr }
279 - { id: 3, class: gpr }
284 ; CHECK-LABEL: name: test_icmp_uge_i32
285 ; CHECK: [[COPY:%[0-9]+]]:gr32 = COPY $edi
286 ; CHECK: [[COPY1:%[0-9]+]]:gr32 = COPY $esi
287 ; CHECK: CMP32rr [[COPY]], [[COPY1]], implicit-def $eflags
288 ; CHECK: [[SETCCr:%[0-9]+]]:gr8 = SETCCr 3, implicit $eflags
289 ; CHECK: [[SUBREG_TO_REG:%[0-9]+]]:gr32 = SUBREG_TO_REG 0, [[SETCCr]], %subreg.sub_8bit
290 ; CHECK: [[AND32ri8_:%[0-9]+]]:gr32 = AND32ri8 [[SUBREG_TO_REG]], 1, implicit-def $eflags
291 ; CHECK: $eax = COPY [[AND32ri8_]]
292 ; CHECK: RET 0, implicit $eax
295 %2(s1) = G_ICMP intpred(uge), %0(s32), %1
296 %3(s32) = G_ZEXT %2(s1)
302 name: test_icmp_ult_i32
305 regBankSelected: true
307 - { id: 0, class: gpr }
308 - { id: 1, class: gpr }
309 - { id: 2, class: gpr }
310 - { id: 3, class: gpr }
315 ; CHECK-LABEL: name: test_icmp_ult_i32
316 ; CHECK: [[COPY:%[0-9]+]]:gr32 = COPY $edi
317 ; CHECK: [[COPY1:%[0-9]+]]:gr32 = COPY $esi
318 ; CHECK: CMP32rr [[COPY]], [[COPY1]], implicit-def $eflags
319 ; CHECK: [[SETCCr:%[0-9]+]]:gr8 = SETCCr 2, implicit $eflags
320 ; CHECK: [[SUBREG_TO_REG:%[0-9]+]]:gr32 = SUBREG_TO_REG 0, [[SETCCr]], %subreg.sub_8bit
321 ; CHECK: [[AND32ri8_:%[0-9]+]]:gr32 = AND32ri8 [[SUBREG_TO_REG]], 1, implicit-def $eflags
322 ; CHECK: $eax = COPY [[AND32ri8_]]
323 ; CHECK: RET 0, implicit $eax
326 %2(s1) = G_ICMP intpred(ult), %0(s32), %1
327 %3(s32) = G_ZEXT %2(s1)
333 name: test_icmp_ule_i32
336 regBankSelected: true
338 - { id: 0, class: gpr }
339 - { id: 1, class: gpr }
340 - { id: 2, class: gpr }
341 - { id: 3, class: gpr }
346 ; CHECK-LABEL: name: test_icmp_ule_i32
347 ; CHECK: [[COPY:%[0-9]+]]:gr32 = COPY $edi
348 ; CHECK: [[COPY1:%[0-9]+]]:gr32 = COPY $esi
349 ; CHECK: CMP32rr [[COPY]], [[COPY1]], implicit-def $eflags
350 ; CHECK: [[SETCCr:%[0-9]+]]:gr8 = SETCCr 6, implicit $eflags
351 ; CHECK: [[SUBREG_TO_REG:%[0-9]+]]:gr32 = SUBREG_TO_REG 0, [[SETCCr]], %subreg.sub_8bit
352 ; CHECK: [[AND32ri8_:%[0-9]+]]:gr32 = AND32ri8 [[SUBREG_TO_REG]], 1, implicit-def $eflags
353 ; CHECK: $eax = COPY [[AND32ri8_]]
354 ; CHECK: RET 0, implicit $eax
357 %2(s1) = G_ICMP intpred(ule), %0(s32), %1
358 %3(s32) = G_ZEXT %2(s1)
364 name: test_icmp_sgt_i32
367 regBankSelected: true
369 - { id: 0, class: gpr }
370 - { id: 1, class: gpr }
371 - { id: 2, class: gpr }
372 - { id: 3, class: gpr }
377 ; CHECK-LABEL: name: test_icmp_sgt_i32
378 ; CHECK: [[COPY:%[0-9]+]]:gr32 = COPY $edi
379 ; CHECK: [[COPY1:%[0-9]+]]:gr32 = COPY $esi
380 ; CHECK: CMP32rr [[COPY]], [[COPY1]], implicit-def $eflags
381 ; CHECK: [[SETCCr:%[0-9]+]]:gr8 = SETCCr 15, implicit $eflags
382 ; CHECK: [[SUBREG_TO_REG:%[0-9]+]]:gr32 = SUBREG_TO_REG 0, [[SETCCr]], %subreg.sub_8bit
383 ; CHECK: [[AND32ri8_:%[0-9]+]]:gr32 = AND32ri8 [[SUBREG_TO_REG]], 1, implicit-def $eflags
384 ; CHECK: $eax = COPY [[AND32ri8_]]
385 ; CHECK: RET 0, implicit $eax
388 %2(s1) = G_ICMP intpred(sgt), %0(s32), %1
389 %3(s32) = G_ZEXT %2(s1)
395 name: test_icmp_sge_i32
398 regBankSelected: true
400 - { id: 0, class: gpr }
401 - { id: 1, class: gpr }
402 - { id: 2, class: gpr }
403 - { id: 3, class: gpr }
408 ; CHECK-LABEL: name: test_icmp_sge_i32
409 ; CHECK: [[COPY:%[0-9]+]]:gr32 = COPY $edi
410 ; CHECK: [[COPY1:%[0-9]+]]:gr32 = COPY $esi
411 ; CHECK: CMP32rr [[COPY]], [[COPY1]], implicit-def $eflags
412 ; CHECK: [[SETCCr:%[0-9]+]]:gr8 = SETCCr 13, implicit $eflags
413 ; CHECK: [[SUBREG_TO_REG:%[0-9]+]]:gr32 = SUBREG_TO_REG 0, [[SETCCr]], %subreg.sub_8bit
414 ; CHECK: [[AND32ri8_:%[0-9]+]]:gr32 = AND32ri8 [[SUBREG_TO_REG]], 1, implicit-def $eflags
415 ; CHECK: $eax = COPY [[AND32ri8_]]
416 ; CHECK: RET 0, implicit $eax
419 %2(s1) = G_ICMP intpred(sge), %0(s32), %1
420 %3(s32) = G_ZEXT %2(s1)
426 name: test_icmp_slt_i32
429 regBankSelected: true
431 - { id: 0, class: gpr }
432 - { id: 1, class: gpr }
433 - { id: 2, class: gpr }
434 - { id: 3, class: gpr }
439 ; CHECK-LABEL: name: test_icmp_slt_i32
440 ; CHECK: [[COPY:%[0-9]+]]:gr32 = COPY $edi
441 ; CHECK: [[COPY1:%[0-9]+]]:gr32 = COPY $esi
442 ; CHECK: CMP32rr [[COPY]], [[COPY1]], implicit-def $eflags
443 ; CHECK: [[SETCCr:%[0-9]+]]:gr8 = SETCCr 12, implicit $eflags
444 ; CHECK: [[SUBREG_TO_REG:%[0-9]+]]:gr32 = SUBREG_TO_REG 0, [[SETCCr]], %subreg.sub_8bit
445 ; CHECK: [[AND32ri8_:%[0-9]+]]:gr32 = AND32ri8 [[SUBREG_TO_REG]], 1, implicit-def $eflags
446 ; CHECK: $eax = COPY [[AND32ri8_]]
447 ; CHECK: RET 0, implicit $eax
450 %2(s1) = G_ICMP intpred(slt), %0(s32), %1
451 %3(s32) = G_ZEXT %2(s1)
457 name: test_icmp_sle_i32
460 regBankSelected: true
462 - { id: 0, class: gpr }
463 - { id: 1, class: gpr }
464 - { id: 2, class: gpr }
465 - { id: 3, class: gpr }
470 ; CHECK-LABEL: name: test_icmp_sle_i32
471 ; CHECK: [[COPY:%[0-9]+]]:gr32 = COPY $edi
472 ; CHECK: [[COPY1:%[0-9]+]]:gr32 = COPY $esi
473 ; CHECK: CMP32rr [[COPY]], [[COPY1]], implicit-def $eflags
474 ; CHECK: [[SETCCr:%[0-9]+]]:gr8 = SETCCr 14, implicit $eflags
475 ; CHECK: [[SUBREG_TO_REG:%[0-9]+]]:gr32 = SUBREG_TO_REG 0, [[SETCCr]], %subreg.sub_8bit
476 ; CHECK: [[AND32ri8_:%[0-9]+]]:gr32 = AND32ri8 [[SUBREG_TO_REG]], 1, implicit-def $eflags
477 ; CHECK: $eax = COPY [[AND32ri8_]]
478 ; CHECK: RET 0, implicit $eax
481 %2(s1) = G_ICMP intpred(sle), %0(s32), %1
482 %3(s32) = G_ZEXT %2(s1)