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 }
50 - { id: 0, class: gpr }
51 - { id: 1, class: gpr }
57 ; CHECK-LABEL: name: load_s64_gpr
58 ; CHECK: [[COPY:%[0-9]+]]:gpr64sp = COPY $x0
59 ; CHECK: [[LDRXui:%[0-9]+]]:gpr64 = LDRXui [[COPY]], 0 :: (load 8 from %ir.addr)
60 ; CHECK: $x0 = COPY [[LDRXui]]
62 %1(s64) = G_LOAD %0 :: (load 8 from %ir.addr)
72 - { id: 0, class: gpr }
73 - { id: 1, class: gpr }
79 ; CHECK-LABEL: name: load_s32_gpr
80 ; CHECK: [[COPY:%[0-9]+]]:gpr64sp = COPY $x0
81 ; CHECK: [[LDRWui:%[0-9]+]]:gpr32 = LDRWui [[COPY]], 0 :: (load 4 from %ir.addr)
82 ; CHECK: $w0 = COPY [[LDRWui]]
84 %1(s32) = G_LOAD %0 :: (load 4 from %ir.addr)
89 name: load_s16_gpr_anyext
97 ; CHECK-LABEL: name: load_s16_gpr_anyext
98 ; CHECK: [[COPY:%[0-9]+]]:gpr64sp = COPY $x0
99 ; CHECK: [[LDRHHui:%[0-9]+]]:gpr32 = LDRHHui [[COPY]], 0 :: (load 2 from %ir.addr)
100 ; CHECK: $w0 = COPY [[LDRHHui]]
101 %0:gpr(p0) = COPY $x0
102 %1:gpr(s32) = G_LOAD %0 :: (load 2 from %ir.addr)
109 regBankSelected: true
112 - { id: 0, class: gpr }
113 - { id: 1, class: gpr }
119 ; CHECK-LABEL: name: load_s16_gpr
120 ; CHECK: [[COPY:%[0-9]+]]:gpr64sp = COPY $x0
121 ; CHECK: [[LDRHHui:%[0-9]+]]:gpr32 = LDRHHui [[COPY]], 0 :: (load 2 from %ir.addr)
122 ; CHECK: [[COPY1:%[0-9]+]]:gpr32all = COPY [[LDRHHui]]
123 ; CHECK: $w0 = COPY [[COPY1]]
125 %1(s16) = G_LOAD %0 :: (load 2 from %ir.addr)
126 %2:gpr(s32) = G_ANYEXT %1
131 name: load_s8_gpr_anyext
133 regBankSelected: true
139 ; CHECK-LABEL: name: load_s8_gpr_anyext
140 ; CHECK: [[COPY:%[0-9]+]]:gpr64sp = COPY $x0
141 ; CHECK: [[LDRBBui:%[0-9]+]]:gpr32 = LDRBBui [[COPY]], 0 :: (load 1 from %ir.addr)
142 ; CHECK: $w0 = COPY [[LDRBBui]]
143 %0:gpr(p0) = COPY $x0
144 %1:gpr(s32) = G_LOAD %0 :: (load 1 from %ir.addr)
151 regBankSelected: true
154 - { id: 0, class: gpr }
155 - { id: 1, class: gpr }
161 ; CHECK-LABEL: name: load_s8_gpr
162 ; CHECK: [[COPY:%[0-9]+]]:gpr64sp = COPY $x0
163 ; CHECK: [[LDRBBui:%[0-9]+]]:gpr32 = LDRBBui [[COPY]], 0 :: (load 1 from %ir.addr)
164 ; CHECK: [[COPY1:%[0-9]+]]:gpr32all = COPY [[LDRBBui]]
165 ; CHECK: $w0 = COPY [[COPY1]]
167 %1(s8) = G_LOAD %0 :: (load 1 from %ir.addr)
168 %2:gpr(s32) = G_ANYEXT %1
173 name: load_fi_s64_gpr
175 regBankSelected: true
178 - { id: 0, class: gpr }
179 - { id: 1, class: gpr }
182 - { id: 0, name: ptr0, offset: 0, size: 8, alignment: 8 }
188 ; CHECK-LABEL: name: load_fi_s64_gpr
189 ; CHECK: [[LDRXui:%[0-9]+]]:gpr64 = LDRXui %stack.0.ptr0, 0 :: (load 8)
190 ; CHECK: $x0 = COPY [[LDRXui]]
191 %0(p0) = G_FRAME_INDEX %stack.0.ptr0
192 %1(s64) = G_LOAD %0 :: (load 8)
197 name: load_gep_128_s64_gpr
199 regBankSelected: true
202 - { id: 0, class: gpr }
203 - { id: 1, class: gpr }
204 - { id: 2, class: gpr }
205 - { id: 3, class: gpr }
211 ; CHECK-LABEL: name: load_gep_128_s64_gpr
212 ; CHECK: [[COPY:%[0-9]+]]:gpr64sp = COPY $x0
213 ; CHECK: [[LDRXui:%[0-9]+]]:gpr64 = LDRXui [[COPY]], 16 :: (load 8 from %ir.addr)
214 ; CHECK: $x0 = COPY [[LDRXui]]
216 %1(s64) = G_CONSTANT i64 128
217 %2(p0) = G_GEP %0, %1
218 %3(s64) = G_LOAD %2 :: (load 8 from %ir.addr)
223 name: load_gep_512_s32_gpr
225 regBankSelected: true
228 - { id: 0, class: gpr }
229 - { id: 1, class: gpr }
230 - { id: 2, class: gpr }
231 - { id: 3, class: gpr }
237 ; CHECK-LABEL: name: load_gep_512_s32_gpr
238 ; CHECK: [[COPY:%[0-9]+]]:gpr64sp = COPY $x0
239 ; CHECK: [[LDRWui:%[0-9]+]]:gpr32 = LDRWui [[COPY]], 128 :: (load 4 from %ir.addr)
240 ; CHECK: $w0 = COPY [[LDRWui]]
242 %1(s64) = G_CONSTANT i64 512
243 %2(p0) = G_GEP %0, %1
244 %3(s32) = G_LOAD %2 :: (load 4 from %ir.addr)
249 name: load_gep_64_s16_gpr
251 regBankSelected: true
254 - { id: 0, class: gpr }
255 - { id: 1, class: gpr }
256 - { id: 2, class: gpr }
257 - { id: 3, class: gpr }
263 ; CHECK-LABEL: name: load_gep_64_s16_gpr
264 ; CHECK: [[COPY:%[0-9]+]]:gpr64sp = COPY $x0
265 ; CHECK: [[LDRHHui:%[0-9]+]]:gpr32 = LDRHHui [[COPY]], 32 :: (load 2 from %ir.addr)
266 ; CHECK: [[COPY1:%[0-9]+]]:gpr32all = COPY [[LDRHHui]]
267 ; CHECK: $w0 = COPY [[COPY1]]
269 %1(s64) = G_CONSTANT i64 64
270 %2(p0) = G_GEP %0, %1
271 %3(s16) = G_LOAD %2 :: (load 2 from %ir.addr)
272 %4:gpr(s32) = G_ANYEXT %3
277 name: load_gep_1_s8_gpr
279 regBankSelected: true
282 - { id: 0, class: gpr }
283 - { id: 1, class: gpr }
284 - { id: 2, class: gpr }
285 - { id: 3, class: gpr }
291 ; CHECK-LABEL: name: load_gep_1_s8_gpr
292 ; CHECK: [[COPY:%[0-9]+]]:gpr64sp = COPY $x0
293 ; CHECK: [[LDRBBui:%[0-9]+]]:gpr32 = LDRBBui [[COPY]], 1 :: (load 1 from %ir.addr)
294 ; CHECK: [[COPY1:%[0-9]+]]:gpr32all = COPY [[LDRBBui]]
295 ; CHECK: $w0 = COPY [[COPY1]]
297 %1(s64) = G_CONSTANT i64 1
298 %2(p0) = G_GEP %0, %1
299 %3(s8) = G_LOAD %2 :: (load 1 from %ir.addr)
300 %4:gpr(s32) = G_ANYEXT %3
307 regBankSelected: true
310 - { id: 0, class: gpr }
311 - { id: 1, class: fpr }
317 ; CHECK-LABEL: name: load_s64_fpr
318 ; CHECK: [[COPY:%[0-9]+]]:gpr64sp = COPY $x0
319 ; CHECK: [[LDRDui:%[0-9]+]]:fpr64 = LDRDui [[COPY]], 0 :: (load 8 from %ir.addr)
320 ; CHECK: $d0 = COPY [[LDRDui]]
322 %1(s64) = G_LOAD %0 :: (load 8 from %ir.addr)
329 regBankSelected: true
332 - { id: 0, class: gpr }
333 - { id: 1, class: fpr }
339 ; CHECK-LABEL: name: load_s32_fpr
340 ; CHECK: [[COPY:%[0-9]+]]:gpr64sp = COPY $x0
341 ; CHECK: [[LDRSui:%[0-9]+]]:fpr32 = LDRSui [[COPY]], 0 :: (load 4 from %ir.addr)
342 ; CHECK: $s0 = COPY [[LDRSui]]
344 %1(s32) = G_LOAD %0 :: (load 4 from %ir.addr)
351 regBankSelected: true
354 - { id: 0, class: gpr }
355 - { id: 1, class: fpr }
361 ; CHECK-LABEL: name: load_s16_fpr
362 ; CHECK: [[COPY:%[0-9]+]]:gpr64sp = COPY $x0
363 ; CHECK: [[LDRHui:%[0-9]+]]:fpr16 = LDRHui [[COPY]], 0 :: (load 2 from %ir.addr)
364 ; CHECK: $h0 = COPY [[LDRHui]]
366 %1(s16) = G_LOAD %0 :: (load 2 from %ir.addr)
373 regBankSelected: true
376 - { id: 0, class: gpr }
377 - { id: 1, class: fpr }
383 ; CHECK-LABEL: name: load_s8_fpr
384 ; CHECK: [[COPY:%[0-9]+]]:gpr64sp = COPY $x0
385 ; CHECK: [[LDRBui:%[0-9]+]]:fpr8 = LDRBui [[COPY]], 0 :: (load 1 from %ir.addr)
386 ; CHECK: $b0 = COPY [[LDRBui]]
388 %1(s8) = G_LOAD %0 :: (load 1 from %ir.addr)
393 name: load_gep_8_s64_fpr
395 regBankSelected: true
398 - { id: 0, class: gpr }
399 - { id: 1, class: gpr }
400 - { id: 2, class: gpr }
401 - { id: 3, class: fpr }
407 ; CHECK-LABEL: name: load_gep_8_s64_fpr
408 ; CHECK: [[COPY:%[0-9]+]]:gpr64sp = COPY $x0
409 ; CHECK: [[LDRDui:%[0-9]+]]:fpr64 = LDRDui [[COPY]], 1 :: (load 8 from %ir.addr)
410 ; CHECK: $d0 = COPY [[LDRDui]]
412 %1(s64) = G_CONSTANT i64 8
413 %2(p0) = G_GEP %0, %1
414 %3(s64) = G_LOAD %2 :: (load 8 from %ir.addr)
419 name: load_gep_16_s32_fpr
421 regBankSelected: true
424 - { id: 0, class: gpr }
425 - { id: 1, class: gpr }
426 - { id: 2, class: gpr }
427 - { id: 3, class: fpr }
433 ; CHECK-LABEL: name: load_gep_16_s32_fpr
434 ; CHECK: [[COPY:%[0-9]+]]:gpr64sp = COPY $x0
435 ; CHECK: [[LDRSui:%[0-9]+]]:fpr32 = LDRSui [[COPY]], 4 :: (load 4 from %ir.addr)
436 ; CHECK: $s0 = COPY [[LDRSui]]
438 %1(s64) = G_CONSTANT i64 16
439 %2(p0) = G_GEP %0, %1
440 %3(s32) = G_LOAD %2 :: (load 4 from %ir.addr)
445 name: load_gep_64_s16_fpr
447 regBankSelected: true
450 - { id: 0, class: gpr }
451 - { id: 1, class: gpr }
452 - { id: 2, class: gpr }
453 - { id: 3, class: fpr }
459 ; CHECK-LABEL: name: load_gep_64_s16_fpr
460 ; CHECK: [[COPY:%[0-9]+]]:gpr64sp = COPY $x0
461 ; CHECK: [[LDRHui:%[0-9]+]]:fpr16 = LDRHui [[COPY]], 32 :: (load 2 from %ir.addr)
462 ; CHECK: $h0 = COPY [[LDRHui]]
464 %1(s64) = G_CONSTANT i64 64
465 %2(p0) = G_GEP %0, %1
466 %3(s16) = G_LOAD %2 :: (load 2 from %ir.addr)
471 name: load_gep_32_s8_fpr
473 regBankSelected: true
476 - { id: 0, class: gpr }
477 - { id: 1, class: gpr }
478 - { id: 2, class: gpr }
479 - { id: 3, class: fpr }
485 ; CHECK-LABEL: name: load_gep_32_s8_fpr
486 ; CHECK: [[COPY:%[0-9]+]]:gpr64sp = COPY $x0
487 ; CHECK: [[LDRBui:%[0-9]+]]:fpr8 = LDRBui [[COPY]], 32 :: (load 1 from %ir.addr)
488 ; CHECK: $b0 = COPY [[LDRBui]]
490 %1(s64) = G_CONSTANT i64 32
491 %2(p0) = G_GEP %0, %1
492 %3(s8) = G_LOAD %2 :: (load 1 from %ir.addr)
498 regBankSelected: true
501 - { id: 0, class: gpr }
502 - { id: 1, class: fpr }
508 ; CHECK-LABEL: name: load_v2s32
509 ; CHECK: [[COPY:%[0-9]+]]:gpr64sp = COPY $x0
510 ; CHECK: [[LDRDui:%[0-9]+]]:fpr64 = LDRDui [[COPY]], 0 :: (load 8 from %ir.addr)
511 ; CHECK: $d0 = COPY [[LDRDui]]
513 %1(<2 x s32>) = G_LOAD %0 :: (load 8 from %ir.addr)
514 $d0 = COPY %1(<2 x s32>)
519 regBankSelected: true
522 - { id: 0, class: gpr }
523 - { id: 1, class: fpr }
529 ; CHECK-LABEL: name: load_v2s64
530 ; CHECK: [[COPY:%[0-9]+]]:gpr64sp = COPY $x0
531 ; CHECK: [[LDRQui:%[0-9]+]]:fpr128 = LDRQui [[COPY]], 0 :: (load 16 from %ir.addr)
532 ; CHECK: $q0 = COPY [[LDRQui]]
534 %1(<2 x s64>) = G_LOAD %0 :: (load 16 from %ir.addr)
535 $q0 = COPY %1(<2 x s64>)
541 regBankSelected: true
542 tracksRegLiveness: true
544 - { id: 0, class: gpr }
545 - { id: 1, class: fpr }
546 machineFunctionInfo: {}
551 ; CHECK-LABEL: name: load_4xi16
552 ; CHECK: liveins: $x0
553 ; CHECK: [[COPY:%[0-9]+]]:gpr64sp = COPY $x0
554 ; CHECK: [[LDRDui:%[0-9]+]]:fpr64 = LDRDui [[COPY]], 0 :: (load 8 from %ir.ptr)
555 ; CHECK: $d0 = COPY [[LDRDui]]
556 ; CHECK: RET_ReallyLR implicit $d0
557 %0:gpr(p0) = COPY $x0
558 %1:fpr(<4 x s16>) = G_LOAD %0(p0) :: (load 8 from %ir.ptr)
559 $d0 = COPY %1(<4 x s16>)
560 RET_ReallyLR implicit $d0
567 regBankSelected: true
568 tracksRegLiveness: true
570 - { id: 0, class: gpr }
571 - { id: 1, class: fpr }
572 machineFunctionInfo: {}
577 ; CHECK-LABEL: name: load_4xi32
578 ; CHECK: liveins: $x0
579 ; CHECK: [[COPY:%[0-9]+]]:gpr64sp = COPY $x0
580 ; CHECK: [[LDRQui:%[0-9]+]]:fpr128 = LDRQui [[COPY]], 0 :: (load 16 from %ir.ptr)
581 ; CHECK: $q0 = COPY [[LDRQui]]
582 ; CHECK: RET_ReallyLR implicit $q0
583 %0:gpr(p0) = COPY $x0
584 %1:fpr(<4 x s32>) = G_LOAD %0(p0) :: (load 16 from %ir.ptr)
585 $q0 = COPY %1(<4 x s32>)
586 RET_ReallyLR implicit $q0
593 regBankSelected: true
594 tracksRegLiveness: true
596 - { id: 0, class: gpr }
597 - { id: 1, class: fpr }
598 machineFunctionInfo: {}
603 ; CHECK-LABEL: name: load_8xi16
604 ; CHECK: liveins: $x0
605 ; CHECK: [[COPY:%[0-9]+]]:gpr64sp = COPY $x0
606 ; CHECK: [[LDRQui:%[0-9]+]]:fpr128 = LDRQui [[COPY]], 0 :: (load 16 from %ir.ptr)
607 ; CHECK: $q0 = COPY [[LDRQui]]
608 ; CHECK: RET_ReallyLR implicit $q0
609 %0:gpr(p0) = COPY $x0
610 %1:fpr(<8 x s16>) = G_LOAD %0(p0) :: (load 16 from %ir.ptr)
611 $q0 = COPY %1(<8 x s16>)
612 RET_ReallyLR implicit $q0
619 regBankSelected: true
620 tracksRegLiveness: true
622 - { id: 0, class: gpr }
623 - { id: 1, class: fpr }
624 machineFunctionInfo: {}
629 ; CHECK-LABEL: name: load_16xi8
630 ; CHECK: liveins: $x0
631 ; CHECK: [[COPY:%[0-9]+]]:gpr64sp = COPY $x0
632 ; CHECK: [[LDRQui:%[0-9]+]]:fpr128 = LDRQui [[COPY]], 0 :: (load 16 from %ir.ptr)
633 ; CHECK: $q0 = COPY [[LDRQui]]
634 ; CHECK: RET_ReallyLR implicit $q0
635 %0:gpr(p0) = COPY $x0
636 %1:fpr(<16 x s8>) = G_LOAD %0(p0) :: (load 16 from %ir.ptr)
637 $q0 = COPY %1(<16 x s8>)
638 RET_ReallyLR implicit $q0