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
5 target triple = "aarch64-unknown-linux-gnu"
7 define <4 x i8> @shuffle_ext_byone_v4i8(<4 x i8> %op1, <4 x i8> %op2) {
8 ; CHECK-LABEL: shuffle_ext_byone_v4i8:
10 ; CHECK-NEXT: sub sp, sp, #16
11 ; CHECK-NEXT: .cfi_def_cfa_offset 16
12 ; CHECK-NEXT: // kill: def $d0 killed $d0 def $z0
13 ; CHECK-NEXT: mov z1.h, z0.h[1]
14 ; CHECK-NEXT: fmov w8, s0
15 ; CHECK-NEXT: mov z2.h, z0.h[2]
16 ; CHECK-NEXT: mov z3.h, z0.h[3]
17 ; CHECK-NEXT: strh w8, [sp, #8]
18 ; CHECK-NEXT: fmov w8, s1
19 ; CHECK-NEXT: fmov w9, s2
20 ; CHECK-NEXT: strh w8, [sp, #14]
21 ; CHECK-NEXT: fmov w8, s3
22 ; CHECK-NEXT: strh w9, [sp, #12]
23 ; CHECK-NEXT: strh w8, [sp, #10]
24 ; CHECK-NEXT: ldr d0, [sp, #8]
25 ; CHECK-NEXT: add sp, sp, #16
27 %ret = shufflevector <4 x i8> %op1, <4 x i8> %op2, <4 x i32> <i32 0, i32 3, i32 2, i32 1>
31 define <8 x i8> @shuffle_ext_byone_v8i8(<8 x i8> %op1, <8 x i8> %op2) {
32 ; CHECK-LABEL: shuffle_ext_byone_v8i8:
34 ; CHECK-NEXT: // kill: def $d0 killed $d0 def $z0
35 ; CHECK-NEXT: // kill: def $d1 killed $d1 def $z1
36 ; CHECK-NEXT: mov z0.b, z0.b[7]
37 ; CHECK-NEXT: fmov w8, s0
38 ; CHECK-NEXT: insr z1.b, w8
39 ; CHECK-NEXT: fmov d0, d1
41 %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>
45 define <16 x i8> @shuffle_ext_byone_v16i8(<16 x i8> %op1, <16 x i8> %op2) {
46 ; CHECK-LABEL: shuffle_ext_byone_v16i8:
48 ; CHECK-NEXT: // kill: def $q0 killed $q0 def $z0
49 ; CHECK-NEXT: // kill: def $q1 killed $q1 def $z1
50 ; CHECK-NEXT: mov z0.b, z0.b[15]
51 ; CHECK-NEXT: fmov w8, s0
52 ; CHECK-NEXT: insr z1.b, w8
53 ; CHECK-NEXT: mov z0.d, z1.d
55 %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,
56 i32 23, i32 24, i32 25, i32 26, i32 27, i32 28, i32 29, i32 30>
60 define void @shuffle_ext_byone_v32i8(ptr %a, ptr %b) {
61 ; CHECK-LABEL: shuffle_ext_byone_v32i8:
63 ; CHECK-NEXT: ldr q0, [x0, #16]
64 ; CHECK-NEXT: ldp q1, q3, [x1]
65 ; CHECK-NEXT: mov z0.b, z0.b[15]
66 ; CHECK-NEXT: mov z2.b, z1.b[15]
67 ; CHECK-NEXT: fmov w8, s0
68 ; CHECK-NEXT: insr z1.b, w8
69 ; CHECK-NEXT: fmov w8, s2
70 ; CHECK-NEXT: insr z3.b, w8
71 ; CHECK-NEXT: stp q1, q3, [x0]
73 %op1 = load <32 x i8>, ptr %a
74 %op2 = load <32 x i8>, ptr %b
75 %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,
76 i32 39, i32 40, i32 41, i32 42, i32 43, i32 44, i32 45, i32 46,
77 i32 47, i32 48, i32 49, i32 50, i32 51, i32 52, i32 53, i32 54,
78 i32 55, i32 56, i32 57, i32 58, i32 59, i32 60, i32 61, i32 62>
79 store <32 x i8> %ret, ptr %a
83 define <2 x i16> @shuffle_ext_byone_v2i16(<2 x i16> %op1, <2 x i16> %op2) {
84 ; CHECK-LABEL: shuffle_ext_byone_v2i16:
86 ; CHECK-NEXT: ptrue p0.d
87 ; CHECK-NEXT: // kill: def $d0 killed $d0 def $z0
88 ; CHECK-NEXT: revw z0.d, p0/m, z0.d
89 ; CHECK-NEXT: // kill: def $d0 killed $d0 killed $z0
91 %ret = shufflevector <2 x i16> %op1, <2 x i16> %op2, <2 x i32> <i32 1, i32 0>
95 define <4 x i16> @shuffle_ext_byone_v4i16(<4 x i16> %op1, <4 x i16> %op2) {
96 ; CHECK-LABEL: shuffle_ext_byone_v4i16:
98 ; CHECK-NEXT: // kill: def $d0 killed $d0 def $z0
99 ; CHECK-NEXT: // kill: def $d1 killed $d1 def $z1
100 ; CHECK-NEXT: mov z0.h, z0.h[3]
101 ; CHECK-NEXT: fmov w8, s0
102 ; CHECK-NEXT: insr z1.h, w8
103 ; CHECK-NEXT: fmov d0, d1
105 %ret = shufflevector <4 x i16> %op1, <4 x i16> %op2, <4 x i32> <i32 3, i32 4, i32 5, i32 6>
109 define <8 x i16> @shuffle_ext_byone_v8i16(<8 x i16> %op1, <8 x i16> %op2) {
110 ; CHECK-LABEL: shuffle_ext_byone_v8i16:
112 ; CHECK-NEXT: // kill: def $q0 killed $q0 def $z0
113 ; CHECK-NEXT: // kill: def $q1 killed $q1 def $z1
114 ; CHECK-NEXT: mov z0.h, z0.h[7]
115 ; CHECK-NEXT: fmov w8, s0
116 ; CHECK-NEXT: insr z1.h, w8
117 ; CHECK-NEXT: mov z0.d, z1.d
119 %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>
123 define void @shuffle_ext_byone_v16i16(ptr %a, ptr %b) {
124 ; CHECK-LABEL: shuffle_ext_byone_v16i16:
126 ; CHECK-NEXT: ldr q0, [x0, #16]
127 ; CHECK-NEXT: ldp q1, q3, [x1]
128 ; CHECK-NEXT: mov z0.h, z0.h[7]
129 ; CHECK-NEXT: mov z2.h, z1.h[7]
130 ; CHECK-NEXT: fmov w8, s0
131 ; CHECK-NEXT: insr z1.h, w8
132 ; CHECK-NEXT: fmov w8, s2
133 ; CHECK-NEXT: insr z3.h, w8
134 ; CHECK-NEXT: stp q1, q3, [x0]
136 %op1 = load <16 x i16>, ptr %a
137 %op2 = load <16 x i16>, ptr %b
138 %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,
139 i32 23, i32 24, i32 25, i32 26, i32 27, i32 28, i32 29, i32 30>
140 store <16 x i16> %ret, ptr %a
144 define <2 x i32> @shuffle_ext_byone_v2i32(<2 x i32> %op1, <2 x i32> %op2) {
145 ; CHECK-LABEL: shuffle_ext_byone_v2i32:
147 ; CHECK-NEXT: // kill: def $d0 killed $d0 def $z0
148 ; CHECK-NEXT: // kill: def $d1 killed $d1 def $z1
149 ; CHECK-NEXT: mov z0.s, z0.s[1]
150 ; CHECK-NEXT: fmov w8, s0
151 ; CHECK-NEXT: insr z1.s, w8
152 ; CHECK-NEXT: fmov d0, d1
154 %ret = shufflevector <2 x i32> %op1, <2 x i32> %op2, <2 x i32> <i32 1, i32 2>
158 define <4 x i32> @shuffle_ext_byone_v4i32(<4 x i32> %op1, <4 x i32> %op2) {
159 ; CHECK-LABEL: shuffle_ext_byone_v4i32:
161 ; CHECK-NEXT: // kill: def $q0 killed $q0 def $z0
162 ; CHECK-NEXT: // kill: def $q1 killed $q1 def $z1
163 ; CHECK-NEXT: mov z0.s, z0.s[3]
164 ; CHECK-NEXT: fmov w8, s0
165 ; CHECK-NEXT: insr z1.s, w8
166 ; CHECK-NEXT: mov z0.d, z1.d
168 %ret = shufflevector <4 x i32> %op1, <4 x i32> %op2, <4 x i32> <i32 3, i32 4, i32 5, i32 6>
172 define void @shuffle_ext_byone_v8i32(ptr %a, ptr %b) {
173 ; CHECK-LABEL: shuffle_ext_byone_v8i32:
175 ; CHECK-NEXT: ldr q0, [x0, #16]
176 ; CHECK-NEXT: ldp q1, q3, [x1]
177 ; CHECK-NEXT: mov z0.s, z0.s[3]
178 ; CHECK-NEXT: mov z2.s, z1.s[3]
179 ; CHECK-NEXT: fmov w8, s0
180 ; CHECK-NEXT: insr z1.s, w8
181 ; CHECK-NEXT: fmov w8, s2
182 ; CHECK-NEXT: insr z3.s, w8
183 ; CHECK-NEXT: stp q1, q3, [x0]
185 %op1 = load <8 x i32>, ptr %a
186 %op2 = load <8 x i32>, ptr %b
187 %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>
188 store <8 x i32> %ret, ptr %a
192 define <2 x i64> @shuffle_ext_byone_v2i64(<2 x i64> %op1, <2 x i64> %op2) {
193 ; CHECK-LABEL: shuffle_ext_byone_v2i64:
195 ; CHECK-NEXT: // kill: def $q0 killed $q0 def $z0
196 ; CHECK-NEXT: // kill: def $q1 killed $q1 def $z1
197 ; CHECK-NEXT: mov z0.d, z0.d[1]
198 ; CHECK-NEXT: fmov x8, d0
199 ; CHECK-NEXT: insr z1.d, x8
200 ; CHECK-NEXT: mov z0.d, z1.d
202 %ret = shufflevector <2 x i64> %op1, <2 x i64> %op2, <2 x i32> <i32 1, i32 2>
206 define void @shuffle_ext_byone_v4i64(ptr %a, ptr %b) {
207 ; CHECK-LABEL: shuffle_ext_byone_v4i64:
209 ; CHECK-NEXT: ldr q0, [x0, #16]
210 ; CHECK-NEXT: ldp q1, q3, [x1]
211 ; CHECK-NEXT: mov z0.d, z0.d[1]
212 ; CHECK-NEXT: mov z2.d, z1.d[1]
213 ; CHECK-NEXT: fmov x8, d0
214 ; CHECK-NEXT: insr z1.d, x8
215 ; CHECK-NEXT: fmov x8, d2
216 ; CHECK-NEXT: insr z3.d, x8
217 ; CHECK-NEXT: stp q1, q3, [x0]
219 %op1 = load <4 x i64>, ptr %a
220 %op2 = load <4 x i64>, ptr %b
221 %ret = shufflevector <4 x i64> %op1, <4 x i64> %op2, <4 x i32> <i32 3, i32 4, i32 5, i32 6>
222 store <4 x i64> %ret, ptr %a
227 define <4 x half> @shuffle_ext_byone_v4f16(<4 x half> %op1, <4 x half> %op2) {
228 ; CHECK-LABEL: shuffle_ext_byone_v4f16:
230 ; CHECK-NEXT: // kill: def $d0 killed $d0 def $z0
231 ; CHECK-NEXT: mov z2.h, z0.h[3]
232 ; CHECK-NEXT: fmov d0, d1
233 ; CHECK-NEXT: insr z0.h, h2
234 ; CHECK-NEXT: // kill: def $d0 killed $d0 killed $z0
236 %ret = shufflevector <4 x half> %op1, <4 x half> %op2, <4 x i32> <i32 3, i32 4, i32 5, i32 6>
240 define <8 x half> @shuffle_ext_byone_v8f16(<8 x half> %op1, <8 x half> %op2) {
241 ; CHECK-LABEL: shuffle_ext_byone_v8f16:
243 ; CHECK-NEXT: // kill: def $q0 killed $q0 def $z0
244 ; CHECK-NEXT: mov z2.h, z0.h[7]
245 ; CHECK-NEXT: mov z0.d, z1.d
246 ; CHECK-NEXT: insr z0.h, h2
247 ; CHECK-NEXT: // kill: def $q0 killed $q0 killed $z0
249 %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>
253 define void @shuffle_ext_byone_v16f16(ptr %a, ptr %b) {
254 ; CHECK-LABEL: shuffle_ext_byone_v16f16:
256 ; CHECK-NEXT: ldp q1, q3, [x1]
257 ; CHECK-NEXT: ldr q0, [x0, #16]
258 ; CHECK-NEXT: mov z0.h, z0.h[7]
259 ; CHECK-NEXT: mov z2.h, z1.h[7]
260 ; CHECK-NEXT: insr z1.h, h0
261 ; CHECK-NEXT: insr z3.h, h2
262 ; CHECK-NEXT: stp q1, q3, [x0]
264 %op1 = load <16 x half>, ptr %a
265 %op2 = load <16 x half>, ptr %b
266 %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,
267 i32 23, i32 24, i32 25, i32 26, i32 27, i32 28, i32 29, i32 30>
268 store <16 x half> %ret, ptr %a
272 define <2 x float> @shuffle_ext_byone_v2f32(<2 x float> %op1, <2 x float> %op2) {
273 ; CHECK-LABEL: shuffle_ext_byone_v2f32:
275 ; CHECK-NEXT: // kill: def $d0 killed $d0 def $z0
276 ; CHECK-NEXT: mov z2.s, z0.s[1]
277 ; CHECK-NEXT: fmov d0, d1
278 ; CHECK-NEXT: insr z0.s, s2
279 ; CHECK-NEXT: // kill: def $d0 killed $d0 killed $z0
281 %ret = shufflevector <2 x float> %op1, <2 x float> %op2, <2 x i32> <i32 1, i32 2>
285 define <4 x float> @shuffle_ext_byone_v4f32(<4 x float> %op1, <4 x float> %op2) {
286 ; CHECK-LABEL: shuffle_ext_byone_v4f32:
288 ; CHECK-NEXT: // kill: def $q0 killed $q0 def $z0
289 ; CHECK-NEXT: mov z2.s, z0.s[3]
290 ; CHECK-NEXT: mov z0.d, z1.d
291 ; CHECK-NEXT: insr z0.s, s2
292 ; CHECK-NEXT: // kill: def $q0 killed $q0 killed $z0
294 %ret = shufflevector <4 x float> %op1, <4 x float> %op2, <4 x i32> <i32 3, i32 4, i32 5, i32 6>
298 define void @shuffle_ext_byone_v8f32(ptr %a, ptr %b) {
299 ; CHECK-LABEL: shuffle_ext_byone_v8f32:
301 ; CHECK-NEXT: ldp q1, q3, [x1]
302 ; CHECK-NEXT: ldr q0, [x0, #16]
303 ; CHECK-NEXT: mov z0.s, z0.s[3]
304 ; CHECK-NEXT: mov z2.s, z1.s[3]
305 ; CHECK-NEXT: insr z1.s, s0
306 ; CHECK-NEXT: insr z3.s, s2
307 ; CHECK-NEXT: stp q1, q3, [x0]
309 %op1 = load <8 x float>, ptr %a
310 %op2 = load <8 x float>, ptr %b
311 %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>
312 store <8 x float> %ret, ptr %a
316 define <2 x double> @shuffle_ext_byone_v2f64(<2 x double> %op1, <2 x double> %op2) {
317 ; CHECK-LABEL: shuffle_ext_byone_v2f64:
319 ; CHECK-NEXT: // kill: def $q0 killed $q0 def $z0
320 ; CHECK-NEXT: mov z2.d, z0.d[1]
321 ; CHECK-NEXT: mov z0.d, z1.d
322 ; CHECK-NEXT: insr z0.d, d2
323 ; CHECK-NEXT: // kill: def $q0 killed $q0 killed $z0
325 %ret = shufflevector <2 x double> %op1, <2 x double> %op2, <2 x i32> <i32 1, i32 2>
326 ret <2 x double> %ret
329 define void @shuffle_ext_byone_v4f64(ptr %a, ptr %b) {
330 ; CHECK-LABEL: shuffle_ext_byone_v4f64:
332 ; CHECK-NEXT: ldp q1, q3, [x1]
333 ; CHECK-NEXT: ldr q0, [x0, #16]
334 ; CHECK-NEXT: mov z0.d, z0.d[1]
335 ; CHECK-NEXT: mov z2.d, z1.d[1]
336 ; CHECK-NEXT: insr z1.d, d0
337 ; CHECK-NEXT: insr z3.d, d2
338 ; CHECK-NEXT: stp q1, q3, [x0]
340 %op1 = load <4 x double>, ptr %a
341 %op2 = load <4 x double>, ptr %b
342 %ret = shufflevector <4 x double> %op1, <4 x double> %op2, <4 x i32> <i32 3, i32 4, i32 5, i32 6>
343 store <4 x double> %ret, ptr %a
347 define void @shuffle_ext_byone_reverse(ptr %a, ptr %b) {
348 ; CHECK-LABEL: shuffle_ext_byone_reverse:
350 ; CHECK-NEXT: ldp q1, q3, [x0]
351 ; CHECK-NEXT: ldr q0, [x1, #16]
352 ; CHECK-NEXT: mov z0.d, z0.d[1]
353 ; CHECK-NEXT: mov z2.d, z1.d[1]
354 ; CHECK-NEXT: insr z1.d, d0
355 ; CHECK-NEXT: insr z3.d, d2
356 ; CHECK-NEXT: stp q1, q3, [x0]
358 %op1 = load <4 x double>, ptr %a
359 %op2 = load <4 x double>, ptr %b
360 %ret = shufflevector <4 x double> %op1, <4 x double> %op2, <4 x i32> <i32 7, i32 0, i32 1, i32 2>
361 store <4 x double> %ret, ptr %a
365 define void @shuffle_ext_invalid(ptr %a, ptr %b) {
366 ; CHECK-LABEL: shuffle_ext_invalid:
368 ; CHECK-NEXT: ldr q0, [x0, #16]
369 ; CHECK-NEXT: ldr q1, [x1]
370 ; CHECK-NEXT: stp q0, q1, [x0]
372 %op1 = load <4 x double>, ptr %a
373 %op2 = load <4 x double>, ptr %b
374 %ret = shufflevector <4 x double> %op1, <4 x double> %op2, <4 x i32> <i32 2, i32 3, i32 4, i32 5>
375 store <4 x double> %ret, ptr %a