1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -O0 -march=aarch64 -run-pass=legalizer %s -o - | FileCheck %s
5 target datalayout = "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128"
6 target triple = "aarch64"
8 define void @test_load() { ret void }
9 define void @test_store() { ret void }
11 define void @store_4xi16(<4 x i16> %v, <4 x i16>* %ptr) {
12 store <4 x i16> %v, <4 x i16>* %ptr
16 define void @store_4xi32(<4 x i32> %v, <4 x i32>* %ptr) {
17 store <4 x i32> %v, <4 x i32>* %ptr
21 define void @store_8xi16(<8 x i16> %v, <8 x i16>* %ptr) {
22 store <8 x i16> %v, <8 x i16>* %ptr
26 define void @store_16xi8(<16 x i8> %v, <16 x i8>* %ptr) {
27 store <16 x i8> %v, <16 x i8>* %ptr
31 define <4 x i16> @load_4xi16(<4 x i16>* %ptr) {
32 %res = load <4 x i16>, <4 x i16>* %ptr
36 define <4 x i32> @load_4xi32(<4 x i32>* %ptr) {
37 %res = load <4 x i32>, <4 x i32>* %ptr
41 define <8 x i16> @load_8xi16(<8 x i16>* %ptr) {
42 %res = load <8 x i16>, <8 x i16>* %ptr
46 define <16 x i8> @load_16xi8(<16 x i8>* %ptr) {
47 %res = load <16 x i8>, <16 x i8>* %ptr
51 define <8 x i8> @load_8xi8(<8 x i8>* %ptr) {
52 %res = load <8 x i8>, <8 x i8>* %ptr
63 ; CHECK-LABEL: name: test_load
64 ; CHECK: [[COPY:%[0-9]+]]:_(p0) = COPY $x0
65 ; CHECK: [[LOAD:%[0-9]+]]:_(s8) = G_LOAD [[COPY]](p0) :: (load 1)
66 ; CHECK: [[ANYEXT:%[0-9]+]]:_(s32) = G_ANYEXT [[LOAD]](s8)
67 ; CHECK: $w0 = COPY [[ANYEXT]](s32)
68 ; CHECK: [[LOAD1:%[0-9]+]]:_(s8) = G_LOAD [[COPY]](p0) :: (load 1)
69 ; CHECK: [[ANYEXT1:%[0-9]+]]:_(s32) = G_ANYEXT [[LOAD1]](s8)
70 ; CHECK: $w0 = COPY [[ANYEXT1]](s32)
71 ; CHECK: [[LOAD2:%[0-9]+]]:_(s16) = G_LOAD [[COPY]](p0) :: (load 2)
72 ; CHECK: [[ANYEXT2:%[0-9]+]]:_(s32) = G_ANYEXT [[LOAD2]](s16)
73 ; CHECK: $w0 = COPY [[ANYEXT2]](s32)
74 ; CHECK: $w0 = COPY [[ANYEXT1]](s32)
75 ; CHECK: [[LOAD3:%[0-9]+]]:_(s64) = G_LOAD [[COPY]](p0) :: (load 8)
76 ; CHECK: $x0 = COPY [[LOAD3]](s64)
77 ; CHECK: [[LOAD4:%[0-9]+]]:_(p0) = G_LOAD [[COPY]](p0) :: (load 8)
78 ; CHECK: [[PTRTOINT:%[0-9]+]]:_(s64) = G_PTRTOINT [[LOAD4]](p0)
79 ; CHECK: $x0 = COPY [[PTRTOINT]](s64)
80 ; CHECK: [[LOAD5:%[0-9]+]]:_(<2 x s32>) = G_LOAD [[COPY]](p0) :: (load 8)
81 ; CHECK: [[BITCAST:%[0-9]+]]:_(s64) = G_BITCAST [[LOAD5]](<2 x s32>)
82 ; CHECK: $x0 = COPY [[BITCAST]](s64)
83 ; CHECK: [[LOAD6:%[0-9]+]]:_(s128) = G_LOAD [[COPY]](p0) :: (load 16)
84 ; CHECK: [[TRUNC:%[0-9]+]]:_(s64) = G_TRUNC [[LOAD6]](s128)
85 ; CHECK: $x0 = COPY [[TRUNC]](s64)
87 %1:_(s1) = G_LOAD %0(p0) :: (load 1)
88 %2:_(s32) = G_ANYEXT %1(s1)
90 %3:_(s8) = G_LOAD %0(p0) :: (load 1)
91 %4:_(s32) = G_ANYEXT %3(s8)
93 %5:_(s16) = G_LOAD %0(p0) :: (load 2)
94 %6:_(s32) = G_ANYEXT %5(s16)
96 %7:_(s32) = G_LOAD %0(p0) :: (load 4)
98 %8:_(s64) = G_LOAD %0(p0) :: (load 8)
100 %9:_(p0) = G_LOAD %0(p0) :: (load 8)
101 %10:_(s64) = G_PTRTOINT %9(p0)
103 %11:_(<2 x s32>) = G_LOAD %0(p0) :: (load 8)
104 %12:_(s64) = G_BITCAST %11(<2 x s32>)
106 %13:_(s128) = G_LOAD %0(p0) :: (load 16)
107 %14:_(s64) = G_TRUNC %13(s128)
117 ; CHECK-LABEL: name: test_store
118 ; CHECK: [[COPY:%[0-9]+]]:_(p0) = COPY $x0
119 ; CHECK: [[COPY1:%[0-9]+]]:_(s32) = COPY $w1
120 ; CHECK: [[COPY2:%[0-9]+]]:_(s32) = COPY [[COPY1]](s32)
121 ; CHECK: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 1
122 ; CHECK: [[AND:%[0-9]+]]:_(s32) = G_AND [[COPY2]], [[C]]
123 ; CHECK: [[TRUNC:%[0-9]+]]:_(s8) = G_TRUNC [[AND]](s32)
124 ; CHECK: G_STORE [[TRUNC]](s8), [[COPY]](p0) :: (store 1)
125 ; CHECK: [[TRUNC1:%[0-9]+]]:_(s8) = G_TRUNC [[COPY1]](s32)
126 ; CHECK: G_STORE [[TRUNC1]](s8), [[COPY]](p0) :: (store 1)
127 ; CHECK: [[TRUNC2:%[0-9]+]]:_(s16) = G_TRUNC [[COPY1]](s32)
128 ; CHECK: G_STORE [[TRUNC2]](s16), [[COPY]](p0) :: (store 2)
129 ; CHECK: G_STORE [[COPY1]](s32), [[COPY]](p0) :: (store 4)
130 ; CHECK: [[PTRTOINT:%[0-9]+]]:_(s64) = G_PTRTOINT [[COPY]](p0)
131 ; CHECK: G_STORE [[PTRTOINT]](s64), [[COPY]](p0) :: (store 8)
132 ; CHECK: G_STORE [[COPY]](p0), [[COPY]](p0) :: (store 8)
133 ; CHECK: [[PTRTOINT1:%[0-9]+]]:_(s64) = G_PTRTOINT [[COPY]](p0)
134 ; CHECK: [[MV:%[0-9]+]]:_(s128) = G_MERGE_VALUES [[PTRTOINT1]](s64), [[PTRTOINT1]](s64)
135 ; CHECK: G_STORE [[MV]](s128), [[COPY]](p0) :: (store 16)
138 %2:_(s1) = G_TRUNC %1(s32)
139 G_STORE %2(s1), %0(p0) :: (store 1)
140 %3:_(s8) = G_TRUNC %1(s32)
141 G_STORE %3(s8), %0(p0) :: (store 1)
142 %4:_(s16) = G_TRUNC %1(s32)
143 G_STORE %4(s16), %0(p0) :: (store 2)
144 G_STORE %1(s32), %0(p0) :: (store 4)
145 %5:_(s64) = G_PTRTOINT %0(p0)
146 G_STORE %5(s64), %0(p0) :: (store 8)
147 G_STORE %0(p0), %0(p0) :: (store 8)
148 %6:_(s64) = G_PTRTOINT %0(p0)
149 %7:_(s128) = G_MERGE_VALUES %6(s64), %6
150 G_STORE %7(s128), %0(p0) :: (store 16)
155 tracksRegLiveness: true
156 machineFunctionInfo: {}
161 ; CHECK-LABEL: name: store_4xi16
162 ; CHECK: liveins: $d0, $x0
163 ; CHECK: [[COPY:%[0-9]+]]:_(<4 x s16>) = COPY $d0
164 ; CHECK: [[COPY1:%[0-9]+]]:_(p0) = COPY $x0
165 ; CHECK: G_STORE [[COPY]](<4 x s16>), [[COPY1]](p0) :: (store 8 into %ir.ptr)
166 ; CHECK: RET_ReallyLR
167 %0:_(<4 x s16>) = COPY $d0
169 G_STORE %0(<4 x s16>), %1(p0) :: (store 8 into %ir.ptr)
176 tracksRegLiveness: true
177 machineFunctionInfo: {}
182 ; CHECK-LABEL: name: store_4xi32
183 ; CHECK: liveins: $q0, $x0
184 ; CHECK: [[COPY:%[0-9]+]]:_(<4 x s32>) = COPY $q0
185 ; CHECK: [[COPY1:%[0-9]+]]:_(p0) = COPY $x0
186 ; CHECK: G_STORE [[COPY]](<4 x s32>), [[COPY1]](p0) :: (store 16 into %ir.ptr)
187 ; CHECK: RET_ReallyLR
188 %0:_(<4 x s32>) = COPY $q0
190 G_STORE %0(<4 x s32>), %1(p0) :: (store 16 into %ir.ptr)
197 tracksRegLiveness: true
198 machineFunctionInfo: {}
203 ; CHECK-LABEL: name: store_8xi16
204 ; CHECK: liveins: $q0, $x0
205 ; CHECK: [[COPY:%[0-9]+]]:_(<8 x s16>) = COPY $q0
206 ; CHECK: [[COPY1:%[0-9]+]]:_(p0) = COPY $x0
207 ; CHECK: G_STORE [[COPY]](<8 x s16>), [[COPY1]](p0) :: (store 16 into %ir.ptr)
208 ; CHECK: RET_ReallyLR
209 %0:_(<8 x s16>) = COPY $q0
211 G_STORE %0(<8 x s16>), %1(p0) :: (store 16 into %ir.ptr)
218 tracksRegLiveness: true
219 machineFunctionInfo: {}
224 ; CHECK-LABEL: name: store_16xi8
225 ; CHECK: liveins: $q0, $x0
226 ; CHECK: [[COPY:%[0-9]+]]:_(<16 x s8>) = COPY $q0
227 ; CHECK: [[COPY1:%[0-9]+]]:_(p0) = COPY $x0
228 ; CHECK: G_STORE [[COPY]](<16 x s8>), [[COPY1]](p0) :: (store 16 into %ir.ptr)
229 ; CHECK: RET_ReallyLR
230 %0:_(<16 x s8>) = COPY $q0
232 G_STORE %0(<16 x s8>), %1(p0) :: (store 16 into %ir.ptr)
239 tracksRegLiveness: true
240 machineFunctionInfo: {}
245 ; CHECK-LABEL: name: load_4xi16
246 ; CHECK: liveins: $x0
247 ; CHECK: [[COPY:%[0-9]+]]:_(p0) = COPY $x0
248 ; CHECK: [[LOAD:%[0-9]+]]:_(<4 x s16>) = G_LOAD [[COPY]](p0) :: (load 8 from %ir.ptr)
249 ; CHECK: $d0 = COPY [[LOAD]](<4 x s16>)
250 ; CHECK: RET_ReallyLR implicit $d0
252 %1:_(<4 x s16>) = G_LOAD %0(p0) :: (load 8 from %ir.ptr)
253 $d0 = COPY %1(<4 x s16>)
254 RET_ReallyLR implicit $d0
260 tracksRegLiveness: true
261 machineFunctionInfo: {}
266 ; CHECK-LABEL: name: load_4xi32
267 ; CHECK: liveins: $x0
268 ; CHECK: [[COPY:%[0-9]+]]:_(p0) = COPY $x0
269 ; CHECK: [[LOAD:%[0-9]+]]:_(<4 x s32>) = G_LOAD [[COPY]](p0) :: (load 16 from %ir.ptr)
270 ; CHECK: $q0 = COPY [[LOAD]](<4 x s32>)
271 ; CHECK: RET_ReallyLR implicit $q0
273 %1:_(<4 x s32>) = G_LOAD %0(p0) :: (load 16 from %ir.ptr)
274 $q0 = COPY %1(<4 x s32>)
275 RET_ReallyLR implicit $q0
281 tracksRegLiveness: true
282 machineFunctionInfo: {}
287 ; CHECK-LABEL: name: load_8xi16
288 ; CHECK: liveins: $x0
289 ; CHECK: [[COPY:%[0-9]+]]:_(p0) = COPY $x0
290 ; CHECK: [[LOAD:%[0-9]+]]:_(<8 x s16>) = G_LOAD [[COPY]](p0) :: (load 16 from %ir.ptr)
291 ; CHECK: $q0 = COPY [[LOAD]](<8 x s16>)
292 ; CHECK: RET_ReallyLR implicit $q0
294 %1:_(<8 x s16>) = G_LOAD %0(p0) :: (load 16 from %ir.ptr)
295 $q0 = COPY %1(<8 x s16>)
296 RET_ReallyLR implicit $q0
302 tracksRegLiveness: true
303 machineFunctionInfo: {}
308 ; CHECK-LABEL: name: load_16xi8
309 ; CHECK: liveins: $x0
310 ; CHECK: [[COPY:%[0-9]+]]:_(p0) = COPY $x0
311 ; CHECK: [[LOAD:%[0-9]+]]:_(<16 x s8>) = G_LOAD [[COPY]](p0) :: (load 16 from %ir.ptr)
312 ; CHECK: $q0 = COPY [[LOAD]](<16 x s8>)
313 ; CHECK: RET_ReallyLR implicit $q0
315 %1:_(<16 x s8>) = G_LOAD %0(p0) :: (load 16 from %ir.ptr)
316 $q0 = COPY %1(<16 x s8>)
317 RET_ReallyLR implicit $q0
323 tracksRegLiveness: true
324 machineFunctionInfo: {}
328 ; CHECK-LABEL: name: load_8xi8
329 ; CHECK: liveins: $x0
330 ; CHECK: [[COPY:%[0-9]+]]:_(p0) = COPY $x0
331 ; CHECK: [[LOAD:%[0-9]+]]:_(<8 x s8>) = G_LOAD [[COPY]](p0) :: (load 8 from %ir.ptr)
332 ; CHECK: $d0 = COPY [[LOAD]](<8 x s8>)
333 ; CHECK: RET_ReallyLR implicit $d0
335 %1:_(<8 x s8>) = G_LOAD %0(p0) :: (load 8 from %ir.ptr)
336 $d0 = COPY %1(<8 x s8>)
337 RET_ReallyLR implicit $d0