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: [[COPY1:%[0-9]+]]:gpr64 = COPY $x1
66 ; CHECK: 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: [[COPY1:%[0-9]+]]:gpr32 = COPY $w1
89 ; CHECK: 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: [[COPY1:%[0-9]+]]:gpr32 = COPY $w1
112 ; CHECK: 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: [[COPY1:%[0-9]+]]:gpr32 = COPY $w1
136 ; CHECK: 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: 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: 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: 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: 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: 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: [[COPY1:%[0-9]+]]:gpr64 = COPY [[COPY]]
254 ; CHECK: 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: [[COPY1:%[0-9]+]]:gpr64 = COPY $x1
278 ; CHECK: 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: [[COPY1:%[0-9]+]]:gpr32 = COPY $w1
304 ; CHECK: 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: [[COPY1:%[0-9]+]]:gpr32 = COPY $w1
330 ; CHECK: 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: [[COPY1:%[0-9]+]]:gpr32 = COPY $w1
357 ; CHECK: 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: [[COPY1:%[0-9]+]]:fpr64 = COPY $d1
382 ; CHECK: 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: [[COPY1:%[0-9]+]]:fpr32 = COPY $s1
405 ; CHECK: 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: [[COPY1:%[0-9]+]]:fpr64 = COPY $d1
430 ; CHECK: 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: [[COPY1:%[0-9]+]]:fpr32 = COPY $s1
456 ; CHECK: 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: [[COPY1:%[0-9]+]]:fpr64 = COPY $d1
479 ; CHECK: 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: [[COPY1:%[0-9]+]]:fpr128 = COPY $q1
500 ; CHECK: 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
522 ; CHECK: [[COPY:%[0-9]+]]:fpr64 = COPY $d0
523 ; CHECK: [[COPY1:%[0-9]+]]:gpr64sp = COPY $x0
524 ; CHECK: STRDui [[COPY]], [[COPY1]], 0 :: (store (<4 x s16>) into %ir.ptr)
525 ; CHECK: RET_ReallyLR
526 %0:fpr(<4 x s16>) = COPY $d0
527 %1:gpr(p0) = COPY $x0
528 G_STORE %0(<4 x s16>), %1(p0) :: (store (<4 x s16>) into %ir.ptr)
536 regBankSelected: true
537 tracksRegLiveness: true
539 - { id: 0, class: fpr }
540 - { id: 1, class: gpr }
541 machineFunctionInfo: {}
546 ; CHECK-LABEL: name: store_4xi32
547 ; CHECK: liveins: $q0, $x0
548 ; CHECK: [[COPY:%[0-9]+]]:fpr128 = COPY $q0
549 ; CHECK: [[COPY1:%[0-9]+]]:gpr64sp = COPY $x0
550 ; CHECK: STRQui [[COPY]], [[COPY1]], 0 :: (store (<4 x s32>) into %ir.ptr)
551 ; CHECK: RET_ReallyLR
552 %0:fpr(<4 x s32>) = COPY $q0
553 %1:gpr(p0) = COPY $x0
554 G_STORE %0(<4 x s32>), %1(p0) :: (store (<4 x s32>) into %ir.ptr)
562 regBankSelected: true
563 tracksRegLiveness: true
565 - { id: 0, class: fpr }
566 - { id: 1, class: gpr }
567 machineFunctionInfo: {}
572 ; CHECK-LABEL: name: store_8xi16
573 ; CHECK: liveins: $q0, $x0
574 ; CHECK: [[COPY:%[0-9]+]]:fpr128 = COPY $q0
575 ; CHECK: [[COPY1:%[0-9]+]]:gpr64sp = COPY $x0
576 ; CHECK: STRQui [[COPY]], [[COPY1]], 0 :: (store (<8 x s16>) into %ir.ptr)
577 ; CHECK: RET_ReallyLR
578 %0:fpr(<8 x s16>) = COPY $q0
579 %1:gpr(p0) = COPY $x0
580 G_STORE %0(<8 x s16>), %1(p0) :: (store (<8 x s16>) into %ir.ptr)
588 regBankSelected: true
589 tracksRegLiveness: true
591 - { id: 0, class: fpr }
592 - { id: 1, class: gpr }
593 machineFunctionInfo: {}
598 ; CHECK-LABEL: name: store_16xi8
599 ; CHECK: liveins: $q0, $x0
600 ; CHECK: [[COPY:%[0-9]+]]:fpr128 = COPY $q0
601 ; CHECK: [[COPY1:%[0-9]+]]:gpr64sp = COPY $x0
602 ; CHECK: STRQui [[COPY]], [[COPY1]], 0 :: (store (<16 x s8>) into %ir.ptr)
603 ; CHECK: RET_ReallyLR
604 %0:fpr(<16 x s8>) = COPY $q0
605 %1:gpr(p0) = COPY $x0
606 G_STORE %0(<16 x s8>), %1(p0) :: (store (<16 x s8>) into %ir.ptr)
611 name: store_adrp_add_low
613 regBankSelected: true
614 tracksRegLiveness: true
618 ; CHECK-LABEL: name: store_adrp_add_low
619 ; CHECK: liveins: $x0
620 ; CHECK: %copy:gpr64all = COPY $x0
621 ; CHECK: %adrp:gpr64common = ADRP target-flags(aarch64-page) @x
622 ; CHECK: [[COPY:%[0-9]+]]:gpr64 = COPY %copy
623 ; CHECK: STRXui [[COPY]], %adrp, target-flags(aarch64-pageoff, aarch64-nc) @x :: (store (p0) into @x)
624 %copy:gpr(p0) = COPY $x0
625 %adrp:gpr64(p0) = ADRP target-flags(aarch64-page) @x
626 %add_low:gpr(p0) = G_ADD_LOW %adrp(p0), target-flags(aarch64-pageoff, aarch64-nc) @x
627 G_STORE %copy(p0), %add_low(p0) :: (store (p0) into @x)
631 name: store_adrp_add_low_foldable_offset
633 regBankSelected: true
634 tracksRegLiveness: true
638 ; CHECK-LABEL: name: store_adrp_add_low_foldable_offset
639 ; CHECK: liveins: $x0
640 ; CHECK: %copy:gpr64all = COPY $x0
641 ; CHECK: %adrp:gpr64common = ADRP target-flags(aarch64-page) @x + 8
642 ; CHECK: [[COPY:%[0-9]+]]:gpr64 = COPY %copy
643 ; CHECK: STRXui [[COPY]], %adrp, target-flags(aarch64-pageoff, aarch64-nc) @x + 8 :: (store (p0) into @x)
644 %copy:gpr(p0) = COPY $x0
645 %adrp:gpr64(p0) = ADRP target-flags(aarch64-page) @x + 8
646 %add_low:gpr(p0) = G_ADD_LOW %adrp(p0), target-flags(aarch64-pageoff, aarch64-nc) @x + 8
647 G_STORE %copy(p0), %add_low(p0) :: (store (p0) into @x)
651 name: store_adrp_add_low_unfoldable_offset
653 regBankSelected: true
654 tracksRegLiveness: true
658 ; CHECK-LABEL: name: store_adrp_add_low_unfoldable_offset
659 ; CHECK: liveins: $x0
660 ; CHECK: %copy:gpr64all = COPY $x0
661 ; CHECK: %add_low:gpr64common = MOVaddr target-flags(aarch64-page) @x + 3, target-flags(aarch64-pageoff, aarch64-nc) @x + 3
662 ; CHECK: [[COPY:%[0-9]+]]:gpr64 = COPY %copy
663 ; CHECK: STRXui [[COPY]], %add_low, 0 :: (store (p0) into @x)
664 %copy:gpr(p0) = COPY $x0
665 %adrp:gpr64(p0) = ADRP target-flags(aarch64-page) @x + 3
666 %add_low:gpr(p0) = G_ADD_LOW %adrp(p0), target-flags(aarch64-pageoff, aarch64-nc) @x + 3
667 G_STORE %copy(p0), %add_low(p0) :: (store (p0) into @x)
673 regBankSelected: true
676 liveins: $x0, $w1, $x2
678 ; CHECK-LABEL: name: truncstores
679 ; CHECK: [[COPY:%[0-9]+]]:gpr64sp = COPY $x0
680 ; CHECK: %val32:gpr32 = COPY $w1
681 ; CHECK: %val64:gpr64 = COPY $x2
682 ; CHECK: STRBBui %val32, [[COPY]], 0 :: (store (s8))
683 ; CHECK: STRBBui %val32, [[COPY]], 43 :: (store (s8))
684 ; CHECK: STRHHui %val32, [[COPY]], 0 :: (store (s16))
685 ; CHECK: STURHHi %val32, [[COPY]], 43 :: (store (s16))
686 ; CHECK: [[COPY1:%[0-9]+]]:gpr32 = COPY %val64.sub_32
687 ; CHECK: STRHHui [[COPY1]], [[COPY]], 0 :: (store (s16))
688 ; CHECK: [[COPY2:%[0-9]+]]:gpr32 = COPY %val64.sub_32
689 ; CHECK: STURHHi [[COPY2]], [[COPY]], 43 :: (store (s16))
690 ; CHECK: [[COPY3:%[0-9]+]]:gpr32 = COPY %val64.sub_32
691 ; CHECK: STRWui [[COPY3]], [[COPY]], 0 :: (store (s32))
692 ; CHECK: [[COPY4:%[0-9]+]]:gpr32 = COPY %val64.sub_32
693 ; CHECK: STURWi [[COPY4]], [[COPY]], 43 :: (store (s32))
694 %0:gpr(p0) = COPY $x0
695 %val32:gpr(s32) = COPY $w1
696 %val64:gpr(s64) = COPY $x2
697 G_STORE %val32, %0 :: (store (s8))
699 %cst:gpr(s64) = G_CONSTANT i64 43
700 %newptr:gpr(p0) = G_PTR_ADD %0, %cst
701 G_STORE %val32, %newptr :: (store (s8))
703 G_STORE %val32, %0 :: (store (s16))
705 G_STORE %val32, %newptr :: (store (s16))
707 G_STORE %val64, %0 :: (store (s16))
709 G_STORE %val64, %newptr :: (store (s16))
711 G_STORE %val64, %0 :: (store (s32))
713 G_STORE %val64, %newptr :: (store (s32))