1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -mtriple=aarch64-- -run-pass=instruction-select -verify-machineinstrs %s -o - | FileCheck %s
5 target datalayout = "e-m:o-i64:64-i128:128-n32:64-S128"
7 define void @load_s64_gpr(i64* %addr) { ret void }
8 define void @load_s32_gpr(i32* %addr) { ret void }
9 define void @load_s16_gpr_anyext(i16* %addr) { ret void }
10 define void @load_s16_gpr(i16* %addr) { ret void }
11 define void @load_s8_gpr_anyext(i8* %addr) { ret void }
12 define void @load_s8_gpr(i8* %addr) { ret void }
14 define void @load_fi_s64_gpr() {
19 define void @load_gep_128_s64_gpr(i64* %addr) { ret void }
20 define void @load_gep_512_s32_gpr(i32* %addr) { ret void }
21 define void @load_gep_64_s16_gpr(i16* %addr) { ret void }
22 define void @load_gep_1_s8_gpr(i8* %addr) { ret void }
24 define void @load_s64_fpr(i64* %addr) { ret void }
25 define void @load_s32_fpr(i32* %addr) { ret void }
26 define void @load_s16_fpr(i16* %addr) { ret void }
27 define void @load_s8_fpr(i8* %addr) { ret void }
29 define void @load_gep_8_s64_fpr(i64* %addr) { ret void }
30 define void @load_gep_16_s32_fpr(i32* %addr) { ret void }
31 define void @load_gep_64_s16_fpr(i16* %addr) { ret void }
32 define void @load_gep_32_s8_fpr(i8* %addr) { ret void }
34 define void @load_v2s32(i64 *%addr) { ret void }
35 define void @load_v2s64(i64 *%addr) { ret void }
37 define void @load_4xi16(<4 x i16>* %ptr) { ret void }
38 define void @load_4xi32(<4 x i32>* %ptr) { ret void }
39 define void @load_8xi16(<8 x i16>* %ptr) { ret void }
40 define void @load_16xi8(<16 x i8>* %ptr) { ret void }
41 define void @anyext_on_fpr() { ret void }
42 define void @anyext_on_fpr8() { ret void }
52 - { id: 0, class: gpr }
53 - { id: 1, class: gpr }
59 ; CHECK-LABEL: name: load_s64_gpr
60 ; CHECK: [[COPY:%[0-9]+]]:gpr64sp = COPY $x0
61 ; CHECK-NEXT: [[LDRXui:%[0-9]+]]:gpr64 = LDRXui [[COPY]], 0 :: (load (s64) from %ir.addr)
62 ; CHECK-NEXT: $x0 = COPY [[LDRXui]]
64 %1(s64) = G_LOAD %0 :: (load (s64) from %ir.addr)
74 - { id: 0, class: gpr }
75 - { id: 1, class: gpr }
81 ; CHECK-LABEL: name: load_s32_gpr
82 ; CHECK: [[COPY:%[0-9]+]]:gpr64sp = COPY $x0
83 ; CHECK-NEXT: [[LDRWui:%[0-9]+]]:gpr32 = LDRWui [[COPY]], 0 :: (load (s32) from %ir.addr)
84 ; CHECK-NEXT: $w0 = COPY [[LDRWui]]
86 %1(s32) = G_LOAD %0 :: (load (s32) from %ir.addr)
91 name: load_s16_gpr_anyext
99 ; CHECK-LABEL: name: load_s16_gpr_anyext
100 ; CHECK: [[COPY:%[0-9]+]]:gpr64sp = COPY $x0
101 ; CHECK-NEXT: [[LDRHHui:%[0-9]+]]:gpr32 = LDRHHui [[COPY]], 0 :: (load (s16) from %ir.addr)
102 ; CHECK-NEXT: $w0 = COPY [[LDRHHui]]
103 %0:gpr(p0) = COPY $x0
104 %1:gpr(s32) = G_LOAD %0 :: (load (s16) from %ir.addr)
111 regBankSelected: true
114 - { id: 0, class: gpr }
115 - { id: 1, class: gpr }
121 ; CHECK-LABEL: name: load_s16_gpr
122 ; CHECK: [[COPY:%[0-9]+]]:gpr64sp = COPY $x0
123 ; CHECK-NEXT: [[LDRHHui:%[0-9]+]]:gpr32 = LDRHHui [[COPY]], 0 :: (load (s16) from %ir.addr)
124 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:gpr32all = COPY [[LDRHHui]]
125 ; CHECK-NEXT: $w0 = COPY [[COPY1]]
127 %1(s16) = G_LOAD %0 :: (load (s16) from %ir.addr)
128 %2:gpr(s32) = G_ANYEXT %1
133 name: load_s8_gpr_anyext
135 regBankSelected: true
141 ; CHECK-LABEL: name: load_s8_gpr_anyext
142 ; CHECK: [[COPY:%[0-9]+]]:gpr64sp = COPY $x0
143 ; CHECK-NEXT: [[LDRBBui:%[0-9]+]]:gpr32 = LDRBBui [[COPY]], 0 :: (load (s8) from %ir.addr)
144 ; CHECK-NEXT: $w0 = COPY [[LDRBBui]]
145 %0:gpr(p0) = COPY $x0
146 %1:gpr(s32) = G_LOAD %0 :: (load (s8) from %ir.addr)
153 regBankSelected: true
156 - { id: 0, class: gpr }
157 - { id: 1, class: gpr }
163 ; CHECK-LABEL: name: load_s8_gpr
164 ; CHECK: [[COPY:%[0-9]+]]:gpr64sp = COPY $x0
165 ; CHECK-NEXT: [[LDRBBui:%[0-9]+]]:gpr32 = LDRBBui [[COPY]], 0 :: (load (s8) from %ir.addr)
166 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:gpr32all = COPY [[LDRBBui]]
167 ; CHECK-NEXT: $w0 = COPY [[COPY1]]
169 %1(s8) = G_LOAD %0 :: (load (s8) from %ir.addr)
170 %2:gpr(s32) = G_ANYEXT %1
175 name: load_fi_s64_gpr
177 regBankSelected: true
180 - { id: 0, class: gpr }
181 - { id: 1, class: gpr }
184 - { id: 0, name: ptr0, offset: 0, size: 8, alignment: 8 }
190 ; CHECK-LABEL: name: load_fi_s64_gpr
191 ; CHECK: [[LDRXui:%[0-9]+]]:gpr64 = LDRXui %stack.0.ptr0, 0 :: (load (s64))
192 ; CHECK-NEXT: $x0 = COPY [[LDRXui]]
193 %0(p0) = G_FRAME_INDEX %stack.0.ptr0
194 %1(s64) = G_LOAD %0 :: (load (s64))
199 name: load_gep_128_s64_gpr
201 regBankSelected: true
204 - { id: 0, class: gpr }
205 - { id: 1, class: gpr }
206 - { id: 2, class: gpr }
207 - { id: 3, class: gpr }
213 ; CHECK-LABEL: name: load_gep_128_s64_gpr
214 ; CHECK: [[COPY:%[0-9]+]]:gpr64sp = COPY $x0
215 ; CHECK-NEXT: [[LDRXui:%[0-9]+]]:gpr64 = LDRXui [[COPY]], 16 :: (load (s64) from %ir.addr)
216 ; CHECK-NEXT: $x0 = COPY [[LDRXui]]
218 %1(s64) = G_CONSTANT i64 128
219 %2(p0) = G_PTR_ADD %0, %1
220 %3(s64) = G_LOAD %2 :: (load (s64) from %ir.addr)
225 name: load_gep_512_s32_gpr
227 regBankSelected: true
230 - { id: 0, class: gpr }
231 - { id: 1, class: gpr }
232 - { id: 2, class: gpr }
233 - { id: 3, class: gpr }
239 ; CHECK-LABEL: name: load_gep_512_s32_gpr
240 ; CHECK: [[COPY:%[0-9]+]]:gpr64sp = COPY $x0
241 ; CHECK-NEXT: [[LDRWui:%[0-9]+]]:gpr32 = LDRWui [[COPY]], 128 :: (load (s32) from %ir.addr)
242 ; CHECK-NEXT: $w0 = COPY [[LDRWui]]
244 %1(s64) = G_CONSTANT i64 512
245 %2(p0) = G_PTR_ADD %0, %1
246 %3(s32) = G_LOAD %2 :: (load (s32) from %ir.addr)
251 name: load_gep_64_s16_gpr
253 regBankSelected: true
256 - { id: 0, class: gpr }
257 - { id: 1, class: gpr }
258 - { id: 2, class: gpr }
259 - { id: 3, class: gpr }
265 ; CHECK-LABEL: name: load_gep_64_s16_gpr
266 ; CHECK: [[COPY:%[0-9]+]]:gpr64sp = COPY $x0
267 ; CHECK-NEXT: [[LDRHHui:%[0-9]+]]:gpr32 = LDRHHui [[COPY]], 32 :: (load (s16) from %ir.addr)
268 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:gpr32all = COPY [[LDRHHui]]
269 ; CHECK-NEXT: $w0 = COPY [[COPY1]]
271 %1(s64) = G_CONSTANT i64 64
272 %2(p0) = G_PTR_ADD %0, %1
273 %3(s16) = G_LOAD %2 :: (load (s16) from %ir.addr)
274 %4:gpr(s32) = G_ANYEXT %3
279 name: load_gep_1_s8_gpr
281 regBankSelected: true
284 - { id: 0, class: gpr }
285 - { id: 1, class: gpr }
286 - { id: 2, class: gpr }
287 - { id: 3, class: gpr }
293 ; CHECK-LABEL: name: load_gep_1_s8_gpr
294 ; CHECK: [[COPY:%[0-9]+]]:gpr64sp = COPY $x0
295 ; CHECK-NEXT: [[LDRBBui:%[0-9]+]]:gpr32 = LDRBBui [[COPY]], 1 :: (load (s8) from %ir.addr)
296 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:gpr32all = COPY [[LDRBBui]]
297 ; CHECK-NEXT: $w0 = COPY [[COPY1]]
299 %1(s64) = G_CONSTANT i64 1
300 %2(p0) = G_PTR_ADD %0, %1
301 %3(s8) = G_LOAD %2 :: (load (s8) from %ir.addr)
302 %4:gpr(s32) = G_ANYEXT %3
309 regBankSelected: true
312 - { id: 0, class: gpr }
313 - { id: 1, class: fpr }
319 ; CHECK-LABEL: name: load_s64_fpr
320 ; CHECK: [[COPY:%[0-9]+]]:gpr64sp = COPY $x0
321 ; CHECK-NEXT: [[LDRDui:%[0-9]+]]:fpr64 = LDRDui [[COPY]], 0 :: (load (s64) from %ir.addr)
322 ; CHECK-NEXT: $d0 = COPY [[LDRDui]]
324 %1(s64) = G_LOAD %0 :: (load (s64) from %ir.addr)
331 regBankSelected: true
334 - { id: 0, class: gpr }
335 - { id: 1, class: fpr }
341 ; CHECK-LABEL: name: load_s32_fpr
342 ; CHECK: [[COPY:%[0-9]+]]:gpr64sp = COPY $x0
343 ; CHECK-NEXT: [[LDRSui:%[0-9]+]]:fpr32 = LDRSui [[COPY]], 0 :: (load (s32) from %ir.addr)
344 ; CHECK-NEXT: $s0 = COPY [[LDRSui]]
346 %1(s32) = G_LOAD %0 :: (load (s32) from %ir.addr)
353 regBankSelected: true
356 - { id: 0, class: gpr }
357 - { id: 1, class: fpr }
363 ; CHECK-LABEL: name: load_s16_fpr
364 ; CHECK: [[COPY:%[0-9]+]]:gpr64sp = COPY $x0
365 ; CHECK-NEXT: [[LDRHui:%[0-9]+]]:fpr16 = LDRHui [[COPY]], 0 :: (load (s16) from %ir.addr)
366 ; CHECK-NEXT: $h0 = COPY [[LDRHui]]
368 %1(s16) = G_LOAD %0 :: (load (s16) from %ir.addr)
375 regBankSelected: true
378 - { id: 0, class: gpr }
379 - { id: 1, class: fpr }
385 ; CHECK-LABEL: name: load_s8_fpr
386 ; CHECK: [[COPY:%[0-9]+]]:gpr64sp = COPY $x0
387 ; CHECK-NEXT: [[LDRBui:%[0-9]+]]:fpr8 = LDRBui [[COPY]], 0 :: (load (s8) from %ir.addr)
388 ; CHECK-NEXT: $b0 = COPY [[LDRBui]]
390 %1(s8) = G_LOAD %0 :: (load (s8) from %ir.addr)
395 name: load_gep_8_s64_fpr
397 regBankSelected: true
400 - { id: 0, class: gpr }
401 - { id: 1, class: gpr }
402 - { id: 2, class: gpr }
403 - { id: 3, class: fpr }
409 ; CHECK-LABEL: name: load_gep_8_s64_fpr
410 ; CHECK: [[COPY:%[0-9]+]]:gpr64sp = COPY $x0
411 ; CHECK-NEXT: [[LDRDui:%[0-9]+]]:fpr64 = LDRDui [[COPY]], 1 :: (load (s64) from %ir.addr)
412 ; CHECK-NEXT: $d0 = COPY [[LDRDui]]
414 %1(s64) = G_CONSTANT i64 8
415 %2(p0) = G_PTR_ADD %0, %1
416 %3(s64) = G_LOAD %2 :: (load (s64) from %ir.addr)
421 name: load_gep_16_s32_fpr
423 regBankSelected: true
426 - { id: 0, class: gpr }
427 - { id: 1, class: gpr }
428 - { id: 2, class: gpr }
429 - { id: 3, class: fpr }
435 ; CHECK-LABEL: name: load_gep_16_s32_fpr
436 ; CHECK: [[COPY:%[0-9]+]]:gpr64sp = COPY $x0
437 ; CHECK-NEXT: [[LDRSui:%[0-9]+]]:fpr32 = LDRSui [[COPY]], 4 :: (load (s32) from %ir.addr)
438 ; CHECK-NEXT: $s0 = COPY [[LDRSui]]
440 %1(s64) = G_CONSTANT i64 16
441 %2(p0) = G_PTR_ADD %0, %1
442 %3(s32) = G_LOAD %2 :: (load (s32) from %ir.addr)
447 name: load_gep_64_s16_fpr
449 regBankSelected: true
452 - { id: 0, class: gpr }
453 - { id: 1, class: gpr }
454 - { id: 2, class: gpr }
455 - { id: 3, class: fpr }
461 ; CHECK-LABEL: name: load_gep_64_s16_fpr
462 ; CHECK: [[COPY:%[0-9]+]]:gpr64sp = COPY $x0
463 ; CHECK-NEXT: [[LDRHui:%[0-9]+]]:fpr16 = LDRHui [[COPY]], 32 :: (load (s16) from %ir.addr)
464 ; CHECK-NEXT: $h0 = COPY [[LDRHui]]
466 %1(s64) = G_CONSTANT i64 64
467 %2(p0) = G_PTR_ADD %0, %1
468 %3(s16) = G_LOAD %2 :: (load (s16) from %ir.addr)
473 name: load_gep_32_s8_fpr
475 regBankSelected: true
478 - { id: 0, class: gpr }
479 - { id: 1, class: gpr }
480 - { id: 2, class: gpr }
481 - { id: 3, class: fpr }
487 ; CHECK-LABEL: name: load_gep_32_s8_fpr
488 ; CHECK: [[COPY:%[0-9]+]]:gpr64sp = COPY $x0
489 ; CHECK-NEXT: [[LDRBui:%[0-9]+]]:fpr8 = LDRBui [[COPY]], 32 :: (load (s8) from %ir.addr)
490 ; CHECK-NEXT: $b0 = COPY [[LDRBui]]
492 %1(s64) = G_CONSTANT i64 32
493 %2(p0) = G_PTR_ADD %0, %1
494 %3(s8) = G_LOAD %2 :: (load (s8) from %ir.addr)
500 regBankSelected: true
503 - { id: 0, class: gpr }
504 - { id: 1, class: fpr }
510 ; CHECK-LABEL: name: load_v2s32
511 ; CHECK: [[COPY:%[0-9]+]]:gpr64sp = COPY $x0
512 ; CHECK-NEXT: [[LDRDui:%[0-9]+]]:fpr64 = LDRDui [[COPY]], 0 :: (load (<2 x s32>) from %ir.addr)
513 ; CHECK-NEXT: $d0 = COPY [[LDRDui]]
515 %1(<2 x s32>) = G_LOAD %0 :: (load (<2 x s32>) from %ir.addr)
516 $d0 = COPY %1(<2 x s32>)
521 regBankSelected: true
524 - { id: 0, class: gpr }
525 - { id: 1, class: fpr }
531 ; CHECK-LABEL: name: load_v2s64
532 ; CHECK: [[COPY:%[0-9]+]]:gpr64sp = COPY $x0
533 ; CHECK-NEXT: [[LDRQui:%[0-9]+]]:fpr128 = LDRQui [[COPY]], 0 :: (load (<2 x s64>) from %ir.addr)
534 ; CHECK-NEXT: $q0 = COPY [[LDRQui]]
536 %1(<2 x s64>) = G_LOAD %0 :: (load (<2 x s64>) from %ir.addr)
537 $q0 = COPY %1(<2 x s64>)
543 regBankSelected: true
544 tracksRegLiveness: true
546 - { id: 0, class: gpr }
547 - { id: 1, class: fpr }
548 machineFunctionInfo: {}
553 ; CHECK-LABEL: name: load_4xi16
554 ; CHECK: liveins: $x0
556 ; CHECK-NEXT: [[COPY:%[0-9]+]]:gpr64sp = COPY $x0
557 ; CHECK-NEXT: [[LDRDui:%[0-9]+]]:fpr64 = LDRDui [[COPY]], 0 :: (load (<4 x s16>) from %ir.ptr)
558 ; CHECK-NEXT: $d0 = COPY [[LDRDui]]
559 ; CHECK-NEXT: RET_ReallyLR implicit $d0
560 %0:gpr(p0) = COPY $x0
561 %1:fpr(<4 x s16>) = G_LOAD %0(p0) :: (load (<4 x s16>) from %ir.ptr)
562 $d0 = COPY %1(<4 x s16>)
563 RET_ReallyLR implicit $d0
570 regBankSelected: true
571 tracksRegLiveness: true
573 - { id: 0, class: gpr }
574 - { id: 1, class: fpr }
575 machineFunctionInfo: {}
580 ; CHECK-LABEL: name: load_4xi32
581 ; CHECK: liveins: $x0
583 ; CHECK-NEXT: [[COPY:%[0-9]+]]:gpr64sp = COPY $x0
584 ; CHECK-NEXT: [[LDRQui:%[0-9]+]]:fpr128 = LDRQui [[COPY]], 0 :: (load (<4 x s32>) from %ir.ptr)
585 ; CHECK-NEXT: $q0 = COPY [[LDRQui]]
586 ; CHECK-NEXT: RET_ReallyLR implicit $q0
587 %0:gpr(p0) = COPY $x0
588 %1:fpr(<4 x s32>) = G_LOAD %0(p0) :: (load (<4 x s32>) from %ir.ptr)
589 $q0 = COPY %1(<4 x s32>)
590 RET_ReallyLR implicit $q0
597 regBankSelected: true
598 tracksRegLiveness: true
600 - { id: 0, class: gpr }
601 - { id: 1, class: fpr }
602 machineFunctionInfo: {}
607 ; CHECK-LABEL: name: load_8xi16
608 ; CHECK: liveins: $x0
610 ; CHECK-NEXT: [[COPY:%[0-9]+]]:gpr64sp = COPY $x0
611 ; CHECK-NEXT: [[LDRQui:%[0-9]+]]:fpr128 = LDRQui [[COPY]], 0 :: (load (<8 x s16>) from %ir.ptr)
612 ; CHECK-NEXT: $q0 = COPY [[LDRQui]]
613 ; CHECK-NEXT: RET_ReallyLR implicit $q0
614 %0:gpr(p0) = COPY $x0
615 %1:fpr(<8 x s16>) = G_LOAD %0(p0) :: (load (<8 x s16>) from %ir.ptr)
616 $q0 = COPY %1(<8 x s16>)
617 RET_ReallyLR implicit $q0
624 regBankSelected: true
625 tracksRegLiveness: true
627 - { id: 0, class: gpr }
628 - { id: 1, class: fpr }
629 machineFunctionInfo: {}
634 ; CHECK-LABEL: name: load_16xi8
635 ; CHECK: liveins: $x0
637 ; CHECK-NEXT: [[COPY:%[0-9]+]]:gpr64sp = COPY $x0
638 ; CHECK-NEXT: [[LDRQui:%[0-9]+]]:fpr128 = LDRQui [[COPY]], 0 :: (load (<16 x s8>) from %ir.ptr)
639 ; CHECK-NEXT: $q0 = COPY [[LDRQui]]
640 ; CHECK-NEXT: RET_ReallyLR implicit $q0
641 %0:gpr(p0) = COPY $x0
642 %1:fpr(<16 x s8>) = G_LOAD %0(p0) :: (load (<16 x s8>) from %ir.ptr)
643 $q0 = COPY %1(<16 x s8>)
644 RET_ReallyLR implicit $q0
651 regBankSelected: true
652 tracksRegLiveness: true
660 machineFunctionInfo: {}
663 liveins: $w3, $x0, $x1, $x2
665 ; CHECK-LABEL: name: anyext_on_fpr
666 ; CHECK: liveins: $w3, $x0, $x1, $x2
668 ; CHECK-NEXT: [[COPY:%[0-9]+]]:gpr64sp = COPY $x0
669 ; CHECK-NEXT: [[LDRHui:%[0-9]+]]:fpr16 = LDRHui [[COPY]], 0 :: (load (s16))
670 ; CHECK-NEXT: [[SUBREG_TO_REG:%[0-9]+]]:fpr32 = SUBREG_TO_REG 0, [[LDRHui]], %subreg.hsub
671 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:gpr32all = COPY [[SUBREG_TO_REG]]
672 ; CHECK-NEXT: $w0 = COPY [[COPY1]]
673 ; CHECK-NEXT: RET_ReallyLR
674 %0:gpr(p0) = COPY $x0
675 %16:fpr(s32) = G_LOAD %0(p0) :: (load (s16))
676 %24:gpr(s32) = COPY %16(s32)
685 regBankSelected: true
686 tracksRegLiveness: true
694 machineFunctionInfo: {}
697 liveins: $w3, $x0, $x1, $x2
699 ; CHECK-LABEL: name: anyext_on_fpr8
700 ; CHECK: liveins: $w3, $x0, $x1, $x2
702 ; CHECK-NEXT: [[COPY:%[0-9]+]]:gpr64sp = COPY $x0
703 ; CHECK-NEXT: [[LDRBui:%[0-9]+]]:fpr8 = LDRBui [[COPY]], 0 :: (load (s8))
704 ; CHECK-NEXT: [[SUBREG_TO_REG:%[0-9]+]]:fpr32 = SUBREG_TO_REG 0, [[LDRBui]], %subreg.bsub
705 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:gpr32all = COPY [[SUBREG_TO_REG]]
706 ; CHECK-NEXT: $w0 = COPY [[COPY1]]
707 ; CHECK-NEXT: RET_ReallyLR
708 %0:gpr(p0) = COPY $x0
709 %16:fpr(s32) = G_LOAD %0(p0) :: (load (s8))
710 %24:gpr(s32) = COPY %16(s32)