1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=aarch64-linux-gnu -mattr=+sve,+bf16 < %s | FileCheck %s --check-prefixes=CHECK
4 ; Should codegen to a nop, since idx is zero.
5 define <2 x i64> @extract_v2i64_nxv2i64(<vscale x 2 x i64> %vec) nounwind {
6 ; CHECK-LABEL: extract_v2i64_nxv2i64:
8 ; CHECK-NEXT: // kill: def $q0 killed $q0 killed $z0
10 %retval = call <2 x i64> @llvm.vector.extract.v2i64.nxv2i64(<vscale x 2 x i64> %vec, i64 0)
14 ; Goes through memory currently; idx != 0.
15 define <2 x i64> @extract_v2i64_nxv2i64_idx2(<vscale x 2 x i64> %vec) nounwind {
16 ; CHECK-LABEL: extract_v2i64_nxv2i64_idx2:
18 ; CHECK-NEXT: str x29, [sp, #-16]! // 8-byte Folded Spill
19 ; CHECK-NEXT: addvl sp, sp, #-1
20 ; CHECK-NEXT: ptrue p0.d
22 ; CHECK-NEXT: mov w9, #2 // =0x2
23 ; CHECK-NEXT: sub x8, x8, #2
24 ; CHECK-NEXT: cmp x8, #2
25 ; CHECK-NEXT: csel x8, x8, x9, lo
26 ; CHECK-NEXT: mov x9, sp
27 ; CHECK-NEXT: lsl x8, x8, #3
28 ; CHECK-NEXT: st1d { z0.d }, p0, [sp]
29 ; CHECK-NEXT: ldr q0, [x9, x8]
30 ; CHECK-NEXT: addvl sp, sp, #1
31 ; CHECK-NEXT: ldr x29, [sp], #16 // 8-byte Folded Reload
33 %retval = call <2 x i64> @llvm.vector.extract.v2i64.nxv2i64(<vscale x 2 x i64> %vec, i64 2)
37 ; Should codegen to a nop, since idx is zero.
38 define <4 x i32> @extract_v4i32_nxv4i32(<vscale x 4 x i32> %vec) nounwind {
39 ; CHECK-LABEL: extract_v4i32_nxv4i32:
41 ; CHECK-NEXT: // kill: def $q0 killed $q0 killed $z0
43 %retval = call <4 x i32> @llvm.vector.extract.v4i32.nxv4i32(<vscale x 4 x i32> %vec, i64 0)
47 ; Goes through memory currently; idx != 0.
48 define <4 x i32> @extract_v4i32_nxv4i32_idx4(<vscale x 4 x i32> %vec) nounwind {
49 ; CHECK-LABEL: extract_v4i32_nxv4i32_idx4:
51 ; CHECK-NEXT: str x29, [sp, #-16]! // 8-byte Folded Spill
52 ; CHECK-NEXT: addvl sp, sp, #-1
53 ; CHECK-NEXT: ptrue p0.s
55 ; CHECK-NEXT: mov w9, #4 // =0x4
56 ; CHECK-NEXT: sub x8, x8, #4
57 ; CHECK-NEXT: cmp x8, #4
58 ; CHECK-NEXT: csel x8, x8, x9, lo
59 ; CHECK-NEXT: mov x9, sp
60 ; CHECK-NEXT: lsl x8, x8, #2
61 ; CHECK-NEXT: st1w { z0.s }, p0, [sp]
62 ; CHECK-NEXT: ldr q0, [x9, x8]
63 ; CHECK-NEXT: addvl sp, sp, #1
64 ; CHECK-NEXT: ldr x29, [sp], #16 // 8-byte Folded Reload
66 %retval = call <4 x i32> @llvm.vector.extract.v4i32.nxv4i32(<vscale x 4 x i32> %vec, i64 4)
70 ; Should codegen to uzps, since idx is zero and type is illegal.
71 define <4 x i32> @extract_v4i32_nxv2i32(<vscale x 2 x i32> %vec) nounwind #1 {
72 ; CHECK-LABEL: extract_v4i32_nxv2i32:
74 ; CHECK-NEXT: uzp1 z0.s, z0.s, z0.s
75 ; CHECK-NEXT: // kill: def $q0 killed $q0 killed $z0
77 %retval = call <4 x i32> @llvm.vector.extract.v4i32.nxv2i32(<vscale x 2 x i32> %vec, i64 0)
81 ; Goes through memory currently; idx != 0.
82 define <4 x i32> @extract_v4i32_nxv2i32_idx4(<vscale x 2 x i32> %vec) nounwind #1 {
83 ; CHECK-LABEL: extract_v4i32_nxv2i32_idx4:
85 ; CHECK-NEXT: str x29, [sp, #-16]! // 8-byte Folded Spill
86 ; CHECK-NEXT: addvl sp, sp, #-1
87 ; CHECK-NEXT: ptrue p0.d
88 ; CHECK-NEXT: mov x8, #4 // =0x4
89 ; CHECK-NEXT: mov x9, sp
90 ; CHECK-NEXT: ptrue p1.d, vl4
91 ; CHECK-NEXT: st1d { z0.d }, p0, [sp]
92 ; CHECK-NEXT: ld1d { z0.d }, p1/z, [x9, x8, lsl #3]
93 ; CHECK-NEXT: uzp1 z0.s, z0.s, z0.s
94 ; CHECK-NEXT: // kill: def $q0 killed $q0 killed $z0
95 ; CHECK-NEXT: addvl sp, sp, #1
96 ; CHECK-NEXT: ldr x29, [sp], #16 // 8-byte Folded Reload
98 %retval = call <4 x i32> @llvm.vector.extract.v4i32.nxv2i32(<vscale x 2 x i32> %vec, i64 4)
102 ; Should codegen to a nop, since idx is zero.
103 define <8 x i16> @extract_v8i16_nxv8i16(<vscale x 8 x i16> %vec) nounwind {
104 ; CHECK-LABEL: extract_v8i16_nxv8i16:
106 ; CHECK-NEXT: // kill: def $q0 killed $q0 killed $z0
108 %retval = call <8 x i16> @llvm.vector.extract.v8i16.nxv8i16(<vscale x 8 x i16> %vec, i64 0)
109 ret <8 x i16> %retval
112 ; Goes through memory currently; idx != 0.
113 define <8 x i16> @extract_v8i16_nxv8i16_idx8(<vscale x 8 x i16> %vec) nounwind {
114 ; CHECK-LABEL: extract_v8i16_nxv8i16_idx8:
116 ; CHECK-NEXT: str x29, [sp, #-16]! // 8-byte Folded Spill
117 ; CHECK-NEXT: addvl sp, sp, #-1
118 ; CHECK-NEXT: ptrue p0.h
119 ; CHECK-NEXT: cnth x8
120 ; CHECK-NEXT: mov w9, #8 // =0x8
121 ; CHECK-NEXT: sub x8, x8, #8
122 ; CHECK-NEXT: cmp x8, #8
123 ; CHECK-NEXT: csel x8, x8, x9, lo
124 ; CHECK-NEXT: mov x9, sp
125 ; CHECK-NEXT: lsl x8, x8, #1
126 ; CHECK-NEXT: st1h { z0.h }, p0, [sp]
127 ; CHECK-NEXT: ldr q0, [x9, x8]
128 ; CHECK-NEXT: addvl sp, sp, #1
129 ; CHECK-NEXT: ldr x29, [sp], #16 // 8-byte Folded Reload
131 %retval = call <8 x i16> @llvm.vector.extract.v8i16.nxv8i16(<vscale x 8 x i16> %vec, i64 8)
132 ret <8 x i16> %retval
135 ; Should codegen to uzps, since idx is zero and type is illegal.
136 define <8 x i16> @extract_v8i16_nxv4i16(<vscale x 4 x i16> %vec) nounwind #1 {
137 ; CHECK-LABEL: extract_v8i16_nxv4i16:
139 ; CHECK-NEXT: uzp1 z0.h, z0.h, z0.h
140 ; CHECK-NEXT: // kill: def $q0 killed $q0 killed $z0
142 %retval = call <8 x i16> @llvm.vector.extract.v8i16.nxv4i16(<vscale x 4 x i16> %vec, i64 0)
143 ret <8 x i16> %retval
146 ; Goes through memory currently; idx != 0.
147 define <8 x i16> @extract_v8i16_nxv4i16_idx8(<vscale x 4 x i16> %vec) nounwind #1 {
148 ; CHECK-LABEL: extract_v8i16_nxv4i16_idx8:
150 ; CHECK-NEXT: str x29, [sp, #-16]! // 8-byte Folded Spill
151 ; CHECK-NEXT: addvl sp, sp, #-1
152 ; CHECK-NEXT: ptrue p0.s
153 ; CHECK-NEXT: mov x8, #8 // =0x8
154 ; CHECK-NEXT: mov x9, sp
155 ; CHECK-NEXT: ptrue p1.s, vl8
156 ; CHECK-NEXT: st1w { z0.s }, p0, [sp]
157 ; CHECK-NEXT: ld1w { z0.s }, p1/z, [x9, x8, lsl #2]
158 ; CHECK-NEXT: uzp1 z0.h, z0.h, z0.h
159 ; CHECK-NEXT: // kill: def $q0 killed $q0 killed $z0
160 ; CHECK-NEXT: addvl sp, sp, #1
161 ; CHECK-NEXT: ldr x29, [sp], #16 // 8-byte Folded Reload
163 %retval = call <8 x i16> @llvm.vector.extract.v8i16.nxv4i16(<vscale x 4 x i16> %vec, i64 8)
164 ret <8 x i16> %retval
167 ; Should codegen to uzps, since idx is zero and type is illegal.
168 define <8 x i16> @extract_v8i16_nxv2i16(<vscale x 2 x i16> %vec) nounwind #1 {
169 ; CHECK-LABEL: extract_v8i16_nxv2i16:
171 ; CHECK-NEXT: uzp1 z0.s, z0.s, z0.s
172 ; CHECK-NEXT: uzp1 z0.h, z0.h, z0.h
173 ; CHECK-NEXT: // kill: def $q0 killed $q0 killed $z0
175 %retval = call <8 x i16> @llvm.vector.extract.v8i16.nxv2i16(<vscale x 2 x i16> %vec, i64 0)
176 ret <8 x i16> %retval
179 ; Goes through memory currently; idx != 0.
180 define <8 x i16> @extract_v8i16_nxv2i16_idx8(<vscale x 2 x i16> %vec) nounwind #1 {
181 ; CHECK-LABEL: extract_v8i16_nxv2i16_idx8:
183 ; CHECK-NEXT: str x29, [sp, #-16]! // 8-byte Folded Spill
184 ; CHECK-NEXT: addvl sp, sp, #-1
185 ; CHECK-NEXT: ptrue p0.d
186 ; CHECK-NEXT: mov x8, #8 // =0x8
187 ; CHECK-NEXT: mov x9, sp
188 ; CHECK-NEXT: ptrue p1.d, vl8
189 ; CHECK-NEXT: st1d { z0.d }, p0, [sp]
190 ; CHECK-NEXT: ld1d { z0.d }, p1/z, [x9, x8, lsl #3]
191 ; CHECK-NEXT: uzp1 z0.s, z0.s, z0.s
192 ; CHECK-NEXT: uzp1 z0.h, z0.h, z0.h
193 ; CHECK-NEXT: // kill: def $q0 killed $q0 killed $z0
194 ; CHECK-NEXT: addvl sp, sp, #1
195 ; CHECK-NEXT: ldr x29, [sp], #16 // 8-byte Folded Reload
197 %retval = call <8 x i16> @llvm.vector.extract.v8i16.nxv2i16(<vscale x 2 x i16> %vec, i64 8)
198 ret <8 x i16> %retval
201 ; Should codegen to a nop, since idx is zero.
202 define <16 x i8> @extract_v16i8_nxv16i8(<vscale x 16 x i8> %vec) nounwind {
203 ; CHECK-LABEL: extract_v16i8_nxv16i8:
205 ; CHECK-NEXT: // kill: def $q0 killed $q0 killed $z0
207 %retval = call <16 x i8> @llvm.vector.extract.v16i8.nxv16i8(<vscale x 16 x i8> %vec, i64 0)
208 ret <16 x i8> %retval
211 ; Goes through memory currently; idx != 0.
212 define <16 x i8> @extract_v16i8_nxv16i8_idx16(<vscale x 16 x i8> %vec) nounwind {
213 ; CHECK-LABEL: extract_v16i8_nxv16i8_idx16:
215 ; CHECK-NEXT: str x29, [sp, #-16]! // 8-byte Folded Spill
216 ; CHECK-NEXT: addvl sp, sp, #-1
217 ; CHECK-NEXT: ptrue p0.b
218 ; CHECK-NEXT: mov x8, #-16 // =0xfffffffffffffff0
219 ; CHECK-NEXT: mov w9, #16 // =0x10
220 ; CHECK-NEXT: addvl x8, x8, #1
221 ; CHECK-NEXT: cmp x8, #16
222 ; CHECK-NEXT: csel x8, x8, x9, lo
223 ; CHECK-NEXT: mov x9, sp
224 ; CHECK-NEXT: st1b { z0.b }, p0, [sp]
225 ; CHECK-NEXT: ldr q0, [x9, x8]
226 ; CHECK-NEXT: addvl sp, sp, #1
227 ; CHECK-NEXT: ldr x29, [sp], #16 // 8-byte Folded Reload
229 %retval = call <16 x i8> @llvm.vector.extract.v16i8.nxv16i8(<vscale x 16 x i8> %vec, i64 16)
230 ret <16 x i8> %retval
233 ; Should codegen to uzps, since idx is zero and type is illegal.
234 define <16 x i8> @extract_v16i8_nxv8i8(<vscale x 8 x i8> %vec) nounwind #1 {
235 ; CHECK-LABEL: extract_v16i8_nxv8i8:
237 ; CHECK-NEXT: uzp1 z0.b, z0.b, z0.b
238 ; CHECK-NEXT: // kill: def $q0 killed $q0 killed $z0
240 %retval = call <16 x i8> @llvm.vector.extract.v16i8.nxv8i8(<vscale x 8 x i8> %vec, i64 0)
241 ret <16 x i8> %retval
244 ; Goes through memory currently; idx != 0.
245 define <16 x i8> @extract_v16i8_nxv8i8_idx16(<vscale x 8 x i8> %vec) nounwind #1 {
246 ; CHECK-LABEL: extract_v16i8_nxv8i8_idx16:
248 ; CHECK-NEXT: str x29, [sp, #-16]! // 8-byte Folded Spill
249 ; CHECK-NEXT: addvl sp, sp, #-1
250 ; CHECK-NEXT: ptrue p0.h
251 ; CHECK-NEXT: mov x8, #16 // =0x10
252 ; CHECK-NEXT: mov x9, sp
253 ; CHECK-NEXT: ptrue p1.h, vl16
254 ; CHECK-NEXT: st1h { z0.h }, p0, [sp]
255 ; CHECK-NEXT: ld1h { z0.h }, p1/z, [x9, x8, lsl #1]
256 ; CHECK-NEXT: uzp1 z0.b, z0.b, z0.b
257 ; CHECK-NEXT: // kill: def $q0 killed $q0 killed $z0
258 ; CHECK-NEXT: addvl sp, sp, #1
259 ; CHECK-NEXT: ldr x29, [sp], #16 // 8-byte Folded Reload
261 %retval = call <16 x i8> @llvm.vector.extract.v16i8.nxv8i8(<vscale x 8 x i8> %vec, i64 16)
262 ret <16 x i8> %retval
265 ; Should codegen to uzps, since idx is zero and type is illegal.
266 define <16 x i8> @extract_v16i8_nxv4i8(<vscale x 4 x i8> %vec) nounwind #1 {
267 ; CHECK-LABEL: extract_v16i8_nxv4i8:
269 ; CHECK-NEXT: uzp1 z0.h, z0.h, z0.h
270 ; CHECK-NEXT: uzp1 z0.b, z0.b, z0.b
271 ; CHECK-NEXT: // kill: def $q0 killed $q0 killed $z0
273 %retval = call <16 x i8> @llvm.vector.extract.v16i8.nxv4i8(<vscale x 4 x i8> %vec, i64 0)
274 ret <16 x i8> %retval
277 ; Goes through memory currently; idx != 0.
278 define <16 x i8> @extract_v16i8_nxv4i8_idx16(<vscale x 4 x i8> %vec) nounwind #1 {
279 ; CHECK-LABEL: extract_v16i8_nxv4i8_idx16:
281 ; CHECK-NEXT: str x29, [sp, #-16]! // 8-byte Folded Spill
282 ; CHECK-NEXT: addvl sp, sp, #-1
283 ; CHECK-NEXT: ptrue p0.s
284 ; CHECK-NEXT: mov x8, #16 // =0x10
285 ; CHECK-NEXT: mov x9, sp
286 ; CHECK-NEXT: ptrue p1.s, vl16
287 ; CHECK-NEXT: st1w { z0.s }, p0, [sp]
288 ; CHECK-NEXT: ld1w { z0.s }, p1/z, [x9, x8, lsl #2]
289 ; CHECK-NEXT: uzp1 z0.h, z0.h, z0.h
290 ; CHECK-NEXT: uzp1 z0.b, z0.b, z0.b
291 ; CHECK-NEXT: // kill: def $q0 killed $q0 killed $z0
292 ; CHECK-NEXT: addvl sp, sp, #1
293 ; CHECK-NEXT: ldr x29, [sp], #16 // 8-byte Folded Reload
295 %retval = call <16 x i8> @llvm.vector.extract.v16i8.nxv4i8(<vscale x 4 x i8> %vec, i64 16)
296 ret <16 x i8> %retval
299 ; Should codegen to uzps, since idx is zero and type is illegal.
300 define <16 x i8> @extract_v16i8_nxv2i8(<vscale x 2 x i8> %vec) nounwind #1 {
301 ; CHECK-LABEL: extract_v16i8_nxv2i8:
303 ; CHECK-NEXT: uzp1 z0.s, z0.s, z0.s
304 ; CHECK-NEXT: uzp1 z0.h, z0.h, z0.h
305 ; CHECK-NEXT: uzp1 z0.b, z0.b, z0.b
306 ; CHECK-NEXT: // kill: def $q0 killed $q0 killed $z0
308 %retval = call <16 x i8> @llvm.vector.extract.v16i8.nxv2i8(<vscale x 2 x i8> %vec, i64 0)
309 ret <16 x i8> %retval
312 ; Goes through memory currently; idx != 0.
313 define <16 x i8> @extract_v16i8_nxv2i8_idx16(<vscale x 2 x i8> %vec) nounwind #1 {
314 ; CHECK-LABEL: extract_v16i8_nxv2i8_idx16:
316 ; CHECK-NEXT: str x29, [sp, #-16]! // 8-byte Folded Spill
317 ; CHECK-NEXT: addvl sp, sp, #-1
318 ; CHECK-NEXT: ptrue p0.d
319 ; CHECK-NEXT: st1d { z0.d }, p0, [sp]
320 ; CHECK-NEXT: ld1d { z0.d }, p0/z, [sp]
321 ; CHECK-NEXT: uzp1 z0.s, z0.s, z0.s
322 ; CHECK-NEXT: uzp1 z0.h, z0.h, z0.h
323 ; CHECK-NEXT: uzp1 z0.b, z0.b, z0.b
324 ; CHECK-NEXT: // kill: def $q0 killed $q0 killed $z0
325 ; CHECK-NEXT: addvl sp, sp, #1
326 ; CHECK-NEXT: ldr x29, [sp], #16 // 8-byte Folded Reload
328 %retval = call <16 x i8> @llvm.vector.extract.v16i8.nxv2i8(<vscale x 2 x i8> %vec, i64 16)
329 ret <16 x i8> %retval
335 define <2 x i1> @extract_v2i1_nxv2i1(<vscale x 2 x i1> %inmask) {
336 ; CHECK-LABEL: extract_v2i1_nxv2i1:
338 ; CHECK-NEXT: mov z0.d, p0/z, #1 // =0x1
339 ; CHECK-NEXT: fmov x0, d0
340 ; CHECK-NEXT: mov x8, v0.d[1]
341 ; CHECK-NEXT: fmov s0, w0
342 ; CHECK-NEXT: mov v0.s[1], w8
343 ; CHECK-NEXT: // kill: def $d0 killed $d0 killed $q0
345 %mask = call <2 x i1> @llvm.vector.extract.v2i1.nxv2i1(<vscale x 2 x i1> %inmask, i64 0)
349 define <4 x i1> @extract_v4i1_nxv4i1(<vscale x 4 x i1> %inmask) {
350 ; CHECK-LABEL: extract_v4i1_nxv4i1:
352 ; CHECK-NEXT: mov z1.s, p0/z, #1 // =0x1
353 ; CHECK-NEXT: mov w8, v1.s[1]
354 ; CHECK-NEXT: mov v0.16b, v1.16b
355 ; CHECK-NEXT: mov w9, v1.s[2]
356 ; CHECK-NEXT: mov v0.h[1], w8
357 ; CHECK-NEXT: mov w8, v1.s[3]
358 ; CHECK-NEXT: mov v0.h[2], w9
359 ; CHECK-NEXT: mov v0.h[3], w8
360 ; CHECK-NEXT: // kill: def $d0 killed $d0 killed $q0
362 %mask = call <4 x i1> @llvm.vector.extract.v4i1.nxv4i1(<vscale x 4 x i1> %inmask, i64 0)
366 define <8 x i1> @extract_v8i1_nxv8i1(<vscale x 8 x i1> %inmask) {
367 ; CHECK-LABEL: extract_v8i1_nxv8i1:
369 ; CHECK-NEXT: mov z1.h, p0/z, #1 // =0x1
370 ; CHECK-NEXT: umov w8, v1.h[1]
371 ; CHECK-NEXT: mov v0.16b, v1.16b
372 ; CHECK-NEXT: umov w9, v1.h[2]
373 ; CHECK-NEXT: mov v0.b[1], w8
374 ; CHECK-NEXT: umov w8, v1.h[3]
375 ; CHECK-NEXT: mov v0.b[2], w9
376 ; CHECK-NEXT: umov w9, v1.h[4]
377 ; CHECK-NEXT: mov v0.b[3], w8
378 ; CHECK-NEXT: umov w8, v1.h[5]
379 ; CHECK-NEXT: mov v0.b[4], w9
380 ; CHECK-NEXT: umov w9, v1.h[6]
381 ; CHECK-NEXT: mov v0.b[5], w8
382 ; CHECK-NEXT: umov w8, v1.h[7]
383 ; CHECK-NEXT: mov v0.b[6], w9
384 ; CHECK-NEXT: mov v0.b[7], w8
385 ; CHECK-NEXT: // kill: def $d0 killed $d0 killed $q0
387 %mask = call <8 x i1> @llvm.vector.extract.v8i1.nxv8i1(<vscale x 8 x i1> %inmask, i64 0)
391 define <16 x i1> @extract_v16i1_nxv16i1(<vscale x 16 x i1> %inmask) {
392 ; CHECK-LABEL: extract_v16i1_nxv16i1:
394 ; CHECK-NEXT: mov z1.b, p0/z, #1 // =0x1
395 ; CHECK-NEXT: umov w8, v1.b[1]
396 ; CHECK-NEXT: mov v0.16b, v1.16b
397 ; CHECK-NEXT: umov w9, v1.b[2]
398 ; CHECK-NEXT: mov v0.b[1], w8
399 ; CHECK-NEXT: umov w8, v1.b[3]
400 ; CHECK-NEXT: mov v0.b[2], w9
401 ; CHECK-NEXT: umov w9, v1.b[4]
402 ; CHECK-NEXT: mov v0.b[3], w8
403 ; CHECK-NEXT: umov w8, v1.b[5]
404 ; CHECK-NEXT: mov v0.b[4], w9
405 ; CHECK-NEXT: umov w9, v1.b[6]
406 ; CHECK-NEXT: mov v0.b[5], w8
407 ; CHECK-NEXT: umov w8, v1.b[7]
408 ; CHECK-NEXT: mov v0.b[6], w9
409 ; CHECK-NEXT: umov w9, v1.b[8]
410 ; CHECK-NEXT: mov v0.b[7], w8
411 ; CHECK-NEXT: umov w8, v1.b[9]
412 ; CHECK-NEXT: mov v0.b[8], w9
413 ; CHECK-NEXT: umov w9, v1.b[10]
414 ; CHECK-NEXT: mov v0.b[9], w8
415 ; CHECK-NEXT: umov w8, v1.b[11]
416 ; CHECK-NEXT: mov v0.b[10], w9
417 ; CHECK-NEXT: umov w9, v1.b[12]
418 ; CHECK-NEXT: mov v0.b[11], w8
419 ; CHECK-NEXT: umov w8, v1.b[13]
420 ; CHECK-NEXT: mov v0.b[12], w9
421 ; CHECK-NEXT: umov w9, v1.b[14]
422 ; CHECK-NEXT: mov v0.b[13], w8
423 ; CHECK-NEXT: umov w8, v1.b[15]
424 ; CHECK-NEXT: mov v0.b[14], w9
425 ; CHECK-NEXT: mov v0.b[15], w8
427 %mask = call <16 x i1> @llvm.vector.extract.v16i1.nxv16i1(<vscale x 16 x i1> %inmask, i64 0)
432 ; Fixed length clamping
434 define <2 x i64> @extract_fixed_v2i64_nxv2i64(<vscale x 2 x i64> %vec) nounwind #0 {
435 ; CHECK-LABEL: extract_fixed_v2i64_nxv2i64:
437 ; CHECK-NEXT: str x29, [sp, #-16]! // 8-byte Folded Spill
438 ; CHECK-NEXT: addvl sp, sp, #-1
439 ; CHECK-NEXT: ptrue p0.d
440 ; CHECK-NEXT: st1d { z0.d }, p0, [sp]
441 ; CHECK-NEXT: ldr q0, [sp, #16]
442 ; CHECK-NEXT: addvl sp, sp, #1
443 ; CHECK-NEXT: ldr x29, [sp], #16 // 8-byte Folded Reload
445 %retval = call <2 x i64> @llvm.vector.extract.v2i64.nxv2i64(<vscale x 2 x i64> %vec, i64 2)
446 ret <2 x i64> %retval
449 define <4 x i64> @extract_fixed_v4i64_nxv2i64(<vscale x 2 x i64> %vec) nounwind #0 {
450 ; CHECK-LABEL: extract_fixed_v4i64_nxv2i64:
452 ; CHECK-NEXT: str x29, [sp, #-16]! // 8-byte Folded Spill
453 ; CHECK-NEXT: addvl sp, sp, #-1
454 ; CHECK-NEXT: ptrue p0.d
455 ; CHECK-NEXT: st1d { z0.d }, p0, [sp]
456 ; CHECK-NEXT: ld1d { z0.d }, p0/z, [sp]
457 ; CHECK-NEXT: st1d { z0.d }, p0, [x8]
458 ; CHECK-NEXT: addvl sp, sp, #1
459 ; CHECK-NEXT: ldr x29, [sp], #16 // 8-byte Folded Reload
461 %retval = call <4 x i64> @llvm.vector.extract.v4i64.nxv2i64(<vscale x 2 x i64> %vec, i64 4)
462 ret <4 x i64> %retval
465 ; Check that extract from load via bitcast-gep-of-scalar-ptr does not crash.
466 define <4 x i32> @typesize_regression_test_v4i32(i32* %addr, i64 %idx) {
467 ; CHECK-LABEL: typesize_regression_test_v4i32:
468 ; CHECK: // %bb.0: // %entry
469 ; CHECK-NEXT: ptrue p0.s
470 ; CHECK-NEXT: ld1w { z0.s }, p0/z, [x0, x1, lsl #2]
471 ; CHECK-NEXT: // kill: def $q0 killed $q0 killed $z0
474 %ptr = getelementptr inbounds i32, i32* %addr, i64 %idx
475 %bc = bitcast i32* %ptr to <vscale x 4 x i32>*
476 %ld = load volatile <vscale x 4 x i32>, <vscale x 4 x i32>* %bc, align 16
477 %out = call <4 x i32> @llvm.vector.extract.v4i32.nxv4i32(<vscale x 4 x i32> %ld, i64 0)
482 ; Extract fixed-width vector from a scalable vector splat.
485 define <2 x float> @extract_v2f32_nxv4f32_splat(float %f) {
486 ; CHECK-LABEL: extract_v2f32_nxv4f32_splat:
488 ; CHECK-NEXT: // kill: def $s0 killed $s0 def $q0
489 ; CHECK-NEXT: dup v0.2s, v0.s[0]
491 %ins = insertelement <vscale x 4 x float> poison, float %f, i32 0
492 %splat = shufflevector <vscale x 4 x float> %ins, <vscale x 4 x float> poison, <vscale x 4 x i32> zeroinitializer
493 %ext = call <2 x float> @llvm.vector.extract.v2f32.nxv4f32(<vscale x 4 x float> %splat, i64 0)
497 define <2 x float> @extract_v2f32_nxv4f32_splat_const() {
498 ; CHECK-LABEL: extract_v2f32_nxv4f32_splat_const:
500 ; CHECK-NEXT: fmov v0.2s, #1.00000000
502 %ins = insertelement <vscale x 4 x float> poison, float 1.0, i32 0
503 %splat = shufflevector <vscale x 4 x float> %ins, <vscale x 4 x float> poison, <vscale x 4 x i32> zeroinitializer
504 %ext = call <2 x float> @llvm.vector.extract.v2f32.nxv4f32(<vscale x 4 x float> %splat, i64 0)
508 define <4 x i32> @extract_v4i32_nxv8i32_splat_const() {
509 ; CHECK-LABEL: extract_v4i32_nxv8i32_splat_const:
511 ; CHECK-NEXT: movi v0.4s, #1
513 %ins = insertelement <vscale x 8 x i32> poison, i32 1, i32 0
514 %splat = shufflevector <vscale x 8 x i32> %ins, <vscale x 8 x i32> poison, <vscale x 8 x i32> zeroinitializer
515 %ext = call <4 x i32> @llvm.vector.extract.v4i32.nxv8i32(<vscale x 8 x i32> %splat, i64 0)
519 attributes #0 = { vscale_range(2,2) }
520 attributes #1 = { vscale_range(8,8) }
522 declare <2 x i64> @llvm.vector.extract.v2i64.nxv2i64(<vscale x 2 x i64>, i64)
524 declare <4 x i32> @llvm.vector.extract.v4i32.nxv4i32(<vscale x 4 x i32>, i64)
525 declare <4 x i32> @llvm.vector.extract.v4i32.nxv2i32(<vscale x 2 x i32>, i64)
527 declare <8 x i16> @llvm.vector.extract.v8i16.nxv8i16(<vscale x 8 x i16>, i64)
528 declare <8 x i16> @llvm.vector.extract.v8i16.nxv4i16(<vscale x 4 x i16>, i64)
529 declare <8 x i16> @llvm.vector.extract.v8i16.nxv2i16(<vscale x 2 x i16>, i64)
531 declare <16 x i8> @llvm.vector.extract.v16i8.nxv16i8(<vscale x 16 x i8>, i64)
532 declare <16 x i8> @llvm.vector.extract.v16i8.nxv8i8(<vscale x 8 x i8>, i64)
533 declare <16 x i8> @llvm.vector.extract.v16i8.nxv4i8(<vscale x 4 x i8>, i64)
534 declare <16 x i8> @llvm.vector.extract.v16i8.nxv2i8(<vscale x 2 x i8>, i64)
536 declare <2 x i1> @llvm.vector.extract.v2i1.nxv2i1(<vscale x 2 x i1>, i64)
537 declare <4 x i1> @llvm.vector.extract.v4i1.nxv4i1(<vscale x 4 x i1>, i64)
538 declare <8 x i1> @llvm.vector.extract.v8i1.nxv8i1(<vscale x 8 x i1>, i64)
539 declare <16 x i1> @llvm.vector.extract.v16i1.nxv16i1(<vscale x 16 x i1>, i64)
541 declare <4 x i64> @llvm.vector.extract.v4i64.nxv2i64(<vscale x 2 x i64>, i64)
542 declare <2 x float> @llvm.vector.extract.v2f32.nxv4f32(<vscale x 4 x float>, i64)
543 declare <4 x i32> @llvm.vector.extract.v4i32.nxv8i32(<vscale x 8 x i32>, i64)