1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -fast-isel -fast-isel-abort=1 -mtriple=aarch64-apple-darwin -verify-machineinstrs < %s | FileCheck %s
4 define zeroext i16 @asr_zext_i1_i16(i1 %b) {
5 ; CHECK-LABEL: asr_zext_i1_i16:
7 ; CHECK-NEXT: uxth w0, wzr
14 define signext i16 @asr_sext_i1_i16(i1 %b) {
15 ; CHECK-LABEL: asr_sext_i1_i16:
17 ; CHECK-NEXT: sbfx w8, w0, #0, #1
18 ; CHECK-NEXT: sxth w0, w8
20 %1 = sext i1 %b to i16
25 define i32 @asr_zext_i1_i32(i1 %b) {
26 ; CHECK-LABEL: asr_zext_i1_i32:
28 ; CHECK-NEXT: mov w0, wzr
30 %1 = zext i1 %b to i32
35 define i32 @asr_sext_i1_i32(i1 %b) {
36 ; CHECK-LABEL: asr_sext_i1_i32:
38 ; CHECK-NEXT: sbfx w0, w0, #0, #1
40 %1 = sext i1 %b to i32
45 define i64 @asr_zext_i1_i64(i1 %b) {
46 ; CHECK-LABEL: asr_zext_i1_i64:
48 ; CHECK-NEXT: mov x0, xzr
50 %1 = zext i1 %b to i64
55 define i64 @asr_sext_i1_i64(i1 %b) {
56 ; CHECK-LABEL: asr_sext_i1_i64:
58 ; CHECK-NEXT: ; kill: def $w0 killed $w0 def $x0
59 ; CHECK-NEXT: sbfx x0, x0, #0, #1
61 %1 = sext i1 %b to i64
66 define zeroext i16 @lsr_zext_i1_i16(i1 %b) {
67 ; CHECK-LABEL: lsr_zext_i1_i16:
69 ; CHECK-NEXT: uxth w0, wzr
71 %1 = zext i1 %b to i16
76 define signext i16 @lsr_sext_i1_i16(i1 %b) {
77 ; CHECK-LABEL: lsr_sext_i1_i16:
79 ; CHECK-NEXT: sbfx w8, w0, #0, #1
80 ; CHECK-NEXT: ubfx w8, w8, #1, #15
81 ; CHECK-NEXT: sxth w0, w8
83 %1 = sext i1 %b to i16
88 define i32 @lsr_zext_i1_i32(i1 %b) {
89 ; CHECK-LABEL: lsr_zext_i1_i32:
91 ; CHECK-NEXT: mov w0, wzr
93 %1 = zext i1 %b to i32
98 define i32 @lsr_sext_i1_i32(i1 %b) {
99 ; CHECK-LABEL: lsr_sext_i1_i32:
101 ; CHECK-NEXT: sbfx w8, w0, #0, #1
102 ; CHECK-NEXT: lsr w0, w8, #1
104 %1 = sext i1 %b to i32
109 define i64 @lsr_zext_i1_i64(i1 %b) {
110 ; CHECK-LABEL: lsr_zext_i1_i64:
112 ; CHECK-NEXT: mov x0, xzr
114 %1 = zext i1 %b to i64
119 define zeroext i16 @lsl_zext_i1_i16(i1 %b) {
120 ; CHECK-LABEL: lsl_zext_i1_i16:
122 ; CHECK-NEXT: ubfiz w8, w0, #4, #1
123 ; CHECK-NEXT: uxth w0, w8
125 %1 = zext i1 %b to i16
130 define signext i16 @lsl_sext_i1_i16(i1 %b) {
131 ; CHECK-LABEL: lsl_sext_i1_i16:
133 ; CHECK-NEXT: sbfiz w8, w0, #4, #1
134 ; CHECK-NEXT: sxth w0, w8
136 %1 = sext i1 %b to i16
141 define i32 @lsl_zext_i1_i32(i1 %b) {
142 ; CHECK-LABEL: lsl_zext_i1_i32:
144 ; CHECK-NEXT: ubfiz w0, w0, #4, #1
146 %1 = zext i1 %b to i32
151 define i32 @lsl_sext_i1_i32(i1 %b) {
152 ; CHECK-LABEL: lsl_sext_i1_i32:
154 ; CHECK-NEXT: sbfiz w0, w0, #4, #1
156 %1 = sext i1 %b to i32
161 define i64 @lsl_zext_i1_i64(i1 %b) {
162 ; CHECK-LABEL: lsl_zext_i1_i64:
164 ; CHECK-NEXT: ; kill: def $w0 killed $w0 def $x0
165 ; CHECK-NEXT: ubfiz x0, x0, #4, #1
167 %1 = zext i1 %b to i64
172 define i64 @lsl_sext_i1_i64(i1 %b) {
173 ; CHECK-LABEL: lsl_sext_i1_i64:
175 ; CHECK-NEXT: ; kill: def $w0 killed $w0 def $x0
176 ; CHECK-NEXT: sbfiz x0, x0, #4, #1
178 %1 = sext i1 %b to i64
183 define zeroext i8 @lslv_i8(i8 %a, i8 %b) {
184 ; CHECK-LABEL: lslv_i8:
186 ; CHECK-NEXT: and w8, w1, #0xff
187 ; CHECK-NEXT: lsl w8, w0, w8
188 ; CHECK-NEXT: and w8, w8, #0xff
189 ; CHECK-NEXT: uxtb w0, w8
195 define zeroext i8 @lsl_i8(i8 %a) {
196 ; CHECK-LABEL: lsl_i8:
198 ; CHECK-NEXT: ubfiz w8, w0, #4, #4
199 ; CHECK-NEXT: uxtb w0, w8
205 define zeroext i16 @lsl_zext_i8_i16(i8 %b) {
206 ; CHECK-LABEL: lsl_zext_i8_i16:
208 ; CHECK-NEXT: ubfiz w8, w0, #4, #8
209 ; CHECK-NEXT: uxth w0, w8
211 %1 = zext i8 %b to i16
216 define signext i16 @lsl_sext_i8_i16(i8 %b) {
217 ; CHECK-LABEL: lsl_sext_i8_i16:
219 ; CHECK-NEXT: sbfiz w8, w0, #4, #8
220 ; CHECK-NEXT: sxth w0, w8
222 %1 = sext i8 %b to i16
227 define i32 @lsl_zext_i8_i32(i8 %b) {
228 ; CHECK-LABEL: lsl_zext_i8_i32:
230 ; CHECK-NEXT: ubfiz w0, w0, #4, #8
232 %1 = zext i8 %b to i32
237 define i32 @lsl_sext_i8_i32(i8 %b) {
238 ; CHECK-LABEL: lsl_sext_i8_i32:
240 ; CHECK-NEXT: sbfiz w0, w0, #4, #8
242 %1 = sext i8 %b to i32
247 define i64 @lsl_zext_i8_i64(i8 %b) {
248 ; CHECK-LABEL: lsl_zext_i8_i64:
250 ; CHECK-NEXT: ; kill: def $w0 killed $w0 def $x0
251 ; CHECK-NEXT: ubfiz x0, x0, #4, #8
253 %1 = zext i8 %b to i64
258 define i64 @lsl_sext_i8_i64(i8 %b) {
259 ; CHECK-LABEL: lsl_sext_i8_i64:
261 ; CHECK-NEXT: ; kill: def $w0 killed $w0 def $x0
262 ; CHECK-NEXT: sbfiz x0, x0, #4, #8
264 %1 = sext i8 %b to i64
269 define zeroext i16 @lslv_i16(i16 %a, i16 %b) {
270 ; CHECK-LABEL: lslv_i16:
272 ; CHECK-NEXT: and w8, w1, #0xffff
273 ; CHECK-NEXT: lsl w8, w0, w8
274 ; CHECK-NEXT: and w8, w8, #0xffff
275 ; CHECK-NEXT: uxth w0, w8
281 define zeroext i16 @lsl_i16(i16 %a) {
282 ; CHECK-LABEL: lsl_i16:
284 ; CHECK-NEXT: ubfiz w8, w0, #8, #8
285 ; CHECK-NEXT: uxth w0, w8
291 define i32 @lsl_zext_i16_i32(i16 %b) {
292 ; CHECK-LABEL: lsl_zext_i16_i32:
294 ; CHECK-NEXT: ubfiz w0, w0, #8, #16
296 %1 = zext i16 %b to i32
301 define i32 @lsl_sext_i16_i32(i16 %b) {
302 ; CHECK-LABEL: lsl_sext_i16_i32:
304 ; CHECK-NEXT: sbfiz w0, w0, #8, #16
306 %1 = sext i16 %b to i32
311 define i64 @lsl_zext_i16_i64(i16 %b) {
312 ; CHECK-LABEL: lsl_zext_i16_i64:
314 ; CHECK-NEXT: ; kill: def $w0 killed $w0 def $x0
315 ; CHECK-NEXT: ubfiz x0, x0, #8, #16
317 %1 = zext i16 %b to i64
322 define i64 @lsl_sext_i16_i64(i16 %b) {
323 ; CHECK-LABEL: lsl_sext_i16_i64:
325 ; CHECK-NEXT: ; kill: def $w0 killed $w0 def $x0
326 ; CHECK-NEXT: sbfiz x0, x0, #8, #16
328 %1 = sext i16 %b to i64
333 define zeroext i32 @lslv_i32(i32 %a, i32 %b) {
334 ; CHECK-LABEL: lslv_i32:
336 ; CHECK-NEXT: lsl w0, w0, w1
342 define zeroext i32 @lsl_i32(i32 %a) {
343 ; CHECK-LABEL: lsl_i32:
345 ; CHECK-NEXT: lsl w0, w0, #16
351 define i64 @lsl_zext_i32_i64(i32 %b) {
352 ; CHECK-LABEL: lsl_zext_i32_i64:
354 ; CHECK-NEXT: ; kill: def $w0 killed $w0 def $x0
355 ; CHECK-NEXT: ubfiz x0, x0, #16, #32
357 %1 = zext i32 %b to i64
362 define i64 @lsl_sext_i32_i64(i32 %b) {
363 ; CHECK-LABEL: lsl_sext_i32_i64:
365 ; CHECK-NEXT: ; kill: def $w0 killed $w0 def $x0
366 ; CHECK-NEXT: sbfiz x0, x0, #16, #32
368 %1 = sext i32 %b to i64
373 define i64 @lslv_i64(i64 %a, i64 %b) {
374 ; CHECK-LABEL: lslv_i64:
376 ; CHECK-NEXT: lsl x0, x0, x1
382 define i64 @lsl_i64(i64 %a) {
383 ; CHECK-LABEL: lsl_i64:
385 ; CHECK-NEXT: lsl x0, x0, #32
391 define zeroext i8 @lsrv_i8(i8 %a, i8 %b) {
392 ; CHECK-LABEL: lsrv_i8:
394 ; CHECK-NEXT: and w8, w0, #0xff
395 ; CHECK-NEXT: and w9, w1, #0xff
396 ; CHECK-NEXT: lsr w8, w8, w9
397 ; CHECK-NEXT: and w8, w8, #0xff
398 ; CHECK-NEXT: uxtb w0, w8
404 define zeroext i8 @lsr_i8(i8 %a) {
405 ; CHECK-LABEL: lsr_i8:
407 ; CHECK-NEXT: ubfx w8, w0, #4, #4
408 ; CHECK-NEXT: uxtb w0, w8
414 define zeroext i16 @lsr_zext_i8_i16(i8 %b) {
415 ; CHECK-LABEL: lsr_zext_i8_i16:
417 ; CHECK-NEXT: ubfx w8, w0, #4, #4
418 ; CHECK-NEXT: uxth w0, w8
420 %1 = zext i8 %b to i16
425 define signext i16 @lsr_sext_i8_i16(i8 %b) {
426 ; CHECK-LABEL: lsr_sext_i8_i16:
428 ; CHECK-NEXT: sxtb w8, w0
429 ; CHECK-NEXT: ubfx w8, w8, #4, #12
430 ; CHECK-NEXT: sxth w0, w8
432 %1 = sext i8 %b to i16
437 define i32 @lsr_zext_i8_i32(i8 %b) {
438 ; CHECK-LABEL: lsr_zext_i8_i32:
440 ; CHECK-NEXT: ubfx w0, w0, #4, #4
442 %1 = zext i8 %b to i32
447 define i32 @lsr_sext_i8_i32(i8 %b) {
448 ; CHECK-LABEL: lsr_sext_i8_i32:
450 ; CHECK-NEXT: sxtb w8, w0
451 ; CHECK-NEXT: lsr w0, w8, #4
453 %1 = sext i8 %b to i32
458 define zeroext i16 @lsrv_i16(i16 %a, i16 %b) {
459 ; CHECK-LABEL: lsrv_i16:
461 ; CHECK-NEXT: and w8, w0, #0xffff
462 ; CHECK-NEXT: and w9, w1, #0xffff
463 ; CHECK-NEXT: lsr w8, w8, w9
464 ; CHECK-NEXT: and w8, w8, #0xffff
465 ; CHECK-NEXT: uxth w0, w8
471 define zeroext i16 @lsr_i16(i16 %a) {
472 ; CHECK-LABEL: lsr_i16:
474 ; CHECK-NEXT: ubfx w8, w0, #8, #8
475 ; CHECK-NEXT: uxth w0, w8
481 define zeroext i32 @lsrv_i32(i32 %a, i32 %b) {
482 ; CHECK-LABEL: lsrv_i32:
484 ; CHECK-NEXT: lsr w0, w0, w1
490 define zeroext i32 @lsr_i32(i32 %a) {
491 ; CHECK-LABEL: lsr_i32:
493 ; CHECK-NEXT: lsr w0, w0, #16
499 define i64 @lsrv_i64(i64 %a, i64 %b) {
500 ; CHECK-LABEL: lsrv_i64:
502 ; CHECK-NEXT: lsr x0, x0, x1
508 define i64 @lsr_i64(i64 %a) {
509 ; CHECK-LABEL: lsr_i64:
511 ; CHECK-NEXT: lsr x0, x0, #32
517 define zeroext i8 @asrv_i8(i8 %a, i8 %b) {
518 ; CHECK-LABEL: asrv_i8:
520 ; CHECK-NEXT: sxtb w8, w0
521 ; CHECK-NEXT: and w9, w1, #0xff
522 ; CHECK-NEXT: asr w8, w8, w9
523 ; CHECK-NEXT: and w8, w8, #0xff
524 ; CHECK-NEXT: uxtb w0, w8
530 define zeroext i8 @asr_i8(i8 %a) {
531 ; CHECK-LABEL: asr_i8:
533 ; CHECK-NEXT: sbfx w8, w0, #4, #4
534 ; CHECK-NEXT: uxtb w0, w8
540 define zeroext i16 @asr_zext_i8_i16(i8 %b) {
541 ; CHECK-LABEL: asr_zext_i8_i16:
543 ; CHECK-NEXT: ubfx w8, w0, #4, #4
544 ; CHECK-NEXT: uxth w0, w8
546 %1 = zext i8 %b to i16
551 define signext i16 @asr_sext_i8_i16(i8 %b) {
552 ; CHECK-LABEL: asr_sext_i8_i16:
554 ; CHECK-NEXT: sbfx w8, w0, #4, #4
555 ; CHECK-NEXT: sxth w0, w8
557 %1 = sext i8 %b to i16
562 define i32 @asr_zext_i8_i32(i8 %b) {
563 ; CHECK-LABEL: asr_zext_i8_i32:
565 ; CHECK-NEXT: ubfx w0, w0, #4, #4
567 %1 = zext i8 %b to i32
572 define i32 @asr_sext_i8_i32(i8 %b) {
573 ; CHECK-LABEL: asr_sext_i8_i32:
575 ; CHECK-NEXT: sbfx w0, w0, #4, #4
577 %1 = sext i8 %b to i32
582 define zeroext i16 @asrv_i16(i16 %a, i16 %b) {
583 ; CHECK-LABEL: asrv_i16:
585 ; CHECK-NEXT: sxth w8, w0
586 ; CHECK-NEXT: and w9, w1, #0xffff
587 ; CHECK-NEXT: asr w8, w8, w9
588 ; CHECK-NEXT: and w8, w8, #0xffff
589 ; CHECK-NEXT: uxth w0, w8
595 define zeroext i16 @asr_i16(i16 %a) {
596 ; CHECK-LABEL: asr_i16:
598 ; CHECK-NEXT: sbfx w8, w0, #8, #8
599 ; CHECK-NEXT: uxth w0, w8
605 define zeroext i32 @asrv_i32(i32 %a, i32 %b) {
606 ; CHECK-LABEL: asrv_i32:
608 ; CHECK-NEXT: asr w0, w0, w1
614 define zeroext i32 @asr_i32(i32 %a) {
615 ; CHECK-LABEL: asr_i32:
617 ; CHECK-NEXT: asr w0, w0, #16
623 define i64 @asrv_i64(i64 %a, i64 %b) {
624 ; CHECK-LABEL: asrv_i64:
626 ; CHECK-NEXT: asr x0, x0, x1
632 define i64 @asr_i64(i64 %a) {
633 ; CHECK-LABEL: asr_i64:
635 ; CHECK-NEXT: asr x0, x0, #32
641 define i32 @shift_test1(i8 %a) {
642 ; CHECK-LABEL: shift_test1:
644 ; CHECK-NEXT: ubfiz w8, w0, #4, #4
645 ; CHECK-NEXT: sbfx w8, w8, #4, #4
646 ; CHECK-NEXT: sxtb w0, w8
650 %3 = sext i8 %2 to i32
656 define i32 @shl_zero(i32 %a) {
657 ; CHECK-LABEL: shl_zero:
664 define i32 @lshr_zero(i32 %a) {
665 ; CHECK-LABEL: lshr_zero:
672 define i32 @ashr_zero(i32 %a) {
673 ; CHECK-LABEL: ashr_zero:
680 define i64 @shl_zext_zero(i32 %a) {
681 ; CHECK-LABEL: shl_zext_zero:
683 ; CHECK-NEXT: ; kill: def $w0 killed $w0 def $x0
684 ; CHECK-NEXT: ubfx x0, x0, #0, #32
686 %1 = zext i32 %a to i64
691 define i64 @lshr_zext_zero(i32 %a) {
692 ; CHECK-LABEL: lshr_zext_zero:
694 ; CHECK-NEXT: ; kill: def $w0 killed $w0 def $x0
695 ; CHECK-NEXT: ubfx x0, x0, #0, #32
697 %1 = zext i32 %a to i64
702 define i64 @ashr_zext_zero(i32 %a) {
703 ; CHECK-LABEL: ashr_zext_zero:
705 ; CHECK-NEXT: ; kill: def $w0 killed $w0 def $x0
706 ; CHECK-NEXT: ubfx x0, x0, #0, #32
708 %1 = zext i32 %a to i64