1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mattr=+sve -force-streaming-compatible-sve < %s | FileCheck %s
3 ; RUN: llc -mattr=+sme -force-streaming-compatible-sve < %s | FileCheck %s
6 target triple = "aarch64-unknown-linux-gnu"
8 define <4 x i8> @shuffle_ext_byone_v4i8(<4 x i8> %op1, <4 x i8> %op2) {
9 ; CHECK-LABEL: shuffle_ext_byone_v4i8:
11 ; CHECK-NEXT: sub sp, sp, #16
12 ; CHECK-NEXT: .cfi_def_cfa_offset 16
13 ; CHECK-NEXT: // kill: def $d0 killed $d0 def $z0
14 ; CHECK-NEXT: mov z1.h, z0.h[1]
15 ; CHECK-NEXT: fmov w8, s0
16 ; CHECK-NEXT: mov z2.h, z0.h[2]
17 ; CHECK-NEXT: mov z3.h, z0.h[3]
18 ; CHECK-NEXT: strh w8, [sp, #8]
19 ; CHECK-NEXT: fmov w8, s1
20 ; CHECK-NEXT: fmov w9, s2
21 ; CHECK-NEXT: strh w8, [sp, #14]
22 ; CHECK-NEXT: fmov w8, s3
23 ; CHECK-NEXT: strh w9, [sp, #12]
24 ; CHECK-NEXT: strh w8, [sp, #10]
25 ; CHECK-NEXT: ldr d0, [sp, #8]
26 ; CHECK-NEXT: add sp, sp, #16
28 %ret = shufflevector <4 x i8> %op1, <4 x i8> %op2, <4 x i32> <i32 0, i32 3, i32 2, i32 1>
32 define <8 x i8> @shuffle_ext_byone_v8i8(<8 x i8> %op1, <8 x i8> %op2) {
33 ; CHECK-LABEL: shuffle_ext_byone_v8i8:
35 ; CHECK-NEXT: // kill: def $d0 killed $d0 def $z0
36 ; CHECK-NEXT: // kill: def $d1 killed $d1 def $z1
37 ; CHECK-NEXT: mov z0.b, z0.b[7]
38 ; CHECK-NEXT: fmov w8, s0
39 ; CHECK-NEXT: insr z1.b, w8
40 ; CHECK-NEXT: fmov d0, d1
42 %ret = shufflevector <8 x i8> %op1, <8 x i8> %op2, <8 x i32> <i32 7, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14>
46 define <16 x i8> @shuffle_ext_byone_v16i8(<16 x i8> %op1, <16 x i8> %op2) {
47 ; CHECK-LABEL: shuffle_ext_byone_v16i8:
49 ; CHECK-NEXT: // kill: def $q0 killed $q0 def $z0
50 ; CHECK-NEXT: // kill: def $q1 killed $q1 def $z1
51 ; CHECK-NEXT: mov z0.b, z0.b[15]
52 ; CHECK-NEXT: fmov w8, s0
53 ; CHECK-NEXT: insr z1.b, w8
54 ; CHECK-NEXT: mov z0.d, z1.d
56 %ret = shufflevector <16 x i8> %op1, <16 x i8> %op2, <16 x i32> <i32 15, i32 16, i32 17, i32 18, i32 19, i32 20, i32 21, i32 22,
57 i32 23, i32 24, i32 25, i32 26, i32 27, i32 28, i32 29, i32 30>
61 define void @shuffle_ext_byone_v32i8(ptr %a, ptr %b) {
62 ; CHECK-LABEL: shuffle_ext_byone_v32i8:
64 ; CHECK-NEXT: ldr q0, [x0, #16]
65 ; CHECK-NEXT: ldp q1, q3, [x1]
66 ; CHECK-NEXT: mov z0.b, z0.b[15]
67 ; CHECK-NEXT: mov z2.b, z1.b[15]
68 ; CHECK-NEXT: fmov w8, s0
69 ; CHECK-NEXT: insr z1.b, w8
70 ; CHECK-NEXT: fmov w8, s2
71 ; CHECK-NEXT: insr z3.b, w8
72 ; CHECK-NEXT: stp q1, q3, [x0]
74 %op1 = load <32 x i8>, ptr %a
75 %op2 = load <32 x i8>, ptr %b
76 %ret = shufflevector <32 x i8> %op1, <32 x i8> %op2, <32 x i32> <i32 31, i32 32, i32 33, i32 34, i32 35, i32 36, i32 37, i32 38,
77 i32 39, i32 40, i32 41, i32 42, i32 43, i32 44, i32 45, i32 46,
78 i32 47, i32 48, i32 49, i32 50, i32 51, i32 52, i32 53, i32 54,
79 i32 55, i32 56, i32 57, i32 58, i32 59, i32 60, i32 61, i32 62>
80 store <32 x i8> %ret, ptr %a
84 define <2 x i16> @shuffle_ext_byone_v2i16(<2 x i16> %op1, <2 x i16> %op2) {
85 ; CHECK-LABEL: shuffle_ext_byone_v2i16:
87 ; CHECK-NEXT: ptrue p0.d
88 ; CHECK-NEXT: // kill: def $d0 killed $d0 def $z0
89 ; CHECK-NEXT: revw z0.d, p0/m, z0.d
90 ; CHECK-NEXT: // kill: def $d0 killed $d0 killed $z0
92 %ret = shufflevector <2 x i16> %op1, <2 x i16> %op2, <2 x i32> <i32 1, i32 0>
96 define <4 x i16> @shuffle_ext_byone_v4i16(<4 x i16> %op1, <4 x i16> %op2) {
97 ; CHECK-LABEL: shuffle_ext_byone_v4i16:
99 ; CHECK-NEXT: // kill: def $d0 killed $d0 def $z0
100 ; CHECK-NEXT: // kill: def $d1 killed $d1 def $z1
101 ; CHECK-NEXT: mov z0.h, z0.h[3]
102 ; CHECK-NEXT: fmov w8, s0
103 ; CHECK-NEXT: insr z1.h, w8
104 ; CHECK-NEXT: fmov d0, d1
106 %ret = shufflevector <4 x i16> %op1, <4 x i16> %op2, <4 x i32> <i32 3, i32 4, i32 5, i32 6>
110 define <8 x i16> @shuffle_ext_byone_v8i16(<8 x i16> %op1, <8 x i16> %op2) {
111 ; CHECK-LABEL: shuffle_ext_byone_v8i16:
113 ; CHECK-NEXT: // kill: def $q0 killed $q0 def $z0
114 ; CHECK-NEXT: // kill: def $q1 killed $q1 def $z1
115 ; CHECK-NEXT: mov z0.h, z0.h[7]
116 ; CHECK-NEXT: fmov w8, s0
117 ; CHECK-NEXT: insr z1.h, w8
118 ; CHECK-NEXT: mov z0.d, z1.d
120 %ret = shufflevector <8 x i16> %op1, <8 x i16> %op2, <8 x i32> <i32 7, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14>
124 define void @shuffle_ext_byone_v16i16(ptr %a, ptr %b) {
125 ; CHECK-LABEL: shuffle_ext_byone_v16i16:
127 ; CHECK-NEXT: ldr q0, [x0, #16]
128 ; CHECK-NEXT: ldp q1, q3, [x1]
129 ; CHECK-NEXT: mov z0.h, z0.h[7]
130 ; CHECK-NEXT: mov z2.h, z1.h[7]
131 ; CHECK-NEXT: fmov w8, s0
132 ; CHECK-NEXT: insr z1.h, w8
133 ; CHECK-NEXT: fmov w8, s2
134 ; CHECK-NEXT: insr z3.h, w8
135 ; CHECK-NEXT: stp q1, q3, [x0]
137 %op1 = load <16 x i16>, ptr %a
138 %op2 = load <16 x i16>, ptr %b
139 %ret = shufflevector <16 x i16> %op1, <16 x i16> %op2, <16 x i32> <i32 15, i32 16, i32 17, i32 18, i32 19, i32 20, i32 21, i32 22,
140 i32 23, i32 24, i32 25, i32 26, i32 27, i32 28, i32 29, i32 30>
141 store <16 x i16> %ret, ptr %a
145 define <2 x i32> @shuffle_ext_byone_v2i32(<2 x i32> %op1, <2 x i32> %op2) {
146 ; CHECK-LABEL: shuffle_ext_byone_v2i32:
148 ; CHECK-NEXT: // kill: def $d0 killed $d0 def $z0
149 ; CHECK-NEXT: // kill: def $d1 killed $d1 def $z1
150 ; CHECK-NEXT: mov z0.s, z0.s[1]
151 ; CHECK-NEXT: fmov w8, s0
152 ; CHECK-NEXT: insr z1.s, w8
153 ; CHECK-NEXT: fmov d0, d1
155 %ret = shufflevector <2 x i32> %op1, <2 x i32> %op2, <2 x i32> <i32 1, i32 2>
159 define <4 x i32> @shuffle_ext_byone_v4i32(<4 x i32> %op1, <4 x i32> %op2) {
160 ; CHECK-LABEL: shuffle_ext_byone_v4i32:
162 ; CHECK-NEXT: // kill: def $q0 killed $q0 def $z0
163 ; CHECK-NEXT: // kill: def $q1 killed $q1 def $z1
164 ; CHECK-NEXT: mov z0.s, z0.s[3]
165 ; CHECK-NEXT: fmov w8, s0
166 ; CHECK-NEXT: insr z1.s, w8
167 ; CHECK-NEXT: mov z0.d, z1.d
169 %ret = shufflevector <4 x i32> %op1, <4 x i32> %op2, <4 x i32> <i32 3, i32 4, i32 5, i32 6>
173 define void @shuffle_ext_byone_v8i32(ptr %a, ptr %b) {
174 ; CHECK-LABEL: shuffle_ext_byone_v8i32:
176 ; CHECK-NEXT: ldr q0, [x0, #16]
177 ; CHECK-NEXT: ldp q1, q3, [x1]
178 ; CHECK-NEXT: mov z0.s, z0.s[3]
179 ; CHECK-NEXT: mov z2.s, z1.s[3]
180 ; CHECK-NEXT: fmov w8, s0
181 ; CHECK-NEXT: insr z1.s, w8
182 ; CHECK-NEXT: fmov w8, s2
183 ; CHECK-NEXT: insr z3.s, w8
184 ; CHECK-NEXT: stp q1, q3, [x0]
186 %op1 = load <8 x i32>, ptr %a
187 %op2 = load <8 x i32>, ptr %b
188 %ret = shufflevector <8 x i32> %op1, <8 x i32> %op2, <8 x i32> <i32 7, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14>
189 store <8 x i32> %ret, ptr %a
193 define <2 x i64> @shuffle_ext_byone_v2i64(<2 x i64> %op1, <2 x i64> %op2) {
194 ; CHECK-LABEL: shuffle_ext_byone_v2i64:
196 ; CHECK-NEXT: // kill: def $q0 killed $q0 def $z0
197 ; CHECK-NEXT: // kill: def $q1 killed $q1 def $z1
198 ; CHECK-NEXT: mov z0.d, z0.d[1]
199 ; CHECK-NEXT: fmov x8, d0
200 ; CHECK-NEXT: insr z1.d, x8
201 ; CHECK-NEXT: mov z0.d, z1.d
203 %ret = shufflevector <2 x i64> %op1, <2 x i64> %op2, <2 x i32> <i32 1, i32 2>
207 define void @shuffle_ext_byone_v4i64(ptr %a, ptr %b) {
208 ; CHECK-LABEL: shuffle_ext_byone_v4i64:
210 ; CHECK-NEXT: ldr q0, [x0, #16]
211 ; CHECK-NEXT: ldp q1, q3, [x1]
212 ; CHECK-NEXT: mov z0.d, z0.d[1]
213 ; CHECK-NEXT: mov z2.d, z1.d[1]
214 ; CHECK-NEXT: fmov x8, d0
215 ; CHECK-NEXT: insr z1.d, x8
216 ; CHECK-NEXT: fmov x8, d2
217 ; CHECK-NEXT: insr z3.d, x8
218 ; CHECK-NEXT: stp q1, q3, [x0]
220 %op1 = load <4 x i64>, ptr %a
221 %op2 = load <4 x i64>, ptr %b
222 %ret = shufflevector <4 x i64> %op1, <4 x i64> %op2, <4 x i32> <i32 3, i32 4, i32 5, i32 6>
223 store <4 x i64> %ret, ptr %a
228 define <4 x half> @shuffle_ext_byone_v4f16(<4 x half> %op1, <4 x half> %op2) {
229 ; CHECK-LABEL: shuffle_ext_byone_v4f16:
231 ; CHECK-NEXT: // kill: def $d0 killed $d0 def $z0
232 ; CHECK-NEXT: mov z2.h, z0.h[3]
233 ; CHECK-NEXT: fmov d0, d1
234 ; CHECK-NEXT: insr z0.h, h2
235 ; CHECK-NEXT: // kill: def $d0 killed $d0 killed $z0
237 %ret = shufflevector <4 x half> %op1, <4 x half> %op2, <4 x i32> <i32 3, i32 4, i32 5, i32 6>
241 define <8 x half> @shuffle_ext_byone_v8f16(<8 x half> %op1, <8 x half> %op2) {
242 ; CHECK-LABEL: shuffle_ext_byone_v8f16:
244 ; CHECK-NEXT: // kill: def $q0 killed $q0 def $z0
245 ; CHECK-NEXT: mov z2.h, z0.h[7]
246 ; CHECK-NEXT: mov z0.d, z1.d
247 ; CHECK-NEXT: insr z0.h, h2
248 ; CHECK-NEXT: // kill: def $q0 killed $q0 killed $z0
250 %ret = shufflevector <8 x half> %op1, <8 x half> %op2, <8 x i32> <i32 7, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14>
254 define void @shuffle_ext_byone_v16f16(ptr %a, ptr %b) {
255 ; CHECK-LABEL: shuffle_ext_byone_v16f16:
257 ; CHECK-NEXT: ldp q1, q3, [x1]
258 ; CHECK-NEXT: ldr q0, [x0, #16]
259 ; CHECK-NEXT: mov z0.h, z0.h[7]
260 ; CHECK-NEXT: mov z2.h, z1.h[7]
261 ; CHECK-NEXT: insr z1.h, h0
262 ; CHECK-NEXT: insr z3.h, h2
263 ; CHECK-NEXT: stp q1, q3, [x0]
265 %op1 = load <16 x half>, ptr %a
266 %op2 = load <16 x half>, ptr %b
267 %ret = shufflevector <16 x half> %op1, <16 x half> %op2, <16 x i32> <i32 15, i32 16, i32 17, i32 18, i32 19, i32 20, i32 21, i32 22,
268 i32 23, i32 24, i32 25, i32 26, i32 27, i32 28, i32 29, i32 30>
269 store <16 x half> %ret, ptr %a
273 define <2 x float> @shuffle_ext_byone_v2f32(<2 x float> %op1, <2 x float> %op2) {
274 ; CHECK-LABEL: shuffle_ext_byone_v2f32:
276 ; CHECK-NEXT: // kill: def $d0 killed $d0 def $z0
277 ; CHECK-NEXT: mov z2.s, z0.s[1]
278 ; CHECK-NEXT: fmov d0, d1
279 ; CHECK-NEXT: insr z0.s, s2
280 ; CHECK-NEXT: // kill: def $d0 killed $d0 killed $z0
282 %ret = shufflevector <2 x float> %op1, <2 x float> %op2, <2 x i32> <i32 1, i32 2>
286 define <4 x float> @shuffle_ext_byone_v4f32(<4 x float> %op1, <4 x float> %op2) {
287 ; CHECK-LABEL: shuffle_ext_byone_v4f32:
289 ; CHECK-NEXT: // kill: def $q0 killed $q0 def $z0
290 ; CHECK-NEXT: mov z2.s, z0.s[3]
291 ; CHECK-NEXT: mov z0.d, z1.d
292 ; CHECK-NEXT: insr z0.s, s2
293 ; CHECK-NEXT: // kill: def $q0 killed $q0 killed $z0
295 %ret = shufflevector <4 x float> %op1, <4 x float> %op2, <4 x i32> <i32 3, i32 4, i32 5, i32 6>
299 define void @shuffle_ext_byone_v8f32(ptr %a, ptr %b) {
300 ; CHECK-LABEL: shuffle_ext_byone_v8f32:
302 ; CHECK-NEXT: ldp q1, q3, [x1]
303 ; CHECK-NEXT: ldr q0, [x0, #16]
304 ; CHECK-NEXT: mov z0.s, z0.s[3]
305 ; CHECK-NEXT: mov z2.s, z1.s[3]
306 ; CHECK-NEXT: insr z1.s, s0
307 ; CHECK-NEXT: insr z3.s, s2
308 ; CHECK-NEXT: stp q1, q3, [x0]
310 %op1 = load <8 x float>, ptr %a
311 %op2 = load <8 x float>, ptr %b
312 %ret = shufflevector <8 x float> %op1, <8 x float> %op2, <8 x i32> <i32 7, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14>
313 store <8 x float> %ret, ptr %a
317 define <2 x double> @shuffle_ext_byone_v2f64(<2 x double> %op1, <2 x double> %op2) {
318 ; CHECK-LABEL: shuffle_ext_byone_v2f64:
320 ; CHECK-NEXT: // kill: def $q0 killed $q0 def $z0
321 ; CHECK-NEXT: mov z2.d, z0.d[1]
322 ; CHECK-NEXT: mov z0.d, z1.d
323 ; CHECK-NEXT: insr z0.d, d2
324 ; CHECK-NEXT: // kill: def $q0 killed $q0 killed $z0
326 %ret = shufflevector <2 x double> %op1, <2 x double> %op2, <2 x i32> <i32 1, i32 2>
327 ret <2 x double> %ret
330 define void @shuffle_ext_byone_v4f64(ptr %a, ptr %b) {
331 ; CHECK-LABEL: shuffle_ext_byone_v4f64:
333 ; CHECK-NEXT: ldp q1, q3, [x1]
334 ; CHECK-NEXT: ldr q0, [x0, #16]
335 ; CHECK-NEXT: mov z0.d, z0.d[1]
336 ; CHECK-NEXT: mov z2.d, z1.d[1]
337 ; CHECK-NEXT: insr z1.d, d0
338 ; CHECK-NEXT: insr z3.d, d2
339 ; CHECK-NEXT: stp q1, q3, [x0]
341 %op1 = load <4 x double>, ptr %a
342 %op2 = load <4 x double>, ptr %b
343 %ret = shufflevector <4 x double> %op1, <4 x double> %op2, <4 x i32> <i32 3, i32 4, i32 5, i32 6>
344 store <4 x double> %ret, ptr %a
348 define void @shuffle_ext_byone_reverse(ptr %a, ptr %b) {
349 ; CHECK-LABEL: shuffle_ext_byone_reverse:
351 ; CHECK-NEXT: ldp q1, q3, [x0]
352 ; CHECK-NEXT: ldr q0, [x1, #16]
353 ; CHECK-NEXT: mov z0.d, z0.d[1]
354 ; CHECK-NEXT: mov z2.d, z1.d[1]
355 ; CHECK-NEXT: insr z1.d, d0
356 ; CHECK-NEXT: insr z3.d, d2
357 ; CHECK-NEXT: stp q1, q3, [x0]
359 %op1 = load <4 x double>, ptr %a
360 %op2 = load <4 x double>, ptr %b
361 %ret = shufflevector <4 x double> %op1, <4 x double> %op2, <4 x i32> <i32 7, i32 0, i32 1, i32 2>
362 store <4 x double> %ret, ptr %a
366 define void @shuffle_ext_invalid(ptr %a, ptr %b) {
367 ; CHECK-LABEL: shuffle_ext_invalid:
369 ; CHECK-NEXT: ldr q0, [x0, #16]
370 ; CHECK-NEXT: ldr q1, [x1]
371 ; CHECK-NEXT: stp q0, q1, [x0]
373 %op1 = load <4 x double>, ptr %a
374 %op2 = load <4 x double>, ptr %b
375 %ret = shufflevector <4 x double> %op1, <4 x double> %op2, <4 x i32> <i32 2, i32 3, i32 4, i32 5>
376 store <4 x double> %ret, ptr %a