1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -mtriple=i386-linux-gnu -run-pass=legalizer %s -o - | FileCheck %s --check-prefix=ALL --check-prefix=X32
3 # RUN: llc -mtriple=x86_64-linux-gnu -run-pass=legalizer %s -o - | FileCheck %s --check-prefix=ALL --check-prefix=X64
6 define i8 @test_zext_i1toi8(i1 %a) {
11 define i16 @test_zext_i1toi16(i1 %a) {
12 %r = zext i1 %a to i16
16 define i32 @test_zext_i1(i8 %a) {
17 %val = trunc i8 %a to i1
18 %r = zext i1 %val to i32
22 define i16 @test_zext_i8toi16(i8 %val) {
23 %r = zext i8 %val to i16
27 define i32 @test_zext_i8(i8 %val) {
28 %r = zext i8 %val to i32
32 define i32 @test_zext_i16(i16 %val) {
33 %r = zext i16 %val to i32
37 define i8 @test_sext_i1toi8(i1 %a) {
42 define i16 @test_sext_i1toi16(i1 %a) {
43 %r = sext i1 %a to i16
47 define i32 @test_sext_i1(i8 %a) {
48 %val = trunc i8 %a to i1
49 %r = sext i1 %val to i32
53 define i16 @test_sext_i8toi16(i8 %val) {
54 %r = sext i8 %val to i16
58 define i32 @test_sext_i8(i8 %val) {
59 %r = sext i8 %val to i32
63 define i32 @test_sext_i16(i16 %val) {
64 %r = sext i16 %val to i32
68 define void @test_anyext_i1toi8(i1 %a) {
72 define void @test_anyext_i1toi16(i1 %a) {
76 define void @test_anyext_i1(i8 %a) {
80 define void @test_anyext_i8toi16(i8 %val) {
84 define void @test_anyext_i8(i8 %val) {
88 define void @test_anyext_i16(i16 %val) {
94 name: test_zext_i1toi8
97 regBankSelected: false
99 - { id: 0, class: _, preferred-register: '' }
100 - { id: 1, class: _, preferred-register: '' }
101 - { id: 2, class: _, preferred-register: '' }
106 ; X32-LABEL: name: test_zext_i1toi8
107 ; X32: [[COPY:%[0-9]+]]:_(s32) = COPY $edi
108 ; X32: [[C:%[0-9]+]]:_(s8) = G_CONSTANT i8 1
109 ; X32: [[TRUNC:%[0-9]+]]:_(s8) = G_TRUNC [[COPY]](s32)
110 ; X32: [[AND:%[0-9]+]]:_(s8) = G_AND [[TRUNC]], [[C]]
111 ; X32: $al = COPY [[AND]](s8)
112 ; X32: RET 0, implicit $al
113 ; X64-LABEL: name: test_zext_i1toi8
114 ; X64: [[COPY:%[0-9]+]]:_(s32) = COPY $edi
115 ; X64: [[C:%[0-9]+]]:_(s8) = G_CONSTANT i8 1
116 ; X64: [[TRUNC:%[0-9]+]]:_(s8) = G_TRUNC [[COPY]](s32)
117 ; X64: [[AND:%[0-9]+]]:_(s8) = G_AND [[TRUNC]], [[C]]
118 ; X64: $al = COPY [[AND]](s8)
119 ; X64: RET 0, implicit $al
120 %1:_(s32) = COPY $edi
121 %0:_(s1) = G_TRUNC %1(s32)
122 %2:_(s8) = G_ZEXT %0(s1)
128 name: test_zext_i1toi16
131 regBankSelected: false
133 - { id: 0, class: _, preferred-register: '' }
134 - { id: 1, class: _, preferred-register: '' }
139 ; X32-LABEL: name: test_zext_i1toi16
140 ; X32: [[COPY:%[0-9]+]]:_(s32) = COPY $edi
141 ; X32: [[C:%[0-9]+]]:_(s16) = G_CONSTANT i16 1
142 ; X32: [[TRUNC:%[0-9]+]]:_(s16) = G_TRUNC [[COPY]](s32)
143 ; X32: [[AND:%[0-9]+]]:_(s16) = G_AND [[TRUNC]], [[C]]
144 ; X32: $ax = COPY [[AND]](s16)
145 ; X32: RET 0, implicit $ax
146 ; X64-LABEL: name: test_zext_i1toi16
147 ; X64: [[COPY:%[0-9]+]]:_(s32) = COPY $edi
148 ; X64: [[C:%[0-9]+]]:_(s16) = G_CONSTANT i16 1
149 ; X64: [[TRUNC:%[0-9]+]]:_(s16) = G_TRUNC [[COPY]](s32)
150 ; X64: [[AND:%[0-9]+]]:_(s16) = G_AND [[TRUNC]], [[C]]
151 ; X64: $ax = COPY [[AND]](s16)
152 ; X64: RET 0, implicit $ax
153 %1:_(s32) = COPY $edi
154 %0:_(s1) = G_TRUNC %1(s32)
155 %2:_(s16) = G_ZEXT %0(s1)
164 regBankSelected: false
166 - { id: 0, class: _ }
167 - { id: 1, class: _ }
168 - { id: 2, class: _ }
173 ; X32-LABEL: name: test_zext_i1
174 ; X32: [[COPY:%[0-9]+]]:_(s8) = COPY $dil
175 ; X32: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 1
176 ; X32: [[ANYEXT:%[0-9]+]]:_(s32) = G_ANYEXT [[COPY]](s8)
177 ; X32: [[AND:%[0-9]+]]:_(s32) = G_AND [[ANYEXT]], [[C]]
178 ; X32: $eax = COPY [[AND]](s32)
179 ; X32: RET 0, implicit $eax
180 ; X64-LABEL: name: test_zext_i1
181 ; X64: [[COPY:%[0-9]+]]:_(s8) = COPY $dil
182 ; X64: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 1
183 ; X64: [[ANYEXT:%[0-9]+]]:_(s32) = G_ANYEXT [[COPY]](s8)
184 ; X64: [[AND:%[0-9]+]]:_(s32) = G_AND [[ANYEXT]], [[C]]
185 ; X64: $eax = COPY [[AND]](s32)
186 ; X64: RET 0, implicit $eax
188 %1(s1) = G_TRUNC %0(s8)
189 %2(s32) = G_ZEXT %1(s1)
195 name: test_zext_i8toi16
198 regBankSelected: false
200 - { id: 0, class: _, preferred-register: '' }
201 - { id: 1, class: _, preferred-register: '' }
206 ; X32-LABEL: name: test_zext_i8toi16
207 ; X32: [[COPY:%[0-9]+]]:_(s8) = COPY $dil
208 ; X32: [[ZEXT:%[0-9]+]]:_(s16) = G_ZEXT [[COPY]](s8)
209 ; X32: $ax = COPY [[ZEXT]](s16)
210 ; X32: RET 0, implicit $ax
211 ; X64-LABEL: name: test_zext_i8toi16
212 ; X64: [[COPY:%[0-9]+]]:_(s8) = COPY $dil
213 ; X64: [[ZEXT:%[0-9]+]]:_(s16) = G_ZEXT [[COPY]](s8)
214 ; X64: $ax = COPY [[ZEXT]](s16)
215 ; X64: RET 0, implicit $ax
217 %1(s16) = G_ZEXT %0(s8)
226 regBankSelected: false
228 - { id: 0, class: _ }
229 - { id: 1, class: _ }
234 ; X32-LABEL: name: test_zext_i8
235 ; X32: [[COPY:%[0-9]+]]:_(s8) = COPY $dil
236 ; X32: [[ZEXT:%[0-9]+]]:_(s32) = G_ZEXT [[COPY]](s8)
237 ; X32: $eax = COPY [[ZEXT]](s32)
238 ; X32: RET 0, implicit $eax
239 ; X64-LABEL: name: test_zext_i8
240 ; X64: [[COPY:%[0-9]+]]:_(s8) = COPY $dil
241 ; X64: [[ZEXT:%[0-9]+]]:_(s32) = G_ZEXT [[COPY]](s8)
242 ; X64: $eax = COPY [[ZEXT]](s32)
243 ; X64: RET 0, implicit $eax
245 %1(s32) = G_ZEXT %0(s8)
254 regBankSelected: false
256 - { id: 0, class: _ }
257 - { id: 1, class: _ }
262 ; X32-LABEL: name: test_zext_i16
263 ; X32: [[COPY:%[0-9]+]]:_(s16) = COPY $di
264 ; X32: [[ZEXT:%[0-9]+]]:_(s32) = G_ZEXT [[COPY]](s16)
265 ; X32: $eax = COPY [[ZEXT]](s32)
266 ; X32: RET 0, implicit $eax
267 ; X64-LABEL: name: test_zext_i16
268 ; X64: [[COPY:%[0-9]+]]:_(s16) = COPY $di
269 ; X64: [[ZEXT:%[0-9]+]]:_(s32) = G_ZEXT [[COPY]](s16)
270 ; X64: $eax = COPY [[ZEXT]](s32)
271 ; X64: RET 0, implicit $eax
273 %1(s32) = G_ZEXT %0(s16)
279 name: test_sext_i1toi8
282 regBankSelected: false
284 - { id: 0, class: _, preferred-register: '' }
285 - { id: 1, class: _, preferred-register: '' }
290 ; X32-LABEL: name: test_sext_i1toi8
291 ; X32: [[C:%[0-9]+]]:_(s8) = G_CONSTANT i8 0
292 ; X32: $al = COPY [[C]](s8)
293 ; X32: RET 0, implicit $al
294 ; X64-LABEL: name: test_sext_i1toi8
295 ; X64: [[C:%[0-9]+]]:_(s8) = G_CONSTANT i8 0
296 ; X64: $al = COPY [[C]](s8)
297 ; X64: RET 0, implicit $al
298 %0(s1) = G_IMPLICIT_DEF
299 %1(s8) = G_SEXT %0(s1)
305 name: test_sext_i1toi16
308 regBankSelected: false
310 - { id: 0, class: _, preferred-register: '' }
311 - { id: 1, class: _, preferred-register: '' }
316 ; X32-LABEL: name: test_sext_i1toi16
317 ; X32: [[C:%[0-9]+]]:_(s16) = G_CONSTANT i16 0
318 ; X32: $ax = COPY [[C]](s16)
319 ; X32: RET 0, implicit $ax
320 ; X64-LABEL: name: test_sext_i1toi16
321 ; X64: [[C:%[0-9]+]]:_(s16) = G_CONSTANT i16 0
322 ; X64: $ax = COPY [[C]](s16)
323 ; X64: RET 0, implicit $ax
324 %0(s1) = G_IMPLICIT_DEF
325 %1(s16) = G_SEXT %0(s1)
334 regBankSelected: false
336 - { id: 0, class: _ }
337 - { id: 1, class: _ }
338 - { id: 2, class: _ }
343 ; X32-LABEL: name: test_sext_i1
344 ; X32: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 0
345 ; X32: $eax = COPY [[C]](s32)
346 ; X32: RET 0, implicit $eax
347 ; X64-LABEL: name: test_sext_i1
348 ; X64: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 0
349 ; X64: $eax = COPY [[C]](s32)
350 ; X64: RET 0, implicit $eax
351 %0(s1) = G_IMPLICIT_DEF
352 %2(s32) = G_SEXT %0(s1)
358 name: test_sext_i8toi16
361 regBankSelected: false
363 - { id: 0, class: _, preferred-register: '' }
364 - { id: 1, class: _, preferred-register: '' }
369 ; X32-LABEL: name: test_sext_i8toi16
370 ; X32: [[COPY:%[0-9]+]]:_(s8) = COPY $dil
371 ; X32: [[SEXT:%[0-9]+]]:_(s16) = G_SEXT [[COPY]](s8)
372 ; X32: $ax = COPY [[SEXT]](s16)
373 ; X32: RET 0, implicit $ax
374 ; X64-LABEL: name: test_sext_i8toi16
375 ; X64: [[COPY:%[0-9]+]]:_(s8) = COPY $dil
376 ; X64: [[SEXT:%[0-9]+]]:_(s16) = G_SEXT [[COPY]](s8)
377 ; X64: $ax = COPY [[SEXT]](s16)
378 ; X64: RET 0, implicit $ax
380 %1(s16) = G_SEXT %0(s8)
389 regBankSelected: false
391 - { id: 0, class: _ }
392 - { id: 1, class: _ }
397 ; X32-LABEL: name: test_sext_i8
398 ; X32: [[COPY:%[0-9]+]]:_(s8) = COPY $dil
399 ; X32: [[SEXT:%[0-9]+]]:_(s32) = G_SEXT [[COPY]](s8)
400 ; X32: $eax = COPY [[SEXT]](s32)
401 ; X32: RET 0, implicit $eax
402 ; X64-LABEL: name: test_sext_i8
403 ; X64: [[COPY:%[0-9]+]]:_(s8) = COPY $dil
404 ; X64: [[SEXT:%[0-9]+]]:_(s32) = G_SEXT [[COPY]](s8)
405 ; X64: $eax = COPY [[SEXT]](s32)
406 ; X64: RET 0, implicit $eax
408 %1(s32) = G_SEXT %0(s8)
417 regBankSelected: false
419 - { id: 0, class: _ }
420 - { id: 1, class: _ }
425 ; X32-LABEL: name: test_sext_i16
426 ; X32: [[COPY:%[0-9]+]]:_(s16) = COPY $di
427 ; X32: [[SEXT:%[0-9]+]]:_(s32) = G_SEXT [[COPY]](s16)
428 ; X32: $eax = COPY [[SEXT]](s32)
429 ; X32: RET 0, implicit $eax
430 ; X64-LABEL: name: test_sext_i16
431 ; X64: [[COPY:%[0-9]+]]:_(s16) = COPY $di
432 ; X64: [[SEXT:%[0-9]+]]:_(s32) = G_SEXT [[COPY]](s16)
433 ; X64: $eax = COPY [[SEXT]](s32)
434 ; X64: RET 0, implicit $eax
436 %1(s32) = G_SEXT %0(s16)
442 name: test_anyext_i1toi8
445 regBankSelected: false
447 - { id: 0, class: _, preferred-register: '' }
448 - { id: 1, class: _, preferred-register: '' }
449 - { id: 2, class: _, preferred-register: '' }
454 ; X32-LABEL: name: test_anyext_i1toi8
455 ; X32: [[COPY:%[0-9]+]]:_(s32) = COPY $edi
456 ; X32: [[TRUNC:%[0-9]+]]:_(s8) = G_TRUNC [[COPY]](s32)
457 ; X32: $al = COPY [[TRUNC]](s8)
458 ; X32: RET 0, implicit $al
459 ; X64-LABEL: name: test_anyext_i1toi8
460 ; X64: [[COPY:%[0-9]+]]:_(s32) = COPY $edi
461 ; X64: [[TRUNC:%[0-9]+]]:_(s8) = G_TRUNC [[COPY]](s32)
462 ; X64: $al = COPY [[TRUNC]](s8)
463 ; X64: RET 0, implicit $al
465 %1(s1) = G_TRUNC %0(s32)
466 %2(s8) = G_ANYEXT %1(s1)
472 name: test_anyext_i1toi16
475 regBankSelected: false
477 - { id: 0, class: _, preferred-register: '' }
478 - { id: 1, class: _, preferred-register: '' }
479 - { id: 2, class: _, preferred-register: '' }
484 ; X32-LABEL: name: test_anyext_i1toi16
485 ; X32: [[COPY:%[0-9]+]]:_(s32) = COPY $edi
486 ; X32: [[TRUNC:%[0-9]+]]:_(s16) = G_TRUNC [[COPY]](s32)
487 ; X32: $ax = COPY [[TRUNC]](s16)
488 ; X32: RET 0, implicit $ax
489 ; X64-LABEL: name: test_anyext_i1toi16
490 ; X64: [[COPY:%[0-9]+]]:_(s32) = COPY $edi
491 ; X64: [[TRUNC:%[0-9]+]]:_(s16) = G_TRUNC [[COPY]](s32)
492 ; X64: $ax = COPY [[TRUNC]](s16)
493 ; X64: RET 0, implicit $ax
495 %1(s1) = G_TRUNC %0(s32)
496 %2(s16) = G_ANYEXT %1(s1)
505 regBankSelected: false
507 - { id: 0, class: _ }
508 - { id: 1, class: _ }
509 - { id: 2, class: _ }
514 ; X32-LABEL: name: test_anyext_i1
515 ; X32: [[COPY:%[0-9]+]]:_(s8) = COPY $dil
516 ; X32: [[ANYEXT:%[0-9]+]]:_(s32) = G_ANYEXT [[COPY]](s8)
517 ; X32: $eax = COPY [[ANYEXT]](s32)
518 ; X32: RET 0, implicit $eax
519 ; X64-LABEL: name: test_anyext_i1
520 ; X64: [[COPY:%[0-9]+]]:_(s8) = COPY $dil
521 ; X64: [[ANYEXT:%[0-9]+]]:_(s32) = G_ANYEXT [[COPY]](s8)
522 ; X64: $eax = COPY [[ANYEXT]](s32)
523 ; X64: RET 0, implicit $eax
525 %1(s1) = G_TRUNC %0(s8)
526 %2(s32) = G_ANYEXT %1(s1)
532 name: test_anyext_i8toi16
535 regBankSelected: false
537 - { id: 0, class: _, preferred-register: '' }
538 - { id: 1, class: _, preferred-register: '' }
543 ; X32-LABEL: name: test_anyext_i8toi16
544 ; X32: [[COPY:%[0-9]+]]:_(s8) = COPY $dil
545 ; X32: [[ANYEXT:%[0-9]+]]:_(s16) = G_ANYEXT [[COPY]](s8)
546 ; X32: $ax = COPY [[ANYEXT]](s16)
547 ; X32: RET 0, implicit $ax
548 ; X64-LABEL: name: test_anyext_i8toi16
549 ; X64: [[COPY:%[0-9]+]]:_(s8) = COPY $dil
550 ; X64: [[ANYEXT:%[0-9]+]]:_(s16) = G_ANYEXT [[COPY]](s8)
551 ; X64: $ax = COPY [[ANYEXT]](s16)
552 ; X64: RET 0, implicit $ax
554 %1(s16) = G_ANYEXT %0(s8)
563 regBankSelected: false
565 - { id: 0, class: _ }
566 - { id: 1, class: _ }
571 ; X32-LABEL: name: test_anyext_i8
572 ; X32: [[COPY:%[0-9]+]]:_(s8) = COPY $dil
573 ; X32: [[ANYEXT:%[0-9]+]]:_(s32) = G_ANYEXT [[COPY]](s8)
574 ; X32: $eax = COPY [[ANYEXT]](s32)
575 ; X32: RET 0, implicit $eax
576 ; X64-LABEL: name: test_anyext_i8
577 ; X64: [[COPY:%[0-9]+]]:_(s8) = COPY $dil
578 ; X64: [[ANYEXT:%[0-9]+]]:_(s32) = G_ANYEXT [[COPY]](s8)
579 ; X64: $eax = COPY [[ANYEXT]](s32)
580 ; X64: RET 0, implicit $eax
582 %1(s32) = G_ANYEXT %0(s8)
588 name: test_anyext_i16
591 regBankSelected: false
593 - { id: 0, class: _ }
594 - { id: 1, class: _ }
599 ; X32-LABEL: name: test_anyext_i16
600 ; X32: [[COPY:%[0-9]+]]:_(s16) = COPY $di
601 ; X32: [[ANYEXT:%[0-9]+]]:_(s32) = G_ANYEXT [[COPY]](s16)
602 ; X32: $eax = COPY [[ANYEXT]](s32)
603 ; X32: RET 0, implicit $eax
604 ; X64-LABEL: name: test_anyext_i16
605 ; X64: [[COPY:%[0-9]+]]:_(s16) = COPY $di
606 ; X64: [[ANYEXT:%[0-9]+]]:_(s32) = G_ANYEXT [[COPY]](s16)
607 ; X64: $eax = COPY [[ANYEXT]](s32)
608 ; X64: RET 0, implicit $eax
610 %1(s32) = G_ANYEXT %0(s16)