1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -mtriple=aarch64-- -run-pass=loadstore-opt -verify-machineinstrs %s -o - | FileCheck %s
4 target datalayout = "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128"
5 target triple = "aarch64"
7 define void @test_simple_2xs8(i8* %ptr) {
8 %addr11 = bitcast i8* %ptr to i8*
9 store i8 4, i8* %addr11, align 1
10 %addr2 = getelementptr i8, i8* %ptr, i64 1
11 store i8 5, i8* %addr2, align 1
15 define void @test_simple_2xs16(i16* %ptr) {
16 %addr11 = bitcast i16* %ptr to i16*
17 store i16 4, i16* %addr11, align 2
18 %addr2 = getelementptr i16, i16* %ptr, i64 1
19 store i16 5, i16* %addr2, align 2
23 define void @test_simple_4xs16(i16* %ptr) {
24 %addr11 = bitcast i16* %ptr to i16*
25 store i16 4, i16* %addr11, align 2
26 %addr2 = getelementptr i16, i16* %ptr, i64 1
27 store i16 5, i16* %addr2, align 2
28 %addr3 = getelementptr i16, i16* %ptr, i64 2
29 store i16 9, i16* %addr3, align 2
30 %addr4 = getelementptr i16, i16* %ptr, i64 3
31 store i16 14, i16* %addr4, align 2
35 define void @test_simple_2xs32(i32* %ptr) {
36 %addr11 = bitcast i32* %ptr to i32*
37 store i32 4, i32* %addr11, align 4
38 %addr2 = getelementptr i32, i32* %ptr, i64 1
39 store i32 5, i32* %addr2, align 4
43 define void @test_simple_2xs64_illegal(i64* %ptr) {
44 %addr11 = bitcast i64* %ptr to i64*
45 store i64 4, i64* %addr11, align 8
46 %addr2 = getelementptr i64, i64* %ptr, i64 1
47 store i64 5, i64* %addr2, align 8
51 define void @test_simple_vector(<2 x i16>* %ptr) {
52 %addr11 = bitcast <2 x i16>* %ptr to <2 x i16>*
53 store <2 x i16> <i16 4, i16 7>, <2 x i16>* %addr11, align 4
54 %addr2 = getelementptr <2 x i16>, <2 x i16>* %ptr, i64 1
55 store <2 x i16> <i16 5, i16 8>, <2 x i16>* %addr2, align 4
59 define i32 @test_unknown_alias(i32* %ptr, i32* %aliasptr) {
60 %addr11 = bitcast i32* %ptr to i32*
61 store i32 4, i32* %addr11, align 4
62 %ld = load i32, i32* %aliasptr, align 4
63 %addr2 = getelementptr i32, i32* %ptr, i64 1
64 store i32 5, i32* %addr2, align 4
68 define void @test_2x_2xs32(i32* %ptr, i32* %ptr2) {
69 %addr11 = bitcast i32* %ptr to i32*
70 store i32 4, i32* %addr11, align 4
71 %addr2 = getelementptr i32, i32* %ptr, i64 1
72 store i32 5, i32* %addr2, align 4
73 %addr32 = bitcast i32* %ptr2 to i32*
74 store i32 9, i32* %addr32, align 4
75 %addr4 = getelementptr i32, i32* %ptr2, i64 1
76 store i32 17, i32* %addr4, align 4
80 define void @test_simple_var_2xs8(i8* %ptr, i8 %v1, i8 %v2) {
81 %addr11 = bitcast i8* %ptr to i8*
82 store i8 %v1, i8* %addr11, align 1
83 %addr2 = getelementptr i8, i8* %ptr, i64 1
84 store i8 %v2, i8* %addr2, align 1
88 define void @test_simple_var_2xs16(i16* %ptr, i16 %v1, i16 %v2) {
89 %addr11 = bitcast i16* %ptr to i16*
90 store i16 %v1, i16* %addr11, align 2
91 %addr2 = getelementptr i16, i16* %ptr, i64 1
92 store i16 %v2, i16* %addr2, align 2
96 define void @test_simple_var_2xs32(i32* %ptr, i32 %v1, i32 %v2) {
97 %addr11 = bitcast i32* %ptr to i32*
98 store i32 %v1, i32* %addr11, align 4
99 %addr2 = getelementptr i32, i32* %ptr, i64 1
100 store i32 %v2, i32* %addr2, align 4
104 define void @test_alias_4xs16(i16* %ptr, i16* %ptr2) {
105 %addr11 = bitcast i16* %ptr to i16*
106 store i16 4, i16* %addr11, align 2
107 %addr2 = getelementptr i16, i16* %ptr, i64 1
108 store i16 5, i16* %addr2, align 2
109 %addr3 = getelementptr i16, i16* %ptr, i64 2
110 store i16 9, i16* %addr3, align 2
111 store i16 0, i16* %ptr2, align 2
112 %addr4 = getelementptr i16, i16* %ptr, i64 3
113 store i16 14, i16* %addr4, align 2
117 define void @test_alias2_4xs16(i16* %ptr, i16* %ptr2, i16* %ptr3) {
118 %addr11 = bitcast i16* %ptr to i16*
119 store i16 4, i16* %addr11, align 2
120 %addr2 = getelementptr i16, i16* %ptr, i64 1
121 store i16 0, i16* %ptr3, align 2
122 store i16 5, i16* %addr2, align 2
123 %addr3 = getelementptr i16, i16* %ptr, i64 2
124 store i16 9, i16* %addr3, align 2
125 store i16 0, i16* %ptr2, align 2
126 %addr4 = getelementptr i16, i16* %ptr, i64 3
127 store i16 14, i16* %addr4, align 2
131 define void @test_alias3_4xs16(i16* %ptr, i16* %ptr2, i16* %ptr3, i16* %ptr4) {
132 %addr11 = bitcast i16* %ptr to i16*
133 store i16 4, i16* %addr11, align 2
134 %addr2 = getelementptr i16, i16* %ptr, i64 1
135 store i16 0, i16* %ptr3, align 2
136 store i16 5, i16* %addr2, align 2
137 store i16 0, i16* %ptr4, align 2
138 %addr3 = getelementptr i16, i16* %ptr, i64 2
139 store i16 9, i16* %addr3, align 2
140 store i16 0, i16* %ptr2, align 2
141 %addr4 = getelementptr i16, i16* %ptr, i64 3
142 store i16 14, i16* %addr4, align 2
146 define i32 @test_alias_allocas_2xs32(i32* %ptr) {
147 %a1 = alloca [6 x i32], align 4
148 %a2 = alloca i32, align 4
149 %addr11 = bitcast [6 x i32]* %a1 to i32*
150 store i32 4, i32* %addr11, align 4
151 %ld = load i32, i32* %a2, align 4
152 %addr2 = getelementptr [6 x i32], [6 x i32]* %a1, i64 0, i32 1
153 store i32 5, i32* %addr2, align 4
157 define void @test_simple_2xs32_with_align(i32* %ptr) {
158 %addr11 = bitcast i32* %ptr to i32*
159 store i32 4, i32* %addr11, align 4
160 %addr2 = getelementptr i32, i32* %ptr, i64 1
161 store i32 5, i32* %addr2, align 4
167 name: test_simple_2xs8
169 tracksRegLiveness: true
174 machineFunctionInfo: {}
179 ; CHECK-LABEL: name: test_simple_2xs8
180 ; CHECK: liveins: $x0
182 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(p0) = COPY $x0
183 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s8) = G_CONSTANT i8 4
184 ; CHECK-NEXT: [[C1:%[0-9]+]]:_(s8) = G_CONSTANT i8 5
185 ; CHECK-NEXT: G_STORE [[C]](s8), [[COPY]](p0) :: (store (s8) into %ir.addr11)
186 ; CHECK-NEXT: [[C2:%[0-9]+]]:_(s64) = G_CONSTANT i64 1
187 ; CHECK-NEXT: [[PTR_ADD:%[0-9]+]]:_(p0) = G_PTR_ADD [[COPY]], [[C2]](s64)
188 ; CHECK-NEXT: G_STORE [[C1]](s8), [[PTR_ADD]](p0) :: (store (s8) into %ir.addr2)
189 ; CHECK-NEXT: RET_ReallyLR
191 %1:_(s8) = G_CONSTANT i8 4
192 %4:_(s8) = G_CONSTANT i8 5
193 G_STORE %1(s8), %0(p0) :: (store (s8) into %ir.addr11)
194 %2:_(s64) = G_CONSTANT i64 1
195 %3:_(p0) = G_PTR_ADD %0, %2(s64)
196 G_STORE %4(s8), %3(p0) :: (store (s8) into %ir.addr2)
201 name: test_simple_2xs16
203 tracksRegLiveness: true
208 machineFunctionInfo: {}
213 ; CHECK-LABEL: name: test_simple_2xs16
214 ; CHECK: liveins: $x0
216 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(p0) = COPY $x0
217 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 327684
218 ; CHECK-NEXT: G_STORE [[C]](s32), [[COPY]](p0) :: (store (s32) into %ir.addr11, align 2)
219 ; CHECK-NEXT: RET_ReallyLR
221 %1:_(s16) = G_CONSTANT i16 4
222 %4:_(s16) = G_CONSTANT i16 5
223 G_STORE %1(s16), %0(p0) :: (store (s16) into %ir.addr11)
224 %2:_(s64) = G_CONSTANT i64 2
225 %3:_(p0) = G_PTR_ADD %0, %2(s64)
226 G_STORE %4(s16), %3(p0) :: (store (s16) into %ir.addr2)
231 name: test_simple_4xs16
233 tracksRegLiveness: true
238 machineFunctionInfo: {}
243 ; CHECK-LABEL: name: test_simple_4xs16
244 ; CHECK: liveins: $x0
246 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(p0) = COPY $x0
247 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 3940688328982532
248 ; CHECK-NEXT: G_STORE [[C]](s64), [[COPY]](p0) :: (store (s64) into %ir.addr11, align 2)
249 ; CHECK-NEXT: RET_ReallyLR
251 %1:_(s16) = G_CONSTANT i16 4
252 %4:_(s16) = G_CONSTANT i16 5
253 %7:_(s16) = G_CONSTANT i16 9
254 %10:_(s16) = G_CONSTANT i16 14
255 G_STORE %1(s16), %0(p0) :: (store (s16) into %ir.addr11)
256 %2:_(s64) = G_CONSTANT i64 2
257 %3:_(p0) = G_PTR_ADD %0, %2(s64)
258 G_STORE %4(s16), %3(p0) :: (store (s16) into %ir.addr2)
259 %5:_(s64) = G_CONSTANT i64 4
260 %6:_(p0) = G_PTR_ADD %0, %5(s64)
261 G_STORE %7(s16), %6(p0) :: (store (s16) into %ir.addr3)
262 %8:_(s64) = G_CONSTANT i64 6
263 %9:_(p0) = G_PTR_ADD %0, %8(s64)
264 G_STORE %10(s16), %9(p0) :: (store (s16) into %ir.addr4)
269 name: test_simple_2xs32
271 tracksRegLiveness: true
276 machineFunctionInfo: {}
281 ; CHECK-LABEL: name: test_simple_2xs32
282 ; CHECK: liveins: $x0
284 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(p0) = COPY $x0
285 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 21474836484
286 ; CHECK-NEXT: G_STORE [[C]](s64), [[COPY]](p0) :: (store (s64) into %ir.addr11, align 4)
287 ; CHECK-NEXT: RET_ReallyLR
289 %1:_(s32) = G_CONSTANT i32 4
290 %4:_(s32) = G_CONSTANT i32 5
291 G_STORE %1(s32), %0(p0) :: (store (s32) into %ir.addr11)
292 %2:_(s64) = G_CONSTANT i64 4
293 %3:_(p0) = G_PTR_ADD %0, %2(s64)
294 G_STORE %4(s32), %3(p0) :: (store (s32) into %ir.addr2)
299 name: test_simple_2xs64_illegal
301 tracksRegLiveness: true
306 machineFunctionInfo: {}
311 ; CHECK-LABEL: name: test_simple_2xs64_illegal
312 ; CHECK: liveins: $x0
314 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(p0) = COPY $x0
315 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 4
316 ; CHECK-NEXT: [[C1:%[0-9]+]]:_(s64) = G_CONSTANT i64 5
317 ; CHECK-NEXT: G_STORE [[C]](s64), [[COPY]](p0) :: (store (s64) into %ir.addr11)
318 ; CHECK-NEXT: [[C2:%[0-9]+]]:_(s64) = G_CONSTANT i64 8
319 ; CHECK-NEXT: [[PTR_ADD:%[0-9]+]]:_(p0) = G_PTR_ADD [[COPY]], [[C2]](s64)
320 ; CHECK-NEXT: G_STORE [[C1]](s64), [[PTR_ADD]](p0) :: (store (s64) into %ir.addr2)
321 ; CHECK-NEXT: RET_ReallyLR
323 %1:_(s64) = G_CONSTANT i64 4
324 %4:_(s64) = G_CONSTANT i64 5
325 G_STORE %1(s64), %0(p0) :: (store (s64) into %ir.addr11)
326 %2:_(s64) = G_CONSTANT i64 8
327 %3:_(p0) = G_PTR_ADD %0, %2(s64)
328 G_STORE %4(s64), %3(p0) :: (store (s64) into %ir.addr2)
333 name: test_simple_vector
335 tracksRegLiveness: true
340 machineFunctionInfo: {}
345 ; CHECK-LABEL: name: test_simple_vector
346 ; CHECK: liveins: $x0
348 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(p0) = COPY $x0
349 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s16) = G_CONSTANT i16 4
350 ; CHECK-NEXT: [[C1:%[0-9]+]]:_(s16) = G_CONSTANT i16 7
351 ; CHECK-NEXT: [[BUILD_VECTOR:%[0-9]+]]:_(<2 x s16>) = G_BUILD_VECTOR [[C]](s16), [[C1]](s16)
352 ; CHECK-NEXT: [[C2:%[0-9]+]]:_(s16) = G_CONSTANT i16 5
353 ; CHECK-NEXT: [[C3:%[0-9]+]]:_(s16) = G_CONSTANT i16 8
354 ; CHECK-NEXT: [[BUILD_VECTOR1:%[0-9]+]]:_(<2 x s16>) = G_BUILD_VECTOR [[C2]](s16), [[C3]](s16)
355 ; CHECK-NEXT: G_STORE [[BUILD_VECTOR]](<2 x s16>), [[COPY]](p0) :: (store (<2 x s16>) into %ir.addr11)
356 ; CHECK-NEXT: [[C4:%[0-9]+]]:_(s64) = G_CONSTANT i64 4
357 ; CHECK-NEXT: [[PTR_ADD:%[0-9]+]]:_(p0) = G_PTR_ADD [[COPY]], [[C4]](s64)
358 ; CHECK-NEXT: G_STORE [[BUILD_VECTOR1]](<2 x s16>), [[PTR_ADD]](p0) :: (store (<2 x s16>) into %ir.addr2)
359 ; CHECK-NEXT: RET_ReallyLR
361 %2:_(s16) = G_CONSTANT i16 4
362 %3:_(s16) = G_CONSTANT i16 7
363 %1:_(<2 x s16>) = G_BUILD_VECTOR %2(s16), %3(s16)
364 %7:_(s16) = G_CONSTANT i16 5
365 %8:_(s16) = G_CONSTANT i16 8
366 %6:_(<2 x s16>) = G_BUILD_VECTOR %7(s16), %8(s16)
367 G_STORE %1(<2 x s16>), %0(p0) :: (store (<2 x s16>) into %ir.addr11)
368 %4:_(s64) = G_CONSTANT i64 4
369 %5:_(p0) = G_PTR_ADD %0, %4(s64)
370 G_STORE %6(<2 x s16>), %5(p0) :: (store (<2 x s16>) into %ir.addr2)
375 name: test_unknown_alias
377 tracksRegLiveness: true
383 machineFunctionInfo: {}
388 ; CHECK-LABEL: name: test_unknown_alias
389 ; CHECK: liveins: $x0, $x1
391 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(p0) = COPY $x0
392 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(p0) = COPY $x1
393 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 4
394 ; CHECK-NEXT: [[C1:%[0-9]+]]:_(s32) = G_CONSTANT i32 5
395 ; CHECK-NEXT: G_STORE [[C]](s32), [[COPY]](p0) :: (store (s32) into %ir.addr11)
396 ; CHECK-NEXT: [[LOAD:%[0-9]+]]:_(s32) = G_LOAD [[COPY1]](p0) :: (load (s32) from %ir.aliasptr)
397 ; CHECK-NEXT: [[C2:%[0-9]+]]:_(s64) = G_CONSTANT i64 4
398 ; CHECK-NEXT: [[PTR_ADD:%[0-9]+]]:_(p0) = G_PTR_ADD [[COPY]], [[C2]](s64)
399 ; CHECK-NEXT: G_STORE [[C1]](s32), [[PTR_ADD]](p0) :: (store (s32) into %ir.addr2)
400 ; CHECK-NEXT: $w0 = COPY [[LOAD]](s32)
401 ; CHECK-NEXT: RET_ReallyLR implicit $w0
404 %2:_(s32) = G_CONSTANT i32 4
405 %6:_(s32) = G_CONSTANT i32 5
406 G_STORE %2(s32), %0(p0) :: (store (s32) into %ir.addr11)
407 %3:_(s32) = G_LOAD %1(p0) :: (load (s32) from %ir.aliasptr)
408 %4:_(s64) = G_CONSTANT i64 4
409 %5:_(p0) = G_PTR_ADD %0, %4(s64)
410 G_STORE %6(s32), %5(p0) :: (store (s32) into %ir.addr2)
412 RET_ReallyLR implicit $w0
418 tracksRegLiveness: true
424 machineFunctionInfo: {}
429 ; CHECK-LABEL: name: test_2x_2xs32
430 ; CHECK: liveins: $x0, $x1
432 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(p0) = COPY $x0
433 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(p0) = COPY $x1
434 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 4
435 ; CHECK-NEXT: [[C1:%[0-9]+]]:_(s32) = G_CONSTANT i32 5
436 ; CHECK-NEXT: G_STORE [[C]](s32), [[COPY]](p0) :: (store (s32) into %ir.addr11)
437 ; CHECK-NEXT: [[C2:%[0-9]+]]:_(s64) = G_CONSTANT i64 4
438 ; CHECK-NEXT: [[PTR_ADD:%[0-9]+]]:_(p0) = G_PTR_ADD [[COPY]], [[C2]](s64)
439 ; CHECK-NEXT: G_STORE [[C1]](s32), [[PTR_ADD]](p0) :: (store (s32) into %ir.addr2)
440 ; CHECK-NEXT: [[C3:%[0-9]+]]:_(s64) = G_CONSTANT i64 73014444041
441 ; CHECK-NEXT: G_STORE [[C3]](s64), [[COPY1]](p0) :: (store (s64) into %ir.addr32, align 4)
442 ; CHECK-NEXT: RET_ReallyLR
445 %2:_(s32) = G_CONSTANT i32 4
446 %5:_(s32) = G_CONSTANT i32 5
447 %6:_(s32) = G_CONSTANT i32 9
448 %8:_(s32) = G_CONSTANT i32 17
449 G_STORE %2(s32), %0(p0) :: (store (s32) into %ir.addr11)
450 %3:_(s64) = G_CONSTANT i64 4
451 %4:_(p0) = G_PTR_ADD %0, %3(s64)
452 G_STORE %5(s32), %4(p0) :: (store (s32) into %ir.addr2)
453 G_STORE %6(s32), %1(p0) :: (store (s32) into %ir.addr32)
454 %7:_(p0) = G_PTR_ADD %1, %3(s64)
455 G_STORE %8(s32), %7(p0) :: (store (s32) into %ir.addr4)
460 name: test_simple_var_2xs8
462 tracksRegLiveness: true
469 machineFunctionInfo: {}
472 liveins: $w1, $w2, $x0
474 ; CHECK-LABEL: name: test_simple_var_2xs8
475 ; CHECK: liveins: $w1, $w2, $x0
477 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(p0) = COPY $x0
478 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $w1
479 ; CHECK-NEXT: [[TRUNC:%[0-9]+]]:_(s8) = G_TRUNC [[COPY1]](s32)
480 ; CHECK-NEXT: [[COPY2:%[0-9]+]]:_(s32) = COPY $w2
481 ; CHECK-NEXT: [[TRUNC1:%[0-9]+]]:_(s8) = G_TRUNC [[COPY2]](s32)
482 ; CHECK-NEXT: G_STORE [[TRUNC]](s8), [[COPY]](p0) :: (store (s8) into %ir.addr11)
483 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 1
484 ; CHECK-NEXT: [[PTR_ADD:%[0-9]+]]:_(p0) = G_PTR_ADD [[COPY]], [[C]](s64)
485 ; CHECK-NEXT: G_STORE [[TRUNC1]](s8), [[PTR_ADD]](p0) :: (store (s8) into %ir.addr2)
486 ; CHECK-NEXT: RET_ReallyLR
489 %1:_(s8) = G_TRUNC %3(s32)
491 %2:_(s8) = G_TRUNC %4(s32)
492 G_STORE %1(s8), %0(p0) :: (store (s8) into %ir.addr11)
493 %5:_(s64) = G_CONSTANT i64 1
494 %6:_(p0) = G_PTR_ADD %0, %5(s64)
495 G_STORE %2(s8), %6(p0) :: (store (s8) into %ir.addr2)
500 name: test_simple_var_2xs16
502 tracksRegLiveness: true
509 machineFunctionInfo: {}
512 liveins: $w1, $w2, $x0
514 ; CHECK-LABEL: name: test_simple_var_2xs16
515 ; CHECK: liveins: $w1, $w2, $x0
517 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(p0) = COPY $x0
518 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $w1
519 ; CHECK-NEXT: [[TRUNC:%[0-9]+]]:_(s16) = G_TRUNC [[COPY1]](s32)
520 ; CHECK-NEXT: [[COPY2:%[0-9]+]]:_(s32) = COPY $w2
521 ; CHECK-NEXT: [[TRUNC1:%[0-9]+]]:_(s16) = G_TRUNC [[COPY2]](s32)
522 ; CHECK-NEXT: G_STORE [[TRUNC]](s16), [[COPY]](p0) :: (store (s16) into %ir.addr11)
523 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 2
524 ; CHECK-NEXT: [[PTR_ADD:%[0-9]+]]:_(p0) = G_PTR_ADD [[COPY]], [[C]](s64)
525 ; CHECK-NEXT: G_STORE [[TRUNC1]](s16), [[PTR_ADD]](p0) :: (store (s16) into %ir.addr2)
526 ; CHECK-NEXT: RET_ReallyLR
529 %1:_(s16) = G_TRUNC %3(s32)
531 %2:_(s16) = G_TRUNC %4(s32)
532 G_STORE %1(s16), %0(p0) :: (store (s16) into %ir.addr11)
533 %5:_(s64) = G_CONSTANT i64 2
534 %6:_(p0) = G_PTR_ADD %0, %5(s64)
535 G_STORE %2(s16), %6(p0) :: (store (s16) into %ir.addr2)
540 name: test_simple_var_2xs32
542 tracksRegLiveness: true
549 machineFunctionInfo: {}
552 liveins: $w1, $w2, $x0
554 ; CHECK-LABEL: name: test_simple_var_2xs32
555 ; CHECK: liveins: $w1, $w2, $x0
557 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(p0) = COPY $x0
558 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $w1
559 ; CHECK-NEXT: [[COPY2:%[0-9]+]]:_(s32) = COPY $w2
560 ; CHECK-NEXT: G_STORE [[COPY1]](s32), [[COPY]](p0) :: (store (s32) into %ir.addr11)
561 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 4
562 ; CHECK-NEXT: [[PTR_ADD:%[0-9]+]]:_(p0) = G_PTR_ADD [[COPY]], [[C]](s64)
563 ; CHECK-NEXT: G_STORE [[COPY2]](s32), [[PTR_ADD]](p0) :: (store (s32) into %ir.addr2)
564 ; CHECK-NEXT: RET_ReallyLR
568 G_STORE %1(s32), %0(p0) :: (store (s32) into %ir.addr11)
569 %3:_(s64) = G_CONSTANT i64 4
570 %4:_(p0) = G_PTR_ADD %0, %3(s64)
571 G_STORE %2(s32), %4(p0) :: (store (s32) into %ir.addr2)
576 name: test_alias_4xs16
578 tracksRegLiveness: true
584 machineFunctionInfo: {}
589 ; The store to ptr2 prevents merging into a single store.
590 ; We can still merge the stores into addr1 and addr2.
592 ; CHECK-LABEL: name: test_alias_4xs16
593 ; CHECK: liveins: $x0, $x1
595 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(p0) = COPY $x0
596 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(p0) = COPY $x1
597 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s16) = G_CONSTANT i16 9
598 ; CHECK-NEXT: [[C1:%[0-9]+]]:_(s16) = G_CONSTANT i16 0
599 ; CHECK-NEXT: [[C2:%[0-9]+]]:_(s16) = G_CONSTANT i16 14
600 ; CHECK-NEXT: [[C3:%[0-9]+]]:_(s32) = G_CONSTANT i32 327684
601 ; CHECK-NEXT: G_STORE [[C3]](s32), [[COPY]](p0) :: (store (s32) into %ir.addr11, align 2)
602 ; CHECK-NEXT: [[C4:%[0-9]+]]:_(s64) = G_CONSTANT i64 4
603 ; CHECK-NEXT: [[PTR_ADD:%[0-9]+]]:_(p0) = G_PTR_ADD [[COPY]], [[C4]](s64)
604 ; CHECK-NEXT: G_STORE [[C]](s16), [[PTR_ADD]](p0) :: (store (s16) into %ir.addr3)
605 ; CHECK-NEXT: G_STORE [[C1]](s16), [[COPY1]](p0) :: (store (s16) into %ir.ptr2)
606 ; CHECK-NEXT: [[C5:%[0-9]+]]:_(s64) = G_CONSTANT i64 6
607 ; CHECK-NEXT: [[PTR_ADD1:%[0-9]+]]:_(p0) = G_PTR_ADD [[COPY]], [[C5]](s64)
608 ; CHECK-NEXT: G_STORE [[C2]](s16), [[PTR_ADD1]](p0) :: (store (s16) into %ir.addr4)
609 ; CHECK-NEXT: RET_ReallyLR
612 %2:_(s16) = G_CONSTANT i16 4
613 %5:_(s16) = G_CONSTANT i16 5
614 %8:_(s16) = G_CONSTANT i16 9
615 %9:_(s16) = G_CONSTANT i16 0
616 %12:_(s16) = G_CONSTANT i16 14
617 G_STORE %2(s16), %0(p0) :: (store (s16) into %ir.addr11)
618 %3:_(s64) = G_CONSTANT i64 2
619 %4:_(p0) = G_PTR_ADD %0, %3(s64)
620 G_STORE %5(s16), %4(p0) :: (store (s16) into %ir.addr2)
621 %6:_(s64) = G_CONSTANT i64 4
622 %7:_(p0) = G_PTR_ADD %0, %6(s64)
623 G_STORE %8(s16), %7(p0) :: (store (s16) into %ir.addr3)
624 G_STORE %9(s16), %1(p0) :: (store (s16) into %ir.ptr2)
625 %10:_(s64) = G_CONSTANT i64 6
626 %11:_(p0) = G_PTR_ADD %0, %10(s64)
627 G_STORE %12(s16), %11(p0) :: (store (s16) into %ir.addr4)
632 name: test_alias2_4xs16
634 tracksRegLiveness: true
641 machineFunctionInfo: {}
644 liveins: $x0, $x1, $x2
645 ; Here store of 5 and 9 can be merged, others have aliasing barriers.
646 ; CHECK-LABEL: name: test_alias2_4xs16
647 ; CHECK: liveins: $x0, $x1, $x2
649 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(p0) = COPY $x0
650 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(p0) = COPY $x1
651 ; CHECK-NEXT: [[COPY2:%[0-9]+]]:_(p0) = COPY $x2
652 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s16) = G_CONSTANT i16 4
653 ; CHECK-NEXT: [[C1:%[0-9]+]]:_(s16) = G_CONSTANT i16 0
654 ; CHECK-NEXT: [[C2:%[0-9]+]]:_(s16) = G_CONSTANT i16 14
655 ; CHECK-NEXT: G_STORE [[C]](s16), [[COPY]](p0) :: (store (s16) into %ir.addr11)
656 ; CHECK-NEXT: [[C3:%[0-9]+]]:_(s64) = G_CONSTANT i64 2
657 ; CHECK-NEXT: [[PTR_ADD:%[0-9]+]]:_(p0) = G_PTR_ADD [[COPY]], [[C3]](s64)
658 ; CHECK-NEXT: G_STORE [[C1]](s16), [[COPY2]](p0) :: (store (s16) into %ir.ptr3)
659 ; CHECK-NEXT: [[C4:%[0-9]+]]:_(s32) = G_CONSTANT i32 589829
660 ; CHECK-NEXT: G_STORE [[C4]](s32), [[PTR_ADD]](p0) :: (store (s32) into %ir.addr2, align 2)
661 ; CHECK-NEXT: G_STORE [[C1]](s16), [[COPY1]](p0) :: (store (s16) into %ir.ptr2)
662 ; CHECK-NEXT: [[C5:%[0-9]+]]:_(s64) = G_CONSTANT i64 6
663 ; CHECK-NEXT: [[PTR_ADD1:%[0-9]+]]:_(p0) = G_PTR_ADD [[COPY]], [[C5]](s64)
664 ; CHECK-NEXT: G_STORE [[C2]](s16), [[PTR_ADD1]](p0) :: (store (s16) into %ir.addr4)
665 ; CHECK-NEXT: RET_ReallyLR
669 %3:_(s16) = G_CONSTANT i16 4
670 %6:_(s16) = G_CONSTANT i16 0
671 %7:_(s16) = G_CONSTANT i16 5
672 %10:_(s16) = G_CONSTANT i16 9
673 %13:_(s16) = G_CONSTANT i16 14
674 G_STORE %3(s16), %0(p0) :: (store (s16) into %ir.addr11)
675 %4:_(s64) = G_CONSTANT i64 2
676 %5:_(p0) = G_PTR_ADD %0, %4(s64)
677 G_STORE %6(s16), %2(p0) :: (store (s16) into %ir.ptr3)
678 G_STORE %7(s16), %5(p0) :: (store (s16) into %ir.addr2)
679 %8:_(s64) = G_CONSTANT i64 4
680 %9:_(p0) = G_PTR_ADD %0, %8(s64)
681 G_STORE %10(s16), %9(p0) :: (store (s16) into %ir.addr3)
682 G_STORE %6(s16), %1(p0) :: (store (s16) into %ir.ptr2)
683 %11:_(s64) = G_CONSTANT i64 6
684 %12:_(p0) = G_PTR_ADD %0, %11(s64)
685 G_STORE %13(s16), %12(p0) :: (store (s16) into %ir.addr4)
690 name: test_alias3_4xs16
692 tracksRegLiveness: true
700 machineFunctionInfo: {}
703 liveins: $x0, $x1, $x2, $x3
705 ; No merging can be done here.
707 ; CHECK-LABEL: name: test_alias3_4xs16
708 ; CHECK: liveins: $x0, $x1, $x2, $x3
710 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(p0) = COPY $x0
711 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(p0) = COPY $x1
712 ; CHECK-NEXT: [[COPY2:%[0-9]+]]:_(p0) = COPY $x2
713 ; CHECK-NEXT: [[COPY3:%[0-9]+]]:_(p0) = COPY $x3
714 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s16) = G_CONSTANT i16 4
715 ; CHECK-NEXT: [[C1:%[0-9]+]]:_(s16) = G_CONSTANT i16 0
716 ; CHECK-NEXT: [[C2:%[0-9]+]]:_(s16) = G_CONSTANT i16 5
717 ; CHECK-NEXT: [[C3:%[0-9]+]]:_(s16) = G_CONSTANT i16 9
718 ; CHECK-NEXT: [[C4:%[0-9]+]]:_(s16) = G_CONSTANT i16 14
719 ; CHECK-NEXT: G_STORE [[C]](s16), [[COPY]](p0) :: (store (s16) into %ir.addr11)
720 ; CHECK-NEXT: [[C5:%[0-9]+]]:_(s64) = G_CONSTANT i64 2
721 ; CHECK-NEXT: [[PTR_ADD:%[0-9]+]]:_(p0) = G_PTR_ADD [[COPY]], [[C5]](s64)
722 ; CHECK-NEXT: G_STORE [[C1]](s16), [[COPY2]](p0) :: (store (s16) into %ir.ptr3)
723 ; CHECK-NEXT: G_STORE [[C2]](s16), [[PTR_ADD]](p0) :: (store (s16) into %ir.addr2)
724 ; CHECK-NEXT: G_STORE [[C1]](s16), [[COPY3]](p0) :: (store (s16) into %ir.ptr4)
725 ; CHECK-NEXT: [[C6:%[0-9]+]]:_(s64) = G_CONSTANT i64 4
726 ; CHECK-NEXT: [[PTR_ADD1:%[0-9]+]]:_(p0) = G_PTR_ADD [[COPY]], [[C6]](s64)
727 ; CHECK-NEXT: G_STORE [[C3]](s16), [[PTR_ADD1]](p0) :: (store (s16) into %ir.addr3)
728 ; CHECK-NEXT: G_STORE [[C1]](s16), [[COPY1]](p0) :: (store (s16) into %ir.ptr2)
729 ; CHECK-NEXT: [[C7:%[0-9]+]]:_(s64) = G_CONSTANT i64 6
730 ; CHECK-NEXT: [[PTR_ADD2:%[0-9]+]]:_(p0) = G_PTR_ADD [[COPY]], [[C7]](s64)
731 ; CHECK-NEXT: G_STORE [[C4]](s16), [[PTR_ADD2]](p0) :: (store (s16) into %ir.addr4)
732 ; CHECK-NEXT: RET_ReallyLR
737 %4:_(s16) = G_CONSTANT i16 4
738 %7:_(s16) = G_CONSTANT i16 0
739 %8:_(s16) = G_CONSTANT i16 5
740 %11:_(s16) = G_CONSTANT i16 9
741 %14:_(s16) = G_CONSTANT i16 14
742 G_STORE %4(s16), %0(p0) :: (store (s16) into %ir.addr11)
743 %5:_(s64) = G_CONSTANT i64 2
744 %6:_(p0) = G_PTR_ADD %0, %5(s64)
745 G_STORE %7(s16), %2(p0) :: (store (s16) into %ir.ptr3)
746 G_STORE %8(s16), %6(p0) :: (store (s16) into %ir.addr2)
747 G_STORE %7(s16), %3(p0) :: (store (s16) into %ir.ptr4)
748 %9:_(s64) = G_CONSTANT i64 4
749 %10:_(p0) = G_PTR_ADD %0, %9(s64)
750 G_STORE %11(s16), %10(p0) :: (store (s16) into %ir.addr3)
751 G_STORE %7(s16), %1(p0) :: (store (s16) into %ir.ptr2)
752 %12:_(s64) = G_CONSTANT i64 6
753 %13:_(p0) = G_PTR_ADD %0, %12(s64)
754 G_STORE %14(s16), %13(p0) :: (store (s16) into %ir.addr4)
759 name: test_alias_allocas_2xs32
761 tracksRegLiveness: true
767 - { id: 0, name: a1, size: 24, alignment: 4 }
768 - { id: 1, name: a2, size: 4, alignment: 4 }
769 machineFunctionInfo: {}
774 ; Can merge because the load is from a different alloca and can't alias.
776 ; CHECK-LABEL: name: test_alias_allocas_2xs32
777 ; CHECK: liveins: $x0
779 ; CHECK-NEXT: [[FRAME_INDEX:%[0-9]+]]:_(p0) = G_FRAME_INDEX %stack.0.a1
780 ; CHECK-NEXT: [[FRAME_INDEX1:%[0-9]+]]:_(p0) = G_FRAME_INDEX %stack.1.a2
781 ; CHECK-NEXT: [[LOAD:%[0-9]+]]:_(s32) = G_LOAD [[FRAME_INDEX1]](p0) :: (dereferenceable load (s32) from %ir.a2)
782 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 21474836484
783 ; CHECK-NEXT: G_STORE [[C]](s64), [[FRAME_INDEX]](p0) :: (store (s64) into %ir.addr11, align 4)
784 ; CHECK-NEXT: $w0 = COPY [[LOAD]](s32)
785 ; CHECK-NEXT: RET_ReallyLR implicit $w0
786 %3:_(s32) = G_CONSTANT i32 4
787 %7:_(s32) = G_CONSTANT i32 5
788 %1:_(p0) = G_FRAME_INDEX %stack.0.a1
789 %2:_(p0) = G_FRAME_INDEX %stack.1.a2
790 G_STORE %3(s32), %1(p0) :: (store (s32) into %ir.addr11)
791 %4:_(s32) = G_LOAD %2(p0) :: (dereferenceable load (s32) from %ir.a2)
792 %5:_(s64) = G_CONSTANT i64 4
793 %6:_(p0) = G_PTR_ADD %1, %5(s64)
794 G_STORE %7(s32), %6(p0) :: (store (s32) into %ir.addr2)
796 RET_ReallyLR implicit $w0
800 name: test_simple_2xs32_with_align
802 tracksRegLiveness: true
807 machineFunctionInfo: {}
812 ; CHECK-LABEL: name: test_simple_2xs32_with_align
813 ; CHECK: liveins: $x0
815 ; CHECK-NEXT: [[COPY:%[0-9]+]]:_(p0) = COPY $x0
816 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 21474836484
817 ; CHECK-NEXT: G_STORE [[C]](s64), [[COPY]](p0) :: (store (s64) into %ir.addr11, align 2)
818 ; CHECK-NEXT: RET_ReallyLR
820 %1:_(s32) = G_CONSTANT i32 4
821 %4:_(s32) = G_CONSTANT i32 5
822 G_STORE %1(s32), %0(p0) :: (store (s32) into %ir.addr11, align 2)
823 %2:_(s64) = G_CONSTANT i64 4
824 %3:_(p0) = G_PTR_ADD %0, %2(s64)
825 G_STORE %4(s32), %3(p0) :: (store (s32) into %ir.addr2, align 2)