1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -mtriple=aarch64-- -run-pass=instruction-select -verify-machineinstrs -global-isel-abort=1 %s -o - | FileCheck %s
5 target datalayout = "e-m:o-i64:64-i128:128-n32:64-S128"
7 define void @store_s64_gpr(i64* %addr) { ret void }
8 define void @store_s32_gpr(i32* %addr) { ret void }
9 define void @store_s16_gpr(i16* %addr) { ret void }
10 define void @store_s8_gpr(i8* %addr) { ret void }
12 define void @store_zero_s64_gpr(i64* %addr) { ret void }
13 define void @store_zero_s32_gpr(i32* %addr) { ret void }
14 define void @store_zero_s16(i32* %addr) { ret void }
15 define void @store_zero_s8(i32* %addr) { ret void }
16 define void @store_zero_look_through_cst(i32* %addr) { ret void }
18 define void @store_fi_s64_gpr() {
23 define void @store_gep_128_s64_gpr(i64* %addr) { ret void }
24 define void @store_gep_512_s32_gpr(i32* %addr) { ret void }
25 define void @store_gep_64_s16_gpr(i16* %addr) { ret void }
26 define void @store_gep_1_s8_gpr(i8* %addr) { ret void }
28 define void @store_s64_fpr(i64* %addr) { ret void }
29 define void @store_s32_fpr(i32* %addr) { ret void }
31 define void @store_gep_8_s64_fpr(i64* %addr) { ret void }
32 define void @store_gep_8_s32_fpr(i32* %addr) { ret void }
34 define void @store_v2s32(i64 *%addr) { ret void }
35 define void @store_v2s64(i64 *%addr) { ret void }
37 define void @store_4xi16(<4 x i16> %v, <4 x i16>* %ptr) { ret void }
38 define void @store_4xi32(<4 x i32> %v, <4 x i32>* %ptr) { ret void }
39 define void @store_8xi16(<8 x i16> %v, <8 x i16>* %ptr) { ret void }
40 define void @store_16xi8(<16 x i8> %v, <16 x i8>* %ptr) { ret void }
42 @x = external hidden local_unnamed_addr global i32*, align 8
43 define void @store_adrp_add_low() { ret void }
44 define void @store_adrp_add_low_foldable_offset() { ret void }
45 define void @store_adrp_add_low_unfoldable_offset() { ret void }
47 define void @truncstores(i8* %addr) { ret void }
56 - { id: 0, class: gpr }
57 - { id: 1, class: gpr }
63 ; CHECK-LABEL: name: store_s64_gpr
64 ; CHECK: [[COPY:%[0-9]+]]:gpr64sp = COPY $x0
65 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:gpr64 = COPY $x1
66 ; CHECK-NEXT: STRXui [[COPY1]], [[COPY]], 0 :: (store (s64) into %ir.addr)
69 G_STORE %1, %0 :: (store (s64) into %ir.addr)
79 - { id: 0, class: gpr }
80 - { id: 1, class: gpr }
86 ; CHECK-LABEL: name: store_s32_gpr
87 ; CHECK: [[COPY:%[0-9]+]]:gpr64sp = COPY $x0
88 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:gpr32 = COPY $w1
89 ; CHECK-NEXT: STRWui [[COPY1]], [[COPY]], 0 :: (store (s32) into %ir.addr)
92 G_STORE %1, %0 :: (store (s32) into %ir.addr)
102 - { id: 0, class: gpr }
103 - { id: 1, class: gpr }
109 ; CHECK-LABEL: name: store_s16_gpr
110 ; CHECK: [[COPY:%[0-9]+]]:gpr64sp = COPY $x0
111 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:gpr32 = COPY $w1
112 ; CHECK-NEXT: STRHHui [[COPY1]], [[COPY]], 0 :: (store (s16) into %ir.addr)
114 %2:gpr(s32) = COPY $w1
116 G_STORE %1, %0 :: (store (s16) into %ir.addr)
123 regBankSelected: true
126 - { id: 0, class: gpr }
127 - { id: 1, class: gpr }
133 ; CHECK-LABEL: name: store_s8_gpr
134 ; CHECK: [[COPY:%[0-9]+]]:gpr64sp = COPY $x0
135 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:gpr32 = COPY $w1
136 ; CHECK-NEXT: STRBBui [[COPY1]], [[COPY]], 0 :: (store (s8) into %ir.addr)
138 %2:gpr(s32) = COPY $w1
140 G_STORE %1, %0 :: (store (s8) into %ir.addr)
145 name: store_zero_s64_gpr
147 regBankSelected: true
150 - { id: 0, class: gpr }
151 - { id: 1, class: gpr }
157 ; CHECK-LABEL: name: store_zero_s64_gpr
158 ; CHECK: [[COPY:%[0-9]+]]:gpr64sp = COPY $x0
159 ; CHECK-NEXT: STRXui $xzr, [[COPY]], 0 :: (store (s64) into %ir.addr)
161 %1(s64) = G_CONSTANT i64 0
162 G_STORE %1, %0 :: (store (s64) into %ir.addr)
167 name: store_zero_s32_gpr
169 regBankSelected: true
172 - { id: 0, class: gpr }
173 - { id: 1, class: gpr }
179 ; CHECK-LABEL: name: store_zero_s32_gpr
180 ; CHECK: [[COPY:%[0-9]+]]:gpr64sp = COPY $x0
181 ; CHECK-NEXT: STRWui $wzr, [[COPY]], 0 :: (store (s32) into %ir.addr)
183 %1(s32) = G_CONSTANT i32 0
184 G_STORE %1, %0 :: (store (s32) into %ir.addr)
191 regBankSelected: true
195 ; CHECK-LABEL: name: store_zero_s16
196 ; CHECK: [[COPY:%[0-9]+]]:gpr64sp = COPY $x0
197 ; CHECK-NEXT: STRHHui $wzr, [[COPY]], 0 :: (store (s16))
198 %0:gpr(p0) = COPY $x0
199 %1:gpr(s16) = G_CONSTANT i16 0
200 G_STORE %1(s16), %0(p0) :: (store (s16))
207 regBankSelected: true
211 ; CHECK-LABEL: name: store_zero_s8
212 ; CHECK: [[COPY:%[0-9]+]]:gpr64sp = COPY $x0
213 ; CHECK-NEXT: STRBBui $wzr, [[COPY]], 0 :: (store (s8))
214 %0:gpr(p0) = COPY $x0
215 %1:gpr(s8) = G_CONSTANT i8 0
216 G_STORE %1(s8), %0(p0) :: (store (s8))
220 name: store_zero_look_through_cst
222 regBankSelected: true
226 ; CHECK-LABEL: name: store_zero_look_through_cst
227 ; CHECK: [[COPY:%[0-9]+]]:gpr64sp = COPY $x0
228 ; CHECK-NEXT: STRXui $xzr, [[COPY]], 0 :: (store (s64) into %ir.addr)
229 %0:gpr(p0) = COPY $x0
230 %1:gpr(s32) = G_CONSTANT i32 0
231 %2:gpr(s64) = G_ZEXT %1
232 G_STORE %2, %0 :: (store (s64) into %ir.addr)
236 name: store_fi_s64_gpr
238 regBankSelected: true
241 - { id: 0, class: gpr }
242 - { id: 1, class: gpr }
245 - { id: 0, name: ptr0, offset: 0, size: 8, alignment: 8 }
251 ; CHECK-LABEL: name: store_fi_s64_gpr
252 ; CHECK: [[COPY:%[0-9]+]]:gpr64all = COPY $x0
253 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:gpr64 = COPY [[COPY]]
254 ; CHECK-NEXT: STRXui [[COPY1]], %stack.0.ptr0, 0 :: (store (p0))
256 %1(p0) = G_FRAME_INDEX %stack.0.ptr0
257 G_STORE %0, %1 :: (store (p0))
261 name: store_gep_128_s64_gpr
263 regBankSelected: true
266 - { id: 0, class: gpr }
267 - { id: 1, class: gpr }
268 - { id: 2, class: gpr }
269 - { id: 3, class: gpr }
275 ; CHECK-LABEL: name: store_gep_128_s64_gpr
276 ; CHECK: [[COPY:%[0-9]+]]:gpr64sp = COPY $x0
277 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:gpr64 = COPY $x1
278 ; CHECK-NEXT: STRXui [[COPY1]], [[COPY]], 16 :: (store (s64) into %ir.addr)
281 %2(s64) = G_CONSTANT i64 128
282 %3(p0) = G_PTR_ADD %0, %2
283 G_STORE %1, %3 :: (store (s64) into %ir.addr)
287 name: store_gep_512_s32_gpr
289 regBankSelected: true
292 - { id: 0, class: gpr }
293 - { id: 1, class: gpr }
294 - { id: 2, class: gpr }
295 - { id: 3, class: gpr }
301 ; CHECK-LABEL: name: store_gep_512_s32_gpr
302 ; CHECK: [[COPY:%[0-9]+]]:gpr64sp = COPY $x0
303 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:gpr32 = COPY $w1
304 ; CHECK-NEXT: STRWui [[COPY1]], [[COPY]], 128 :: (store (s32) into %ir.addr)
307 %2(s64) = G_CONSTANT i64 512
308 %3(p0) = G_PTR_ADD %0, %2
309 G_STORE %1, %3 :: (store (s32) into %ir.addr)
313 name: store_gep_64_s16_gpr
315 regBankSelected: true
318 - { id: 0, class: gpr }
319 - { id: 1, class: gpr }
320 - { id: 2, class: gpr }
321 - { id: 3, class: gpr }
327 ; CHECK-LABEL: name: store_gep_64_s16_gpr
328 ; CHECK: [[COPY:%[0-9]+]]:gpr64sp = COPY $x0
329 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:gpr32 = COPY $w1
330 ; CHECK-NEXT: STRHHui [[COPY1]], [[COPY]], 32 :: (store (s16) into %ir.addr)
332 %4:gpr(s32) = COPY $w1
334 %2(s64) = G_CONSTANT i64 64
335 %3(p0) = G_PTR_ADD %0, %2
336 G_STORE %1, %3 :: (store (s16) into %ir.addr)
340 name: store_gep_1_s8_gpr
342 regBankSelected: true
345 - { id: 0, class: gpr }
346 - { id: 1, class: gpr }
347 - { id: 2, class: gpr }
348 - { id: 3, class: gpr }
354 ; CHECK-LABEL: name: store_gep_1_s8_gpr
355 ; CHECK: [[COPY:%[0-9]+]]:gpr64sp = COPY $x0
356 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:gpr32 = COPY $w1
357 ; CHECK-NEXT: STRBBui [[COPY1]], [[COPY]], 1 :: (store (s8) into %ir.addr)
359 %4:gpr(s32) = COPY $w1
361 %2(s64) = G_CONSTANT i64 1
362 %3(p0) = G_PTR_ADD %0, %2
363 G_STORE %1, %3 :: (store (s8) into %ir.addr)
369 regBankSelected: true
372 - { id: 0, class: gpr }
373 - { id: 1, class: fpr }
379 ; CHECK-LABEL: name: store_s64_fpr
380 ; CHECK: [[COPY:%[0-9]+]]:gpr64sp = COPY $x0
381 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:fpr64 = COPY $d1
382 ; CHECK-NEXT: STRDui [[COPY1]], [[COPY]], 0 :: (store (s64) into %ir.addr)
385 G_STORE %1, %0 :: (store (s64) into %ir.addr)
392 regBankSelected: true
395 - { id: 0, class: gpr }
396 - { id: 1, class: fpr }
402 ; CHECK-LABEL: name: store_s32_fpr
403 ; CHECK: [[COPY:%[0-9]+]]:gpr64sp = COPY $x0
404 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:fpr32 = COPY $s1
405 ; CHECK-NEXT: STRSui [[COPY1]], [[COPY]], 0 :: (store (s32) into %ir.addr)
408 G_STORE %1, %0 :: (store (s32) into %ir.addr)
413 name: store_gep_8_s64_fpr
415 regBankSelected: true
418 - { id: 0, class: gpr }
419 - { id: 1, class: fpr }
420 - { id: 2, class: gpr }
421 - { id: 3, class: gpr }
427 ; CHECK-LABEL: name: store_gep_8_s64_fpr
428 ; CHECK: [[COPY:%[0-9]+]]:gpr64sp = COPY $x0
429 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:fpr64 = COPY $d1
430 ; CHECK-NEXT: STRDui [[COPY1]], [[COPY]], 1 :: (store (s64) into %ir.addr)
433 %2(s64) = G_CONSTANT i64 8
434 %3(p0) = G_PTR_ADD %0, %2
435 G_STORE %1, %3 :: (store (s64) into %ir.addr)
439 name: store_gep_8_s32_fpr
441 regBankSelected: true
444 - { id: 0, class: gpr }
445 - { id: 1, class: fpr }
446 - { id: 2, class: gpr }
447 - { id: 3, class: gpr }
453 ; CHECK-LABEL: name: store_gep_8_s32_fpr
454 ; CHECK: [[COPY:%[0-9]+]]:gpr64sp = COPY $x0
455 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:fpr32 = COPY $s1
456 ; CHECK-NEXT: STRSui [[COPY1]], [[COPY]], 2 :: (store (s32) into %ir.addr)
459 %2(s64) = G_CONSTANT i64 8
460 %3(p0) = G_PTR_ADD %0, %2
461 G_STORE %1, %3 :: (store (s32) into %ir.addr)
466 regBankSelected: true
469 - { id: 0, class: gpr }
470 - { id: 1, class: fpr }
476 ; CHECK-LABEL: name: store_v2s32
477 ; CHECK: [[COPY:%[0-9]+]]:gpr64sp = COPY $x0
478 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:fpr64 = COPY $d1
479 ; CHECK-NEXT: STRDui [[COPY1]], [[COPY]], 0 :: (store (<2 x s32>) into %ir.addr)
481 %1(<2 x s32>) = COPY $d1
482 G_STORE %1, %0 :: (store (<2 x s32>) into %ir.addr)
488 regBankSelected: true
491 - { id: 0, class: gpr }
492 - { id: 1, class: fpr }
497 ; CHECK-LABEL: name: store_v2s64
498 ; CHECK: [[COPY:%[0-9]+]]:gpr64sp = COPY $x0
499 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:fpr128 = COPY $q1
500 ; CHECK-NEXT: STRQui [[COPY1]], [[COPY]], 0 :: (store (<2 x s64>) into %ir.addr, align 8)
502 %1(<2 x s64>) = COPY $q1
503 G_STORE %1, %0 :: (store (<2 x s64>) into %ir.addr, align 8)
510 regBankSelected: true
511 tracksRegLiveness: true
513 - { id: 0, class: fpr }
514 - { id: 1, class: gpr }
515 machineFunctionInfo: {}
520 ; CHECK-LABEL: name: store_4xi16
521 ; CHECK: liveins: $d0, $x0
523 ; CHECK-NEXT: [[COPY:%[0-9]+]]:fpr64 = COPY $d0
524 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:gpr64sp = COPY $x0
525 ; CHECK-NEXT: STRDui [[COPY]], [[COPY1]], 0 :: (store (<4 x s16>) into %ir.ptr)
526 ; CHECK-NEXT: RET_ReallyLR
527 %0:fpr(<4 x s16>) = COPY $d0
528 %1:gpr(p0) = COPY $x0
529 G_STORE %0(<4 x s16>), %1(p0) :: (store (<4 x s16>) into %ir.ptr)
537 regBankSelected: true
538 tracksRegLiveness: true
540 - { id: 0, class: fpr }
541 - { id: 1, class: gpr }
542 machineFunctionInfo: {}
547 ; CHECK-LABEL: name: store_4xi32
548 ; CHECK: liveins: $q0, $x0
550 ; CHECK-NEXT: [[COPY:%[0-9]+]]:fpr128 = COPY $q0
551 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:gpr64sp = COPY $x0
552 ; CHECK-NEXT: STRQui [[COPY]], [[COPY1]], 0 :: (store (<4 x s32>) into %ir.ptr)
553 ; CHECK-NEXT: RET_ReallyLR
554 %0:fpr(<4 x s32>) = COPY $q0
555 %1:gpr(p0) = COPY $x0
556 G_STORE %0(<4 x s32>), %1(p0) :: (store (<4 x s32>) into %ir.ptr)
564 regBankSelected: true
565 tracksRegLiveness: true
567 - { id: 0, class: fpr }
568 - { id: 1, class: gpr }
569 machineFunctionInfo: {}
574 ; CHECK-LABEL: name: store_8xi16
575 ; CHECK: liveins: $q0, $x0
577 ; CHECK-NEXT: [[COPY:%[0-9]+]]:fpr128 = COPY $q0
578 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:gpr64sp = COPY $x0
579 ; CHECK-NEXT: STRQui [[COPY]], [[COPY1]], 0 :: (store (<8 x s16>) into %ir.ptr)
580 ; CHECK-NEXT: RET_ReallyLR
581 %0:fpr(<8 x s16>) = COPY $q0
582 %1:gpr(p0) = COPY $x0
583 G_STORE %0(<8 x s16>), %1(p0) :: (store (<8 x s16>) into %ir.ptr)
591 regBankSelected: true
592 tracksRegLiveness: true
594 - { id: 0, class: fpr }
595 - { id: 1, class: gpr }
596 machineFunctionInfo: {}
601 ; CHECK-LABEL: name: store_16xi8
602 ; CHECK: liveins: $q0, $x0
604 ; CHECK-NEXT: [[COPY:%[0-9]+]]:fpr128 = COPY $q0
605 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:gpr64sp = COPY $x0
606 ; CHECK-NEXT: STRQui [[COPY]], [[COPY1]], 0 :: (store (<16 x s8>) into %ir.ptr)
607 ; CHECK-NEXT: RET_ReallyLR
608 %0:fpr(<16 x s8>) = COPY $q0
609 %1:gpr(p0) = COPY $x0
610 G_STORE %0(<16 x s8>), %1(p0) :: (store (<16 x s8>) into %ir.ptr)
615 name: store_adrp_add_low
617 regBankSelected: true
618 tracksRegLiveness: true
622 ; CHECK-LABEL: name: store_adrp_add_low
623 ; CHECK: liveins: $x0
625 ; CHECK-NEXT: %copy:gpr64all = COPY $x0
626 ; CHECK-NEXT: %adrp:gpr64common = ADRP target-flags(aarch64-page) @x
627 ; CHECK-NEXT: [[COPY:%[0-9]+]]:gpr64 = COPY %copy
628 ; CHECK-NEXT: STRXui [[COPY]], %adrp, target-flags(aarch64-pageoff, aarch64-nc) @x :: (store (p0) into @x)
629 %copy:gpr(p0) = COPY $x0
630 %adrp:gpr64(p0) = ADRP target-flags(aarch64-page) @x
631 %add_low:gpr(p0) = G_ADD_LOW %adrp(p0), target-flags(aarch64-pageoff, aarch64-nc) @x
632 G_STORE %copy(p0), %add_low(p0) :: (store (p0) into @x)
636 name: store_adrp_add_low_foldable_offset
638 regBankSelected: true
639 tracksRegLiveness: true
643 ; CHECK-LABEL: name: store_adrp_add_low_foldable_offset
644 ; CHECK: liveins: $x0
646 ; CHECK-NEXT: %copy:gpr64all = COPY $x0
647 ; CHECK-NEXT: %adrp:gpr64common = ADRP target-flags(aarch64-page) @x + 8
648 ; CHECK-NEXT: [[COPY:%[0-9]+]]:gpr64 = COPY %copy
649 ; CHECK-NEXT: STRXui [[COPY]], %adrp, target-flags(aarch64-pageoff, aarch64-nc) @x + 8 :: (store (p0) into @x)
650 %copy:gpr(p0) = COPY $x0
651 %adrp:gpr64(p0) = ADRP target-flags(aarch64-page) @x + 8
652 %add_low:gpr(p0) = G_ADD_LOW %adrp(p0), target-flags(aarch64-pageoff, aarch64-nc) @x + 8
653 G_STORE %copy(p0), %add_low(p0) :: (store (p0) into @x)
657 name: store_adrp_add_low_unfoldable_offset
659 regBankSelected: true
660 tracksRegLiveness: true
664 ; CHECK-LABEL: name: store_adrp_add_low_unfoldable_offset
665 ; CHECK: liveins: $x0
667 ; CHECK-NEXT: %copy:gpr64all = COPY $x0
668 ; CHECK-NEXT: %add_low:gpr64common = MOVaddr target-flags(aarch64-page) @x + 3, target-flags(aarch64-pageoff, aarch64-nc) @x + 3
669 ; CHECK-NEXT: [[COPY:%[0-9]+]]:gpr64 = COPY %copy
670 ; CHECK-NEXT: STRXui [[COPY]], %add_low, 0 :: (store (p0) into @x)
671 %copy:gpr(p0) = COPY $x0
672 %adrp:gpr64(p0) = ADRP target-flags(aarch64-page) @x + 3
673 %add_low:gpr(p0) = G_ADD_LOW %adrp(p0), target-flags(aarch64-pageoff, aarch64-nc) @x + 3
674 G_STORE %copy(p0), %add_low(p0) :: (store (p0) into @x)
680 regBankSelected: true
683 liveins: $x0, $w1, $x2
685 ; CHECK-LABEL: name: truncstores
686 ; CHECK: [[COPY:%[0-9]+]]:gpr64sp = COPY $x0
687 ; CHECK-NEXT: %val32:gpr32 = COPY $w1
688 ; CHECK-NEXT: %val64:gpr64 = COPY $x2
689 ; CHECK-NEXT: STRBBui %val32, [[COPY]], 0 :: (store (s8))
690 ; CHECK-NEXT: STRBBui %val32, [[COPY]], 43 :: (store (s8))
691 ; CHECK-NEXT: STRHHui %val32, [[COPY]], 0 :: (store (s16))
692 ; CHECK-NEXT: STURHHi %val32, [[COPY]], 43 :: (store (s16))
693 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:gpr32 = COPY %val64.sub_32
694 ; CHECK-NEXT: STRHHui [[COPY1]], [[COPY]], 0 :: (store (s16))
695 ; CHECK-NEXT: [[COPY2:%[0-9]+]]:gpr32 = COPY %val64.sub_32
696 ; CHECK-NEXT: STURHHi [[COPY2]], [[COPY]], 43 :: (store (s16))
697 ; CHECK-NEXT: [[COPY3:%[0-9]+]]:gpr32 = COPY %val64.sub_32
698 ; CHECK-NEXT: STRWui [[COPY3]], [[COPY]], 0 :: (store (s32))
699 ; CHECK-NEXT: [[COPY4:%[0-9]+]]:gpr32 = COPY %val64.sub_32
700 ; CHECK-NEXT: STURWi [[COPY4]], [[COPY]], 43 :: (store (s32))
701 %0:gpr(p0) = COPY $x0
702 %val32:gpr(s32) = COPY $w1
703 %val64:gpr(s64) = COPY $x2
704 G_STORE %val32, %0 :: (store (s8))
706 %cst:gpr(s64) = G_CONSTANT i64 43
707 %newptr:gpr(p0) = G_PTR_ADD %0, %cst
708 G_STORE %val32, %newptr :: (store (s8))
710 G_STORE %val32, %0 :: (store (s16))
712 G_STORE %val32, %newptr :: (store (s16))
714 G_STORE %val64, %0 :: (store (s16))
716 G_STORE %val64, %newptr :: (store (s16))
718 G_STORE %val64, %0 :: (store (s32))
720 G_STORE %val64, %newptr :: (store (s32))