1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=aarch64 %s -o - | FileCheck %s --check-prefixes=CHECK,CHECK-SD
3 ; RUN: llc -mtriple=aarch64 -global-isel -global-isel-abort=2 %s -o - 2>&1 | FileCheck %s --check-prefixes=CHECK,CHECK-GI
5 define <4 x i8> @concat1(<2 x i8> %A, <2 x i8> %B) {
6 ; CHECK-SD-LABEL: concat1:
8 ; CHECK-SD-NEXT: uzp1 v0.4h, v0.4h, v1.4h
11 ; CHECK-GI-LABEL: concat1:
13 ; CHECK-GI-NEXT: // kill: def $d0 killed $d0 def $q0
14 ; CHECK-GI-NEXT: mov s2, v0.s[1]
15 ; CHECK-GI-NEXT: // kill: def $d1 killed $d1 def $q1
16 ; CHECK-GI-NEXT: mov v0.b[1], v2.b[0]
17 ; CHECK-GI-NEXT: mov s2, v1.s[1]
18 ; CHECK-GI-NEXT: mov v0.b[2], v1.b[0]
19 ; CHECK-GI-NEXT: mov v0.b[3], v2.b[0]
20 ; CHECK-GI-NEXT: ushll v0.8h, v0.8b, #0
21 ; CHECK-GI-NEXT: // kill: def $d0 killed $d0 killed $q0
23 %v4i8 = shufflevector <2 x i8> %A, <2 x i8> %B, <4 x i32> <i32 0, i32 1, i32 2, i32 3>
27 define <8 x i8> @concat2(<4 x i8> %A, <4 x i8> %B) {
28 ; CHECK-SD-LABEL: concat2:
30 ; CHECK-SD-NEXT: uzp1 v0.8b, v0.8b, v1.8b
33 ; CHECK-GI-LABEL: concat2:
35 ; CHECK-GI-NEXT: // kill: def $d1 killed $d1 def $q1
36 ; CHECK-GI-NEXT: mov h2, v1.h[1]
37 ; CHECK-GI-NEXT: // kill: def $d0 killed $d0 def $q0
38 ; CHECK-GI-NEXT: mov h3, v0.h[1]
39 ; CHECK-GI-NEXT: mov h4, v1.h[2]
40 ; CHECK-GI-NEXT: mov h5, v1.h[3]
41 ; CHECK-GI-NEXT: mov h6, v0.h[3]
42 ; CHECK-GI-NEXT: mov v1.h[1], v2.h[0]
43 ; CHECK-GI-NEXT: mov h2, v0.h[2]
44 ; CHECK-GI-NEXT: mov v0.h[1], v3.h[0]
45 ; CHECK-GI-NEXT: mov v1.h[2], v4.h[0]
46 ; CHECK-GI-NEXT: mov v0.h[2], v2.h[0]
47 ; CHECK-GI-NEXT: mov v1.h[3], v5.h[0]
48 ; CHECK-GI-NEXT: mov v0.h[3], v6.h[0]
49 ; CHECK-GI-NEXT: xtn v1.8b, v1.8h
50 ; CHECK-GI-NEXT: xtn v0.8b, v0.8h
51 ; CHECK-GI-NEXT: fmov w8, s1
52 ; CHECK-GI-NEXT: mov v0.s[1], w8
53 ; CHECK-GI-NEXT: // kill: def $d0 killed $d0 killed $q0
55 %v8i8 = shufflevector <4 x i8> %A, <4 x i8> %B, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7>
59 define <16 x i8> @concat3(<8 x i8> %A, <8 x i8> %B) {
60 ; CHECK-LABEL: concat3:
62 ; CHECK-NEXT: // kill: def $d0 killed $d0 def $q0
63 ; CHECK-NEXT: // kill: def $d1 killed $d1 def $q1
64 ; CHECK-NEXT: mov v0.d[1], v1.d[0]
66 %v16i8 = shufflevector <8 x i8> %A, <8 x i8> %B, <16 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15>
70 define <4 x i16> @concat4(<2 x i16> %A, <2 x i16> %B) {
71 ; CHECK-SD-LABEL: concat4:
73 ; CHECK-SD-NEXT: uzp1 v0.4h, v0.4h, v1.4h
76 ; CHECK-GI-LABEL: concat4:
78 ; CHECK-GI-NEXT: // kill: def $d1 killed $d1 def $q1
79 ; CHECK-GI-NEXT: mov s2, v1.s[1]
80 ; CHECK-GI-NEXT: // kill: def $d0 killed $d0 def $q0
81 ; CHECK-GI-NEXT: mov s3, v0.s[1]
82 ; CHECK-GI-NEXT: mov v1.s[1], v2.s[0]
83 ; CHECK-GI-NEXT: mov v0.s[1], v3.s[0]
84 ; CHECK-GI-NEXT: xtn v1.4h, v1.4s
85 ; CHECK-GI-NEXT: xtn v0.4h, v0.4s
86 ; CHECK-GI-NEXT: fmov w8, s1
87 ; CHECK-GI-NEXT: mov v0.s[1], w8
88 ; CHECK-GI-NEXT: // kill: def $d0 killed $d0 killed $q0
90 %v4i16 = shufflevector <2 x i16> %A, <2 x i16> %B, <4 x i32> <i32 0, i32 1, i32 2, i32 3>
94 define <8 x i16> @concat5(<4 x i16> %A, <4 x i16> %B) {
95 ; CHECK-LABEL: concat5:
97 ; CHECK-NEXT: // kill: def $d0 killed $d0 def $q0
98 ; CHECK-NEXT: // kill: def $d1 killed $d1 def $q1
99 ; CHECK-NEXT: mov v0.d[1], v1.d[0]
101 %v8i16 = shufflevector <4 x i16> %A, <4 x i16> %B, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7>
105 define <16 x i16> @concat6(ptr %A, ptr %B) {
106 ; CHECK-LABEL: concat6:
108 ; CHECK-NEXT: ldr q0, [x0]
109 ; CHECK-NEXT: ldr q1, [x1]
111 %tmp1 = load <8 x i16>, ptr %A
112 %tmp2 = load <8 x i16>, ptr %B
113 %v16i16 = shufflevector <8 x i16> %tmp1, <8 x i16> %tmp2, <16 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15>
114 ret <16 x i16> %v16i16
117 define <4 x i32> @concat7(<2 x i32> %A, <2 x i32> %B) {
118 ; CHECK-LABEL: concat7:
120 ; CHECK-NEXT: // kill: def $d0 killed $d0 def $q0
121 ; CHECK-NEXT: // kill: def $d1 killed $d1 def $q1
122 ; CHECK-NEXT: mov v0.d[1], v1.d[0]
124 %v4i32 = shufflevector <2 x i32> %A, <2 x i32> %B, <4 x i32> <i32 0, i32 1, i32 2, i32 3>
128 define <8 x i32> @concat8(ptr %A, ptr %B) {
129 ; CHECK-LABEL: concat8:
131 ; CHECK-NEXT: ldr q0, [x0]
132 ; CHECK-NEXT: ldr q1, [x1]
134 %tmp1 = load <4 x i32>, ptr %A
135 %tmp2 = load <4 x i32>, ptr %B
136 %v8i32 = shufflevector <4 x i32> %tmp1, <4 x i32> %tmp2, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7>
140 define <4 x half> @concat9(<2 x half> %A, <2 x half> %B) {
141 ; CHECK-SD-LABEL: concat9:
142 ; CHECK-SD: // %bb.0:
143 ; CHECK-SD-NEXT: zip1 v0.2s, v0.2s, v1.2s
146 ; CHECK-GI-LABEL: concat9:
147 ; CHECK-GI: // %bb.0:
148 ; CHECK-GI-NEXT: fmov w8, s1
149 ; CHECK-GI-NEXT: // kill: def $d0 killed $d0 def $q0
150 ; CHECK-GI-NEXT: mov v0.s[1], w8
151 ; CHECK-GI-NEXT: // kill: def $d0 killed $d0 killed $q0
153 %v4half= shufflevector <2 x half> %A, <2 x half> %B, <4 x i32> <i32 0, i32 1, i32 2, i32 3>
154 ret <4 x half> %v4half
157 define <8 x half> @concat10(<4 x half> %A, <4 x half> %B) {
158 ; CHECK-LABEL: concat10:
160 ; CHECK-NEXT: // kill: def $d0 killed $d0 def $q0
161 ; CHECK-NEXT: // kill: def $d1 killed $d1 def $q1
162 ; CHECK-NEXT: mov v0.d[1], v1.d[0]
164 %v8half= shufflevector <4 x half> %A, <4 x half> %B, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7>
165 ret <8 x half> %v8half
168 define <16 x half> @concat11(<8 x half> %A, <8 x half> %B) {
169 ; CHECK-LABEL: concat11:
172 %v16half= shufflevector <8 x half> %A, <8 x half> %B, <16 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15>
173 ret <16 x half> %v16half
176 define <8 x i16> @concat_v8s16_v2s16(ptr %ptr) {
177 ; CHECK-SD-LABEL: concat_v8s16_v2s16:
178 ; CHECK-SD: // %bb.0:
179 ; CHECK-SD-NEXT: ldr s0, [x0]
182 ; CHECK-GI-LABEL: concat_v8s16_v2s16:
183 ; CHECK-GI: // %bb.0:
184 ; CHECK-GI-NEXT: dup v0.4s, w8
185 ; CHECK-GI-NEXT: ldr h1, [x0]
186 ; CHECK-GI-NEXT: ldr h2, [x0, #2]
187 ; CHECK-GI-NEXT: mov v1.s[1], v2.s[0]
188 ; CHECK-GI-NEXT: xtn v2.4h, v0.4s
189 ; CHECK-GI-NEXT: xtn v0.4h, v1.4s
190 ; CHECK-GI-NEXT: fmov w8, s2
191 ; CHECK-GI-NEXT: mov v0.s[1], w8
192 ; CHECK-GI-NEXT: mov v0.s[2], w8
193 ; CHECK-GI-NEXT: mov v0.s[3], w8
195 %a = load <2 x i16>, ptr %ptr
196 %b = shufflevector <2 x i16> %a, <2 x i16> %a, <8 x i32> <i32 0, i32 1, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
200 define <16 x i8> @concat_v16s8_v4s8(ptr %ptr) {
201 ; CHECK-SD-LABEL: concat_v16s8_v4s8:
202 ; CHECK-SD: // %bb.0:
203 ; CHECK-SD-NEXT: ldr s0, [x0]
206 ; CHECK-GI-LABEL: concat_v16s8_v4s8:
207 ; CHECK-GI: // %bb.0:
208 ; CHECK-GI-NEXT: dup v0.8h, w8
209 ; CHECK-GI-NEXT: xtn v1.8b, v0.8h
210 ; CHECK-GI-NEXT: ldr s0, [x0]
211 ; CHECK-GI-NEXT: mov v0.s[1], v1.s[0]
212 ; CHECK-GI-NEXT: mov v0.s[2], v1.s[0]
213 ; CHECK-GI-NEXT: mov v0.s[3], v1.s[0]
215 %a = load <4 x i8>, ptr %ptr
216 %b = shufflevector <4 x i8> %a, <4 x i8> %a, <16 x i32> <i32 0, i32 1, i32 2, i32 3, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
220 define <16 x i8> @concat_v16s8_v4s8_load(ptr %ptrA, ptr %ptrB, ptr %ptrC, ptr %ptrD) {
221 ; CHECK-SD-LABEL: concat_v16s8_v4s8_load:
222 ; CHECK-SD: // %bb.0:
223 ; CHECK-SD-NEXT: ldr s0, [x0]
224 ; CHECK-SD-NEXT: ld1 { v0.s }[1], [x1]
225 ; CHECK-SD-NEXT: ld1 { v0.s }[2], [x2]
226 ; CHECK-SD-NEXT: ld1 { v0.s }[3], [x3]
229 ; CHECK-GI-LABEL: concat_v16s8_v4s8_load:
230 ; CHECK-GI: // %bb.0:
231 ; CHECK-GI-NEXT: ldr s0, [x0]
232 ; CHECK-GI-NEXT: ldr s1, [x1]
233 ; CHECK-GI-NEXT: mov v0.s[1], v1.s[0]
234 ; CHECK-GI-NEXT: ldr s1, [x2]
235 ; CHECK-GI-NEXT: mov v0.s[2], v1.s[0]
236 ; CHECK-GI-NEXT: ldr s1, [x3]
237 ; CHECK-GI-NEXT: mov v0.s[3], v1.s[0]
239 %A = load <4 x i8>, ptr %ptrA
240 %B = load <4 x i8>, ptr %ptrB
241 %C = load <4 x i8>, ptr %ptrC
242 %D = load <4 x i8>, ptr %ptrD
243 %b = shufflevector <4 x i8> %A, <4 x i8> %B, <16 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
244 %c = shufflevector <4 x i8> %C, <4 x i8> %D, <16 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
245 %d = shufflevector <16 x i8> %b, <16 x i8> %c, <16 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 16, i32 17, i32 18, i32 19, i32 20, i32 21, i32 22, i32 23>
250 define <16 x i8> @concat_v16s8_v4s8_reg(<4 x i8> %A, <4 x i8> %B, <4 x i8> %C, <4 x i8> %D) {
251 ; CHECK-SD-LABEL: concat_v16s8_v4s8_reg:
252 ; CHECK-SD: // %bb.0:
253 ; CHECK-SD-NEXT: // kill: def $d2 killed $d2 def $q2
254 ; CHECK-SD-NEXT: // kill: def $d0 killed $d0 def $q0
255 ; CHECK-SD-NEXT: // kill: def $d3 killed $d3 def $q3
256 ; CHECK-SD-NEXT: // kill: def $d1 killed $d1 def $q1
257 ; CHECK-SD-NEXT: mov v2.d[1], v3.d[0]
258 ; CHECK-SD-NEXT: mov v0.d[1], v1.d[0]
259 ; CHECK-SD-NEXT: uzp1 v0.16b, v0.16b, v2.16b
262 ; CHECK-GI-LABEL: concat_v16s8_v4s8_reg:
263 ; CHECK-GI: // %bb.0:
264 ; CHECK-GI-NEXT: // kill: def $d1 killed $d1 def $q1
265 ; CHECK-GI-NEXT: mov h4, v1.h[1]
266 ; CHECK-GI-NEXT: // kill: def $d0 killed $d0 def $q0
267 ; CHECK-GI-NEXT: mov h5, v0.h[1]
268 ; CHECK-GI-NEXT: // kill: def $d2 killed $d2 def $q2
269 ; CHECK-GI-NEXT: // kill: def $d3 killed $d3 def $q3
270 ; CHECK-GI-NEXT: mov h6, v1.h[2]
271 ; CHECK-GI-NEXT: mov h7, v1.h[3]
272 ; CHECK-GI-NEXT: mov h16, v2.h[1]
273 ; CHECK-GI-NEXT: mov h17, v0.h[3]
274 ; CHECK-GI-NEXT: mov h18, v2.h[3]
275 ; CHECK-GI-NEXT: mov v1.h[1], v4.h[0]
276 ; CHECK-GI-NEXT: mov h4, v0.h[2]
277 ; CHECK-GI-NEXT: mov v0.h[1], v5.h[0]
278 ; CHECK-GI-NEXT: mov h5, v2.h[2]
279 ; CHECK-GI-NEXT: mov v2.h[1], v16.h[0]
280 ; CHECK-GI-NEXT: mov v1.h[2], v6.h[0]
281 ; CHECK-GI-NEXT: mov h6, v3.h[1]
282 ; CHECK-GI-NEXT: mov v0.h[2], v4.h[0]
283 ; CHECK-GI-NEXT: mov v2.h[2], v5.h[0]
284 ; CHECK-GI-NEXT: mov h4, v3.h[2]
285 ; CHECK-GI-NEXT: mov h5, v3.h[3]
286 ; CHECK-GI-NEXT: mov v1.h[3], v7.h[0]
287 ; CHECK-GI-NEXT: mov v3.h[1], v6.h[0]
288 ; CHECK-GI-NEXT: mov v0.h[3], v17.h[0]
289 ; CHECK-GI-NEXT: mov v2.h[3], v18.h[0]
290 ; CHECK-GI-NEXT: xtn v1.8b, v1.8h
291 ; CHECK-GI-NEXT: mov v3.h[2], v4.h[0]
292 ; CHECK-GI-NEXT: xtn v0.8b, v0.8h
293 ; CHECK-GI-NEXT: xtn v2.8b, v2.8h
294 ; CHECK-GI-NEXT: mov v3.h[3], v5.h[0]
295 ; CHECK-GI-NEXT: fmov w8, s1
296 ; CHECK-GI-NEXT: mov v0.s[1], w8
297 ; CHECK-GI-NEXT: fmov w8, s2
298 ; CHECK-GI-NEXT: xtn v1.8b, v3.8h
299 ; CHECK-GI-NEXT: mov v0.s[2], w8
300 ; CHECK-GI-NEXT: fmov w8, s1
301 ; CHECK-GI-NEXT: mov v0.s[3], w8
303 %b = shufflevector <4 x i8> %A, <4 x i8> %B, <16 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
304 %c = shufflevector <4 x i8> %C, <4 x i8> %D, <16 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef>
305 %d = shufflevector <16 x i8> %b, <16 x i8> %c, <16 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 16, i32 17, i32 18, i32 19, i32 20, i32 21, i32 22, i32 23>
309 define <8 x i16> @concat_v8s16_v2s16_reg(<2 x i16> %A, <2 x i16> %B, <2 x i16> %C, <2 x i16> %D) {
310 ; CHECK-SD-LABEL: concat_v8s16_v2s16_reg:
311 ; CHECK-SD: // %bb.0:
312 ; CHECK-SD-NEXT: // kill: def $d3 killed $d3 killed $q0_q1_q2_q3 def $q0_q1_q2_q3
313 ; CHECK-SD-NEXT: adrp x8, .LCPI15_0
314 ; CHECK-SD-NEXT: // kill: def $d2 killed $d2 killed $q0_q1_q2_q3 def $q0_q1_q2_q3
315 ; CHECK-SD-NEXT: ldr q4, [x8, :lo12:.LCPI15_0]
316 ; CHECK-SD-NEXT: // kill: def $d1 killed $d1 killed $q0_q1_q2_q3 def $q0_q1_q2_q3
317 ; CHECK-SD-NEXT: // kill: def $d0 killed $d0 killed $q0_q1_q2_q3 def $q0_q1_q2_q3
318 ; CHECK-SD-NEXT: tbl v0.16b, { v0.16b, v1.16b, v2.16b, v3.16b }, v4.16b
321 ; CHECK-GI-LABEL: concat_v8s16_v2s16_reg:
322 ; CHECK-GI: // %bb.0:
323 ; CHECK-GI-NEXT: // kill: def $d1 killed $d1 def $q1
324 ; CHECK-GI-NEXT: mov s4, v1.s[1]
325 ; CHECK-GI-NEXT: // kill: def $d0 killed $d0 def $q0
326 ; CHECK-GI-NEXT: mov s5, v0.s[1]
327 ; CHECK-GI-NEXT: // kill: def $d2 killed $d2 def $q2
328 ; CHECK-GI-NEXT: // kill: def $d3 killed $d3 def $q3
329 ; CHECK-GI-NEXT: mov v1.s[1], v4.s[0]
330 ; CHECK-GI-NEXT: mov s4, v2.s[1]
331 ; CHECK-GI-NEXT: mov v0.s[1], v5.s[0]
332 ; CHECK-GI-NEXT: xtn v1.4h, v1.4s
333 ; CHECK-GI-NEXT: mov v2.s[1], v4.s[0]
334 ; CHECK-GI-NEXT: mov s4, v3.s[1]
335 ; CHECK-GI-NEXT: xtn v0.4h, v0.4s
336 ; CHECK-GI-NEXT: xtn v2.4h, v2.4s
337 ; CHECK-GI-NEXT: mov v3.s[1], v4.s[0]
338 ; CHECK-GI-NEXT: fmov w8, s1
339 ; CHECK-GI-NEXT: mov v0.s[1], w8
340 ; CHECK-GI-NEXT: xtn v1.4h, v3.4s
341 ; CHECK-GI-NEXT: fmov w8, s2
342 ; CHECK-GI-NEXT: mov v0.s[2], w8
343 ; CHECK-GI-NEXT: fmov w8, s1
344 ; CHECK-GI-NEXT: mov v0.s[3], w8
346 %b = shufflevector <2 x i16> %A, <2 x i16> %B, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 undef, i32 undef, i32 undef, i32 undef>
347 %c = shufflevector <2 x i16> %C, <2 x i16> %D, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 undef, i32 undef, i32 undef, i32 undef>
348 %d = shufflevector <8 x i16> %b, <8 x i16> %c, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 8, i32 9, i32 10, i32 11>