1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -mtriple=x86_64-linux-gnu -run-pass=legalizer %s -o - | FileCheck %s --check-prefix=ALL
6 define zeroext i1 @test_i1(i32 %a, i1 zeroext %f, i1 zeroext %t) {
8 %cmp = icmp sgt i32 %a, 0
9 br i1 %cmp, label %cond.true, label %cond.false
11 cond.true: ; preds = %entry
14 cond.false: ; preds = %entry
17 cond.end: ; preds = %cond.false, %cond.true
18 %cond = phi i1 [ %f, %cond.true ], [ %t, %cond.false ]
22 define i8 @test_i8(i32 %a, i8 %f, i8 %t) {
24 %cmp = icmp sgt i32 %a, 0
25 br i1 %cmp, label %cond.true, label %cond.false
27 cond.true: ; preds = %entry
30 cond.false: ; preds = %entry
33 cond.end: ; preds = %cond.false, %cond.true
34 %cond = phi i8 [ %f, %cond.true ], [ %t, %cond.false ]
38 define i16 @test_i16(i32 %a, i16 %f, i16 %t) {
40 %cmp = icmp sgt i32 %a, 0
41 br i1 %cmp, label %cond.true, label %cond.false
43 cond.true: ; preds = %entry
46 cond.false: ; preds = %entry
49 cond.end: ; preds = %cond.false, %cond.true
50 %cond = phi i16 [ %f, %cond.true ], [ %t, %cond.false ]
54 define i32 @test_i32(i32 %a, i32 %f, i32 %t) {
56 %cmp = icmp sgt i32 %a, 0
57 br i1 %cmp, label %cond.true, label %cond.false
59 cond.true: ; preds = %entry
62 cond.false: ; preds = %entry
65 cond.end: ; preds = %cond.false, %cond.true
66 %cond = phi i32 [ %f, %cond.true ], [ %t, %cond.false ]
70 define i64 @test_i64(i32 %a, i64 %f, i64 %t) {
72 %cmp = icmp sgt i32 %a, 0
73 br i1 %cmp, label %cond.true, label %cond.false
75 cond.true: ; preds = %entry
78 cond.false: ; preds = %entry
81 cond.end: ; preds = %cond.false, %cond.true
82 %cond = phi i64 [ %f, %cond.true ], [ %t, %cond.false ]
86 define float @test_float(i32 %a, float %f, float %t) {
88 %cmp = icmp sgt i32 %a, 0
89 br i1 %cmp, label %cond.true, label %cond.false
91 cond.true: ; preds = %entry
94 cond.false: ; preds = %entry
97 cond.end: ; preds = %cond.false, %cond.true
98 %cond = phi float [ %f, %cond.true ], [ %t, %cond.false ]
102 define double @test_double(i32 %a, double %f, double %t) {
104 %cmp = icmp sgt i32 %a, 0
105 br i1 %cmp, label %cond.true, label %cond.false
107 cond.true: ; preds = %entry
110 cond.false: ; preds = %entry
113 cond.end: ; preds = %cond.false, %cond.true
114 %cond = phi double [ %f, %cond.true ], [ %t, %cond.false ]
123 regBankSelected: false
124 tracksRegLiveness: true
126 - { id: 0, class: _, preferred-register: '' }
127 - { id: 1, class: _, preferred-register: '' }
128 - { id: 2, class: _, preferred-register: '' }
129 - { id: 3, class: _, preferred-register: '' }
130 - { id: 4, class: _, preferred-register: '' }
131 - { id: 5, class: _, preferred-register: '' }
132 - { id: 6, class: _, preferred-register: '' }
133 - { id: 7, class: _, preferred-register: '' }
134 - { id: 8, class: _, preferred-register: '' }
144 ; ALL-LABEL: name: test_i1
146 ; ALL: successors: %bb.2(0x40000000), %bb.1(0x40000000)
147 ; ALL: liveins: $edi, $edx, $esi
148 ; ALL: [[COPY:%[0-9]+]]:_(s32) = COPY $edi
149 ; ALL: [[COPY1:%[0-9]+]]:_(s32) = COPY $esi
150 ; ALL: [[COPY2:%[0-9]+]]:_(s32) = COPY $edx
151 ; ALL: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 0
152 ; ALL: [[ICMP:%[0-9]+]]:_(s1) = G_ICMP intpred(sgt), [[COPY]](s32), [[C]]
153 ; ALL: [[TRUNC:%[0-9]+]]:_(s8) = G_TRUNC [[COPY1]](s32)
154 ; ALL: G_BRCOND [[ICMP]](s1), %bb.2
155 ; ALL: bb.1.cond.false:
156 ; ALL: successors: %bb.2(0x80000000)
157 ; ALL: [[TRUNC1:%[0-9]+]]:_(s8) = G_TRUNC [[COPY2]](s32)
158 ; ALL: bb.2.cond.end:
159 ; ALL: [[PHI:%[0-9]+]]:_(s8) = G_PHI [[TRUNC1]](s8), %bb.1, [[TRUNC]](s8), %bb.0
160 ; ALL: [[COPY3:%[0-9]+]]:_(s8) = COPY [[PHI]](s8)
161 ; ALL: $al = COPY [[COPY3]](s8)
162 ; ALL: RET 0, implicit $al
164 successors: %bb.3(0x40000000), %bb.2(0x40000000)
165 liveins: $edi, $edx, $esi
167 %0:_(s32) = COPY $edi
168 %3:_(s32) = COPY $esi
169 %1:_(s1) = G_TRUNC %3(s32)
170 %4:_(s32) = COPY $edx
171 %2:_(s1) = G_TRUNC %4(s32)
172 %5:_(s32) = G_CONSTANT i32 0
173 %6:_(s1) = G_ICMP intpred(sgt), %0(s32), %5
174 G_BRCOND %6(s1), %bb.3
177 successors: %bb.3(0x80000000)
181 %7:_(s1) = G_PHI %2(s1), %bb.2, %1(s1), %bb.1
182 %8:_(s8) = G_ANYEXT %7(s1)
191 regBankSelected: false
192 tracksRegLiveness: true
194 - { id: 0, class: _, preferred-register: '' }
195 - { id: 1, class: _, preferred-register: '' }
196 - { id: 2, class: _, preferred-register: '' }
197 - { id: 3, class: _, preferred-register: '' }
198 - { id: 4, class: _, preferred-register: '' }
199 - { id: 5, class: _, preferred-register: '' }
200 - { id: 6, class: _, preferred-register: '' }
201 - { id: 7, class: _, preferred-register: '' }
210 ; ALL-LABEL: name: test_i8
212 ; ALL: successors: %bb.2(0x40000000), %bb.1(0x40000000)
213 ; ALL: liveins: $edi, $edx, $esi
214 ; ALL: [[COPY:%[0-9]+]]:_(s32) = COPY $edi
215 ; ALL: [[COPY1:%[0-9]+]]:_(s32) = COPY $esi
216 ; ALL: [[TRUNC:%[0-9]+]]:_(s8) = G_TRUNC [[COPY1]](s32)
217 ; ALL: [[COPY2:%[0-9]+]]:_(s32) = COPY $edx
218 ; ALL: [[TRUNC1:%[0-9]+]]:_(s8) = G_TRUNC [[COPY2]](s32)
219 ; ALL: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 0
220 ; ALL: [[ICMP:%[0-9]+]]:_(s1) = G_ICMP intpred(sgt), [[COPY]](s32), [[C]]
221 ; ALL: G_BRCOND [[ICMP]](s1), %bb.2
222 ; ALL: bb.1.cond.false:
223 ; ALL: successors: %bb.2(0x80000000)
224 ; ALL: bb.2.cond.end:
225 ; ALL: [[PHI:%[0-9]+]]:_(s8) = G_PHI [[TRUNC1]](s8), %bb.1, [[TRUNC]](s8), %bb.0
226 ; ALL: $al = COPY [[PHI]](s8)
227 ; ALL: RET 0, implicit $al
229 successors: %bb.3(0x40000000), %bb.2(0x40000000)
230 liveins: $edi, $edx, $esi
232 %0:_(s32) = COPY $edi
233 %3:_(s32) = COPY $esi
234 %1:_(s8) = G_TRUNC %3(s32)
235 %4:_(s32) = COPY $edx
236 %2:_(s8) = G_TRUNC %4(s32)
237 %5:_(s32) = G_CONSTANT i32 0
238 %6:_(s1) = G_ICMP intpred(sgt), %0(s32), %5
239 G_BRCOND %6(s1), %bb.3
242 successors: %bb.3(0x80000000)
246 %7:_(s8) = G_PHI %2(s8), %bb.2, %1(s8), %bb.1
255 regBankSelected: false
256 tracksRegLiveness: true
258 - { id: 0, class: _, preferred-register: '' }
259 - { id: 1, class: _, preferred-register: '' }
260 - { id: 2, class: _, preferred-register: '' }
261 - { id: 3, class: _, preferred-register: '' }
262 - { id: 4, class: _, preferred-register: '' }
263 - { id: 5, class: _, preferred-register: '' }
264 - { id: 6, class: _, preferred-register: '' }
265 - { id: 7, class: _, preferred-register: '' }
274 ; ALL-LABEL: name: test_i16
276 ; ALL: successors: %bb.2(0x40000000), %bb.1(0x40000000)
277 ; ALL: liveins: $edi, $edx, $esi
278 ; ALL: [[COPY:%[0-9]+]]:_(s32) = COPY $edi
279 ; ALL: [[COPY1:%[0-9]+]]:_(s32) = COPY $esi
280 ; ALL: [[TRUNC:%[0-9]+]]:_(s16) = G_TRUNC [[COPY1]](s32)
281 ; ALL: [[COPY2:%[0-9]+]]:_(s32) = COPY $edx
282 ; ALL: [[TRUNC1:%[0-9]+]]:_(s16) = G_TRUNC [[COPY2]](s32)
283 ; ALL: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 0
284 ; ALL: [[ICMP:%[0-9]+]]:_(s1) = G_ICMP intpred(sgt), [[COPY]](s32), [[C]]
285 ; ALL: G_BRCOND [[ICMP]](s1), %bb.2
286 ; ALL: bb.1.cond.false:
287 ; ALL: successors: %bb.2(0x80000000)
288 ; ALL: bb.2.cond.end:
289 ; ALL: [[PHI:%[0-9]+]]:_(s16) = G_PHI [[TRUNC1]](s16), %bb.1, [[TRUNC]](s16), %bb.0
290 ; ALL: $ax = COPY [[PHI]](s16)
291 ; ALL: RET 0, implicit $ax
293 successors: %bb.3(0x40000000), %bb.2(0x40000000)
294 liveins: $edi, $edx, $esi
296 %0:_(s32) = COPY $edi
297 %3:_(s32) = COPY $esi
298 %1:_(s16) = G_TRUNC %3(s32)
299 %4:_(s32) = COPY $edx
300 %2:_(s16) = G_TRUNC %4(s32)
301 %5:_(s32) = G_CONSTANT i32 0
302 %6:_(s1) = G_ICMP intpred(sgt), %0(s32), %5
303 G_BRCOND %6(s1), %bb.3
306 successors: %bb.3(0x80000000)
310 %7:_(s16) = G_PHI %2(s16), %bb.2, %1(s16), %bb.1
319 regBankSelected: false
320 tracksRegLiveness: true
322 - { id: 0, class: _, preferred-register: '' }
323 - { id: 1, class: _, preferred-register: '' }
324 - { id: 2, class: _, preferred-register: '' }
325 - { id: 3, class: _, preferred-register: '' }
326 - { id: 4, class: _, preferred-register: '' }
327 - { id: 5, class: _, preferred-register: '' }
336 ; ALL-LABEL: name: test_i32
338 ; ALL: successors: %bb.1(0x40000000), %bb.2(0x40000000)
339 ; ALL: liveins: $edi, $edx, $esi
340 ; ALL: [[COPY:%[0-9]+]]:_(s32) = COPY $edi
341 ; ALL: [[COPY1:%[0-9]+]]:_(s32) = COPY $esi
342 ; ALL: [[COPY2:%[0-9]+]]:_(s32) = COPY $edx
343 ; ALL: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 0
344 ; ALL: [[ICMP:%[0-9]+]]:_(s1) = G_ICMP intpred(sgt), [[COPY]](s32), [[C]]
345 ; ALL: G_BRCOND [[ICMP]](s1), %bb.1
347 ; ALL: bb.1.cond.true:
348 ; ALL: successors: %bb.3(0x80000000)
350 ; ALL: bb.2.cond.false:
351 ; ALL: successors: %bb.3(0x80000000)
352 ; ALL: bb.3.cond.end:
353 ; ALL: [[PHI:%[0-9]+]]:_(s32) = G_PHI [[COPY1]](s32), %bb.1, [[COPY2]](s32), %bb.2
354 ; ALL: $eax = COPY [[PHI]](s32)
355 ; ALL: RET 0, implicit $eax
357 successors: %bb.2(0x40000000), %bb.3(0x40000000)
358 liveins: $edi, $edx, $esi
363 %3(s32) = G_CONSTANT i32 0
364 %4(s1) = G_ICMP intpred(sgt), %0(s32), %3
365 G_BRCOND %4(s1), %bb.2
369 successors: %bb.4(0x80000000)
374 successors: %bb.4(0x80000000)
378 %5(s32) = G_PHI %1(s32), %bb.2, %2(s32), %bb.3
387 regBankSelected: false
388 tracksRegLiveness: true
390 - { id: 0, class: _, preferred-register: '' }
391 - { id: 1, class: _, preferred-register: '' }
392 - { id: 2, class: _, preferred-register: '' }
393 - { id: 3, class: _, preferred-register: '' }
394 - { id: 4, class: _, preferred-register: '' }
395 - { id: 5, class: _, preferred-register: '' }
404 ; ALL-LABEL: name: test_i64
406 ; ALL: successors: %bb.1(0x40000000), %bb.2(0x40000000)
407 ; ALL: liveins: $edi, $rdx, $rsi
408 ; ALL: [[COPY:%[0-9]+]]:_(s32) = COPY $edi
409 ; ALL: [[COPY1:%[0-9]+]]:_(s64) = COPY $rsi
410 ; ALL: [[COPY2:%[0-9]+]]:_(s64) = COPY $rdx
411 ; ALL: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 0
412 ; ALL: [[ICMP:%[0-9]+]]:_(s1) = G_ICMP intpred(sgt), [[COPY]](s32), [[C]]
413 ; ALL: G_BRCOND [[ICMP]](s1), %bb.1
415 ; ALL: bb.1.cond.true:
416 ; ALL: successors: %bb.3(0x80000000)
418 ; ALL: bb.2.cond.false:
419 ; ALL: successors: %bb.3(0x80000000)
420 ; ALL: bb.3.cond.end:
421 ; ALL: [[PHI:%[0-9]+]]:_(s64) = G_PHI [[COPY1]](s64), %bb.1, [[COPY2]](s64), %bb.2
422 ; ALL: $rax = COPY [[PHI]](s64)
423 ; ALL: RET 0, implicit $rax
425 successors: %bb.2(0x40000000), %bb.3(0x40000000)
426 liveins: $edi, $rdx, $rsi
431 %3(s32) = G_CONSTANT i32 0
432 %4(s1) = G_ICMP intpred(sgt), %0(s32), %3
433 G_BRCOND %4(s1), %bb.2
437 successors: %bb.4(0x80000000)
442 successors: %bb.4(0x80000000)
446 %5(s64) = G_PHI %1(s64), %bb.2, %2(s64), %bb.3
455 regBankSelected: false
456 tracksRegLiveness: true
458 - { id: 0, class: _, preferred-register: '' }
459 - { id: 1, class: _, preferred-register: '' }
460 - { id: 2, class: _, preferred-register: '' }
461 - { id: 3, class: _, preferred-register: '' }
462 - { id: 4, class: _, preferred-register: '' }
463 - { id: 5, class: _, preferred-register: '' }
464 - { id: 6, class: _, preferred-register: '' }
465 - { id: 7, class: _, preferred-register: '' }
466 - { id: 8, class: _, preferred-register: '' }
475 ; ALL-LABEL: name: test_float
477 ; ALL: successors: %bb.2(0x40000000), %bb.1(0x40000000)
478 ; ALL: liveins: $edi, $xmm0, $xmm1
479 ; ALL: [[COPY:%[0-9]+]]:_(s32) = COPY $edi
480 ; ALL: [[COPY1:%[0-9]+]]:_(s128) = COPY $xmm0
481 ; ALL: [[TRUNC:%[0-9]+]]:_(s32) = G_TRUNC [[COPY1]](s128)
482 ; ALL: [[COPY2:%[0-9]+]]:_(s128) = COPY $xmm1
483 ; ALL: [[TRUNC1:%[0-9]+]]:_(s32) = G_TRUNC [[COPY2]](s128)
484 ; ALL: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 0
485 ; ALL: [[ICMP:%[0-9]+]]:_(s1) = G_ICMP intpred(sgt), [[COPY]](s32), [[C]]
486 ; ALL: G_BRCOND [[ICMP]](s1), %bb.2
487 ; ALL: bb.1.cond.false:
488 ; ALL: successors: %bb.2(0x80000000)
489 ; ALL: bb.2.cond.end:
490 ; ALL: [[PHI:%[0-9]+]]:_(s32) = G_PHI [[TRUNC1]](s32), %bb.1, [[TRUNC]](s32), %bb.0
491 ; ALL: [[ANYEXT:%[0-9]+]]:_(s128) = G_ANYEXT [[PHI]](s32)
492 ; ALL: $xmm0 = COPY [[ANYEXT]](s128)
493 ; ALL: RET 0, implicit $xmm0
495 successors: %bb.3(0x40000000), %bb.2(0x40000000)
496 liveins: $edi, $xmm0, $xmm1
498 %0:_(s32) = COPY $edi
499 %3:_(s128) = COPY $xmm0
500 %1:_(s32) = G_TRUNC %3(s128)
501 %4:_(s128) = COPY $xmm1
502 %2:_(s32) = G_TRUNC %4(s128)
503 %5:_(s32) = G_CONSTANT i32 0
504 %6:_(s1) = G_ICMP intpred(sgt), %0(s32), %5
505 G_BRCOND %6(s1), %bb.3
508 successors: %bb.3(0x80000000)
512 %7:_(s32) = G_PHI %2(s32), %bb.2, %1(s32), %bb.1
513 %8:_(s128) = G_ANYEXT %7(s32)
514 $xmm0 = COPY %8(s128)
515 RET 0, implicit $xmm0
522 regBankSelected: false
523 tracksRegLiveness: true
525 - { id: 0, class: _, preferred-register: '' }
526 - { id: 1, class: _, preferred-register: '' }
527 - { id: 2, class: _, preferred-register: '' }
528 - { id: 3, class: _, preferred-register: '' }
529 - { id: 4, class: _, preferred-register: '' }
530 - { id: 5, class: _, preferred-register: '' }
531 - { id: 6, class: _, preferred-register: '' }
532 - { id: 7, class: _, preferred-register: '' }
533 - { id: 8, class: _, preferred-register: '' }
542 ; ALL-LABEL: name: test_double
544 ; ALL: successors: %bb.2(0x40000000), %bb.1(0x40000000)
545 ; ALL: liveins: $edi, $xmm0, $xmm1
546 ; ALL: [[COPY:%[0-9]+]]:_(s32) = COPY $edi
547 ; ALL: [[COPY1:%[0-9]+]]:_(s128) = COPY $xmm0
548 ; ALL: [[TRUNC:%[0-9]+]]:_(s64) = G_TRUNC [[COPY1]](s128)
549 ; ALL: [[COPY2:%[0-9]+]]:_(s128) = COPY $xmm1
550 ; ALL: [[TRUNC1:%[0-9]+]]:_(s64) = G_TRUNC [[COPY2]](s128)
551 ; ALL: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 0
552 ; ALL: [[ICMP:%[0-9]+]]:_(s1) = G_ICMP intpred(sgt), [[COPY]](s32), [[C]]
553 ; ALL: G_BRCOND [[ICMP]](s1), %bb.2
554 ; ALL: bb.1.cond.false:
555 ; ALL: successors: %bb.2(0x80000000)
556 ; ALL: bb.2.cond.end:
557 ; ALL: [[PHI:%[0-9]+]]:_(s64) = G_PHI [[TRUNC1]](s64), %bb.1, [[TRUNC]](s64), %bb.0
558 ; ALL: [[ANYEXT:%[0-9]+]]:_(s128) = G_ANYEXT [[PHI]](s64)
559 ; ALL: $xmm0 = COPY [[ANYEXT]](s128)
560 ; ALL: RET 0, implicit $xmm0
562 successors: %bb.3(0x40000000), %bb.2(0x40000000)
563 liveins: $edi, $xmm0, $xmm1
565 %0:_(s32) = COPY $edi
566 %3:_(s128) = COPY $xmm0
567 %1:_(s64) = G_TRUNC %3(s128)
568 %4:_(s128) = COPY $xmm1
569 %2:_(s64) = G_TRUNC %4(s128)
570 %5:_(s32) = G_CONSTANT i32 0
571 %6:_(s1) = G_ICMP intpred(sgt), %0(s32), %5
572 G_BRCOND %6(s1), %bb.3
575 successors: %bb.3(0x80000000)
579 %7:_(s64) = G_PHI %2(s64), %bb.2, %1(s64), %bb.1
580 %8:_(s128) = G_ANYEXT %7(s64)
581 $xmm0 = COPY %8(s128)
582 RET 0, implicit $xmm0