1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 4
2 ; RUN: llc -mtriple=aarch64 %s -o - | FileCheck %s --check-prefixes=CHECK,CHECK-SD
3 ; RUN: llc -mtriple=aarch64 -global-isel %s -o - | FileCheck %s --check-prefixes=CHECK,CHECK-GI
5 ; ===== Legal Scalars =====
6 define void @store_i8(i8 %a, ptr %ptr){
7 ; CHECK-LABEL: store_i8:
9 ; CHECK-NEXT: strb w0, [x1]
15 define void @store_i16(i16 %a, ptr %ptr){
16 ; CHECK-LABEL: store_i16:
18 ; CHECK-NEXT: strh w0, [x1]
20 store i16 %a, ptr %ptr
24 define void @store_i32(i32 %a, ptr %ptr){
25 ; CHECK-LABEL: store_i32:
27 ; CHECK-NEXT: str w0, [x1]
29 store i32 %a, ptr %ptr
33 define void @store_i64(i64 %a, ptr %ptr){
34 ; CHECK-LABEL: store_i64:
36 ; CHECK-NEXT: str x0, [x1]
38 store i64 %a, ptr %ptr
42 ; ===== Legal Vector Types =====
44 define void @store_v8i8(<8 x i8> %a, ptr %ptr){
45 ; CHECK-LABEL: store_v8i8:
47 ; CHECK-NEXT: str d0, [x0]
49 store <8 x i8> %a, ptr %ptr
53 define void @store_v16i8(<16 x i8> %a, ptr %ptr){
54 ; CHECK-LABEL: store_v16i8:
56 ; CHECK-NEXT: str q0, [x0]
58 store <16 x i8> %a, ptr %ptr
62 define void @store_v4i16(<4 x i16> %a, ptr %ptr){
63 ; CHECK-LABEL: store_v4i16:
65 ; CHECK-NEXT: str d0, [x0]
67 store <4 x i16> %a, ptr %ptr
71 define void @store_v8i16(<8 x i16> %a, ptr %ptr){
72 ; CHECK-LABEL: store_v8i16:
74 ; CHECK-NEXT: str q0, [x0]
76 store <8 x i16> %a, ptr %ptr
80 define void @store_v2i32(<2 x i32> %a, ptr %ptr){
81 ; CHECK-LABEL: store_v2i32:
83 ; CHECK-NEXT: str d0, [x0]
85 store <2 x i32> %a, ptr %ptr
89 define void @store_v4i32(<4 x i32> %a, ptr %ptr){
90 ; CHECK-LABEL: store_v4i32:
92 ; CHECK-NEXT: str q0, [x0]
94 store <4 x i32> %a, ptr %ptr
98 define void @store_v2i64(<2 x i64> %a, ptr %ptr){
99 ; CHECK-LABEL: store_v2i64:
101 ; CHECK-NEXT: str q0, [x0]
103 store <2 x i64> %a, ptr %ptr
107 ; ===== Smaller/Larger Width Vectors with Legal Element Sizes =====
109 define void @store_v2i8(<2 x i8> %a, ptr %ptr){
110 ; CHECK-SD-LABEL: store_v2i8:
111 ; CHECK-SD: // %bb.0:
112 ; CHECK-SD-NEXT: // kill: def $d0 killed $d0 def $q0
113 ; CHECK-SD-NEXT: mov w8, v0.s[1]
114 ; CHECK-SD-NEXT: fmov w9, s0
115 ; CHECK-SD-NEXT: strb w9, [x0]
116 ; CHECK-SD-NEXT: strb w8, [x0, #1]
119 ; CHECK-GI-LABEL: store_v2i8:
120 ; CHECK-GI: // %bb.0:
121 ; CHECK-GI-NEXT: // kill: def $d0 killed $d0 def $q0
122 ; CHECK-GI-NEXT: mov s1, v0.s[1]
123 ; CHECK-GI-NEXT: str b0, [x0]
124 ; CHECK-GI-NEXT: str b1, [x0, #1]
126 store <2 x i8> %a, ptr %ptr
130 define void @store_v4i8(i32 %a, ptr %ptr) {
131 ; CHECK-LABEL: store_v4i8:
133 ; CHECK-NEXT: str w0, [x1]
135 %c = bitcast i32 %a to <4 x i8>
136 store <4 x i8> %c, ptr %ptr
140 define void @store_v32i8(<32 x i8> %a, ptr %ptr){
141 ; CHECK-LABEL: store_v32i8:
143 ; CHECK-NEXT: stp q0, q1, [x0]
145 store <32 x i8> %a, ptr %ptr
149 define void @store_v2i16(<2 x i16> %a, ptr %ptr){
150 ; CHECK-SD-LABEL: store_v2i16:
151 ; CHECK-SD: // %bb.0:
152 ; CHECK-SD-NEXT: // kill: def $d0 killed $d0 def $q0
153 ; CHECK-SD-NEXT: mov w8, v0.s[1]
154 ; CHECK-SD-NEXT: fmov w9, s0
155 ; CHECK-SD-NEXT: strh w9, [x0]
156 ; CHECK-SD-NEXT: strh w8, [x0, #2]
159 ; CHECK-GI-LABEL: store_v2i16:
160 ; CHECK-GI: // %bb.0:
161 ; CHECK-GI-NEXT: // kill: def $d0 killed $d0 def $q0
162 ; CHECK-GI-NEXT: mov s1, v0.s[1]
163 ; CHECK-GI-NEXT: str h0, [x0]
164 ; CHECK-GI-NEXT: str h1, [x0, #2]
166 store <2 x i16> %a, ptr %ptr
170 define void @store_v16i16(<16 x i16> %a, ptr %ptr){
171 ; CHECK-LABEL: store_v16i16:
173 ; CHECK-NEXT: stp q0, q1, [x0]
175 store <16 x i16> %a, ptr %ptr
179 define void @store_v1i32(<1 x i32> %a, ptr %ptr){
180 ; CHECK-SD-LABEL: store_v1i32:
181 ; CHECK-SD: // %bb.0:
182 ; CHECK-SD-NEXT: // kill: def $d0 killed $d0 def $q0
183 ; CHECK-SD-NEXT: str s0, [x0]
186 ; CHECK-GI-LABEL: store_v1i32:
187 ; CHECK-GI: // %bb.0:
188 ; CHECK-GI-NEXT: str s0, [x0]
190 store <1 x i32> %a, ptr %ptr
194 define void @store_v8i32(<8 x i32> %a, ptr %ptr){
195 ; CHECK-LABEL: store_v8i32:
197 ; CHECK-NEXT: stp q0, q1, [x0]
199 store <8 x i32> %a, ptr %ptr
203 define void @store_v4i64(<4 x i64> %a, ptr %ptr){
204 ; CHECK-LABEL: store_v4i64:
206 ; CHECK-NEXT: stp q0, q1, [x0]
208 store <4 x i64> %a, ptr %ptr
212 ; ===== Vectors with Non-Pow 2 Widths =====
214 define void @store_v3i8(<3 x i8> %a, ptr %ptr){
215 ; CHECK-SD-LABEL: store_v3i8:
216 ; CHECK-SD: // %bb.0:
217 ; CHECK-SD-NEXT: sub sp, sp, #16
218 ; CHECK-SD-NEXT: .cfi_def_cfa_offset 16
219 ; CHECK-SD-NEXT: fmov s0, w0
220 ; CHECK-SD-NEXT: mov v0.h[1], w1
221 ; CHECK-SD-NEXT: mov v0.h[2], w2
222 ; CHECK-SD-NEXT: xtn v0.8b, v0.8h
223 ; CHECK-SD-NEXT: str s0, [sp, #12]
224 ; CHECK-SD-NEXT: ldrh w8, [sp, #12]
225 ; CHECK-SD-NEXT: strb w2, [x3, #2]
226 ; CHECK-SD-NEXT: strh w8, [x3]
227 ; CHECK-SD-NEXT: add sp, sp, #16
230 ; CHECK-GI-LABEL: store_v3i8:
231 ; CHECK-GI: // %bb.0:
232 ; CHECK-GI-NEXT: strb w0, [x3]
233 ; CHECK-GI-NEXT: strb w1, [x3, #1]
234 ; CHECK-GI-NEXT: strb w2, [x3, #2]
236 store <3 x i8> %a, ptr %ptr
240 define void @store_v7i8(<7 x i8> %a, ptr %ptr){
241 ; CHECK-SD-LABEL: store_v7i8:
242 ; CHECK-SD: // %bb.0:
243 ; CHECK-SD-NEXT: add x8, x0, #6
244 ; CHECK-SD-NEXT: add x9, x0, #4
245 ; CHECK-SD-NEXT: // kill: def $d0 killed $d0 def $q0
246 ; CHECK-SD-NEXT: str s0, [x0]
247 ; CHECK-SD-NEXT: st1 { v0.b }[6], [x8]
248 ; CHECK-SD-NEXT: st1 { v0.h }[2], [x9]
251 ; CHECK-GI-LABEL: store_v7i8:
252 ; CHECK-GI: // %bb.0:
253 ; CHECK-GI-NEXT: add x8, x0, #1
254 ; CHECK-GI-NEXT: // kill: def $d0 killed $d0 def $q0
255 ; CHECK-GI-NEXT: add x9, x0, #2
256 ; CHECK-GI-NEXT: st1 { v0.b }[0], [x0]
257 ; CHECK-GI-NEXT: st1 { v0.b }[1], [x8]
258 ; CHECK-GI-NEXT: add x8, x0, #3
259 ; CHECK-GI-NEXT: st1 { v0.b }[3], [x8]
260 ; CHECK-GI-NEXT: add x8, x0, #4
261 ; CHECK-GI-NEXT: st1 { v0.b }[4], [x8]
262 ; CHECK-GI-NEXT: add x8, x0, #5
263 ; CHECK-GI-NEXT: st1 { v0.b }[5], [x8]
264 ; CHECK-GI-NEXT: add x8, x0, #6
265 ; CHECK-GI-NEXT: st1 { v0.b }[2], [x9]
266 ; CHECK-GI-NEXT: st1 { v0.b }[6], [x8]
268 store <7 x i8> %a, ptr %ptr
272 define void @store_v3i16(<3 x i16> %a, ptr %ptr){
273 ; CHECK-SD-LABEL: store_v3i16:
274 ; CHECK-SD: // %bb.0:
275 ; CHECK-SD-NEXT: add x8, x0, #4
276 ; CHECK-SD-NEXT: // kill: def $d0 killed $d0 def $q0
277 ; CHECK-SD-NEXT: str s0, [x0]
278 ; CHECK-SD-NEXT: st1 { v0.h }[2], [x8]
281 ; CHECK-GI-LABEL: store_v3i16:
282 ; CHECK-GI: // %bb.0:
283 ; CHECK-GI-NEXT: add x8, x0, #2
284 ; CHECK-GI-NEXT: add x9, x0, #4
285 ; CHECK-GI-NEXT: // kill: def $d0 killed $d0 def $q0
286 ; CHECK-GI-NEXT: str h0, [x0]
287 ; CHECK-GI-NEXT: st1 { v0.h }[1], [x8]
288 ; CHECK-GI-NEXT: st1 { v0.h }[2], [x9]
290 store <3 x i16> %a, ptr %ptr
294 define void @store_v7i16(<7 x i16> %a, ptr %ptr){
295 ; CHECK-SD-LABEL: store_v7i16:
296 ; CHECK-SD: // %bb.0:
297 ; CHECK-SD-NEXT: add x8, x0, #12
298 ; CHECK-SD-NEXT: add x9, x0, #8
299 ; CHECK-SD-NEXT: str d0, [x0]
300 ; CHECK-SD-NEXT: st1 { v0.h }[6], [x8]
301 ; CHECK-SD-NEXT: st1 { v0.s }[2], [x9]
304 ; CHECK-GI-LABEL: store_v7i16:
305 ; CHECK-GI: // %bb.0:
306 ; CHECK-GI-NEXT: add x8, x0, #2
307 ; CHECK-GI-NEXT: add x9, x0, #4
308 ; CHECK-GI-NEXT: str h0, [x0]
309 ; CHECK-GI-NEXT: st1 { v0.h }[1], [x8]
310 ; CHECK-GI-NEXT: add x8, x0, #6
311 ; CHECK-GI-NEXT: st1 { v0.h }[3], [x8]
312 ; CHECK-GI-NEXT: add x8, x0, #8
313 ; CHECK-GI-NEXT: st1 { v0.h }[4], [x8]
314 ; CHECK-GI-NEXT: add x8, x0, #10
315 ; CHECK-GI-NEXT: st1 { v0.h }[5], [x8]
316 ; CHECK-GI-NEXT: add x8, x0, #12
317 ; CHECK-GI-NEXT: st1 { v0.h }[2], [x9]
318 ; CHECK-GI-NEXT: st1 { v0.h }[6], [x8]
320 store <7 x i16> %a, ptr %ptr
324 define void @store_v3i32(<3 x i32> %a, ptr %ptr){
325 ; CHECK-SD-LABEL: store_v3i32:
326 ; CHECK-SD: // %bb.0:
327 ; CHECK-SD-NEXT: add x8, x0, #8
328 ; CHECK-SD-NEXT: str d0, [x0]
329 ; CHECK-SD-NEXT: st1 { v0.s }[2], [x8]
332 ; CHECK-GI-LABEL: store_v3i32:
333 ; CHECK-GI: // %bb.0:
334 ; CHECK-GI-NEXT: add x8, x0, #4
335 ; CHECK-GI-NEXT: add x9, x0, #8
336 ; CHECK-GI-NEXT: str s0, [x0]
337 ; CHECK-GI-NEXT: st1 { v0.s }[1], [x8]
338 ; CHECK-GI-NEXT: st1 { v0.s }[2], [x9]
340 store <3 x i32> %a, ptr %ptr
344 define void @store_v2i128(<2 x i128> %a, ptr %p) {
345 ; CHECK-SD-LABEL: store_v2i128:
346 ; CHECK-SD: // %bb.0:
347 ; CHECK-SD-NEXT: stp x2, x3, [x4, #16]
348 ; CHECK-SD-NEXT: stp x0, x1, [x4]
351 ; CHECK-GI-LABEL: store_v2i128:
352 ; CHECK-GI: // %bb.0:
353 ; CHECK-GI-NEXT: mov v0.d[0], x0
354 ; CHECK-GI-NEXT: mov v1.d[0], x2
355 ; CHECK-GI-NEXT: mov v0.d[1], x1
356 ; CHECK-GI-NEXT: mov v1.d[1], x3
357 ; CHECK-GI-NEXT: stp q0, q1, [x4]
359 store <2 x i128> %a, ptr %p
363 define void @store_v2f128(<2 x fp128> %a, ptr %p) {
364 ; CHECK-LABEL: store_v2f128:
366 ; CHECK-NEXT: stp q0, q1, [x0]
368 store <2 x fp128> %a, ptr %p