1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -aarch64-sve-vector-bits-min=256 < %s | FileCheck %s -check-prefixes=CHECK,VBITS_GE_256
3 ; RUN: llc -aarch64-sve-vector-bits-min=512 < %s | FileCheck %s -check-prefixes=CHECK,VBITS_GE_512
4 ; RUN: llc -aarch64-sve-vector-bits-min=2048 < %s | FileCheck %s -check-prefixes=CHECK,VBITS_GE_512
6 target triple = "aarch64-unknown-linux-gnu"
10 ; Don't use SVE for 64-bit vectors.
11 define <4 x i8> @extract_subvector_v8i8(<8 x i8> %op) vscale_range(2,0) #0 {
12 ; CHECK-LABEL: extract_subvector_v8i8:
14 ; CHECK-NEXT: zip2 v0.8b, v0.8b, v0.8b
16 %ret = call <4 x i8> @llvm.vector.extract.v4i8.v8i8(<8 x i8> %op, i64 4)
20 ; Don't use SVE for 128-bit vectors.
21 define <8 x i8> @extract_subvector_v16i8(<16 x i8> %op) vscale_range(2,0) #0 {
22 ; CHECK-LABEL: extract_subvector_v16i8:
24 ; CHECK-NEXT: ext v0.16b, v0.16b, v0.16b, #8
25 ; CHECK-NEXT: // kill: def $d0 killed $d0 killed $q0
27 %ret = call <8 x i8> @llvm.vector.extract.v8i8.v16i8(<16 x i8> %op, i64 8)
31 define void @extract_subvector_v32i8(ptr %a, ptr %b) vscale_range(2,0) #0 {
32 ; CHECK-LABEL: extract_subvector_v32i8:
34 ; CHECK-NEXT: ptrue p0.b, vl32
35 ; CHECK-NEXT: ld1b { z0.b }, p0/z, [x0]
36 ; CHECK-NEXT: ext z0.b, z0.b, z0.b, #16
37 ; CHECK-NEXT: str q0, [x1]
39 %op = load <32 x i8>, ptr %a
40 %ret = call <16 x i8> @llvm.vector.extract.v16i8.v32i8(<32 x i8> %op, i64 16)
41 store <16 x i8> %ret, ptr %b
45 define void @extract_subvector_v64i8(ptr %a, ptr %b) #0 {
46 ; VBITS_GE_256-LABEL: extract_subvector_v64i8:
47 ; VBITS_GE_256: // %bb.0:
48 ; VBITS_GE_256-NEXT: ptrue p0.b, vl32
49 ; VBITS_GE_256-NEXT: mov w8, #32 // =0x20
50 ; VBITS_GE_256-NEXT: ld1b { z0.b }, p0/z, [x0, x8]
51 ; VBITS_GE_256-NEXT: st1b { z0.b }, p0, [x1]
52 ; VBITS_GE_256-NEXT: ret
54 ; VBITS_GE_512-LABEL: extract_subvector_v64i8:
55 ; VBITS_GE_512: // %bb.0:
56 ; VBITS_GE_512-NEXT: ptrue p0.b, vl64
57 ; VBITS_GE_512-NEXT: ld1b { z0.b }, p0/z, [x0]
58 ; VBITS_GE_512-NEXT: ptrue p0.b, vl32
59 ; VBITS_GE_512-NEXT: ext z0.b, z0.b, z0.b, #32
60 ; VBITS_GE_512-NEXT: st1b { z0.b }, p0, [x1]
61 ; VBITS_GE_512-NEXT: ret
62 %op = load <64 x i8>, ptr %a
63 %ret = call <32 x i8> @llvm.vector.extract.v32i8.v64i8(<64 x i8> %op, i64 32)
64 store <32 x i8> %ret, ptr %b
68 define void @extract_subvector_v128i8(ptr %a, ptr %b) vscale_range(8,0) #0 {
69 ; CHECK-LABEL: extract_subvector_v128i8:
71 ; CHECK-NEXT: ptrue p0.b, vl128
72 ; CHECK-NEXT: ld1b { z0.b }, p0/z, [x0]
73 ; CHECK-NEXT: ptrue p0.b, vl64
74 ; CHECK-NEXT: ext z0.b, z0.b, z0.b, #64
75 ; CHECK-NEXT: st1b { z0.b }, p0, [x1]
77 %op = load <128 x i8>, ptr %a
78 %ret = call <64 x i8> @llvm.vector.extract.v64i8.v128i8(<128 x i8> %op, i64 64)
79 store <64 x i8> %ret, ptr %b
83 define void @extract_subvector_v256i8(ptr %a, ptr %b) vscale_range(16,0) #0 {
84 ; CHECK-LABEL: extract_subvector_v256i8:
86 ; CHECK-NEXT: ptrue p0.b, vl256
87 ; CHECK-NEXT: ld1b { z0.b }, p0/z, [x0]
88 ; CHECK-NEXT: ptrue p0.b, vl128
89 ; CHECK-NEXT: ext z0.b, z0.b, z0.b, #128
90 ; CHECK-NEXT: st1b { z0.b }, p0, [x1]
92 %op = load <256 x i8>, ptr %a
93 %ret = call <128 x i8> @llvm.vector.extract.v128i8.v256i8(<256 x i8> %op, i64 128)
94 store <128 x i8> %ret, ptr %b
100 ; Don't use SVE for 64-bit vectors.
101 define <2 x i16> @extract_subvector_v4i16(<4 x i16> %op) vscale_range(2,0) #0 {
102 ; CHECK-LABEL: extract_subvector_v4i16:
104 ; CHECK-NEXT: ushll v0.4s, v0.4h, #0
105 ; CHECK-NEXT: ext v0.16b, v0.16b, v0.16b, #8
106 ; CHECK-NEXT: // kill: def $d0 killed $d0 killed $q0
108 %ret = call <2 x i16> @llvm.vector.extract.v2i16.v4i16(<4 x i16> %op, i64 2)
112 ; Don't use SVE for 128-bit vectors.
113 define <4 x i16> @extract_subvector_v8i16(<8 x i16> %op) vscale_range(2,0) #0 {
114 ; CHECK-LABEL: extract_subvector_v8i16:
116 ; CHECK-NEXT: ext v0.16b, v0.16b, v0.16b, #8
117 ; CHECK-NEXT: // kill: def $d0 killed $d0 killed $q0
119 %ret = call <4 x i16> @llvm.vector.extract.v4i16.v8i16(<8 x i16> %op, i64 4)
123 define void @extract_subvector_v16i16(ptr %a, ptr %b) vscale_range(2,0) #0 {
124 ; CHECK-LABEL: extract_subvector_v16i16:
126 ; CHECK-NEXT: ptrue p0.h, vl16
127 ; CHECK-NEXT: ld1h { z0.h }, p0/z, [x0]
128 ; CHECK-NEXT: ext z0.b, z0.b, z0.b, #16
129 ; CHECK-NEXT: str q0, [x1]
131 %op = load <16 x i16>, ptr %a
132 %ret = call <8 x i16> @llvm.vector.extract.v8i16.v16i16(<16 x i16> %op, i64 8)
133 store <8 x i16> %ret, ptr %b
137 define void @extract_subvector_v32i16(ptr %a, ptr %b) #0 {
138 ; VBITS_GE_256-LABEL: extract_subvector_v32i16:
139 ; VBITS_GE_256: // %bb.0:
140 ; VBITS_GE_256-NEXT: ptrue p0.h, vl16
141 ; VBITS_GE_256-NEXT: mov x8, #16 // =0x10
142 ; VBITS_GE_256-NEXT: ld1h { z0.h }, p0/z, [x0, x8, lsl #1]
143 ; VBITS_GE_256-NEXT: st1h { z0.h }, p0, [x1]
144 ; VBITS_GE_256-NEXT: ret
146 ; VBITS_GE_512-LABEL: extract_subvector_v32i16:
147 ; VBITS_GE_512: // %bb.0:
148 ; VBITS_GE_512-NEXT: ptrue p0.h, vl32
149 ; VBITS_GE_512-NEXT: ld1h { z0.h }, p0/z, [x0]
150 ; VBITS_GE_512-NEXT: ptrue p0.h, vl16
151 ; VBITS_GE_512-NEXT: ext z0.b, z0.b, z0.b, #32
152 ; VBITS_GE_512-NEXT: st1h { z0.h }, p0, [x1]
153 ; VBITS_GE_512-NEXT: ret
154 %op = load <32 x i16>, ptr %a
155 %ret = call <16 x i16> @llvm.vector.extract.v16i16.v32i16(<32 x i16> %op, i64 16)
156 store <16 x i16> %ret, ptr %b
160 define void @extract_subvector_v64i16(ptr %a, ptr %b) vscale_range(8,0) #0 {
161 ; CHECK-LABEL: extract_subvector_v64i16:
163 ; CHECK-NEXT: ptrue p0.h, vl64
164 ; CHECK-NEXT: ld1h { z0.h }, p0/z, [x0]
165 ; CHECK-NEXT: ptrue p0.h, vl32
166 ; CHECK-NEXT: ext z0.b, z0.b, z0.b, #64
167 ; CHECK-NEXT: st1h { z0.h }, p0, [x1]
169 %op = load <64 x i16>, ptr %a
170 %ret = call <32 x i16> @llvm.vector.extract.v32i16.v64i16(<64 x i16> %op, i64 32)
171 store <32 x i16> %ret, ptr %b
175 define void @extract_subvector_v128i16(ptr %a, ptr %b) vscale_range(16,0) #0 {
176 ; CHECK-LABEL: extract_subvector_v128i16:
178 ; CHECK-NEXT: ptrue p0.h, vl128
179 ; CHECK-NEXT: ld1h { z0.h }, p0/z, [x0]
180 ; CHECK-NEXT: ptrue p0.h, vl64
181 ; CHECK-NEXT: ext z0.b, z0.b, z0.b, #128
182 ; CHECK-NEXT: st1h { z0.h }, p0, [x1]
184 %op = load <128 x i16>, ptr %a
185 %ret = call <64 x i16> @llvm.vector.extract.v64i16.v128i16(<128 x i16> %op, i64 64)
186 store <64 x i16> %ret, ptr %b
192 ; Don't use SVE for 64-bit vectors.
193 define <1 x i32> @extract_subvector_v2i32(<2 x i32> %op) vscale_range(2,0) #0 {
194 ; CHECK-LABEL: extract_subvector_v2i32:
196 ; CHECK-NEXT: // kill: def $d0 killed $d0 def $q0
197 ; CHECK-NEXT: dup v0.2s, v0.s[1]
199 %ret = call <1 x i32> @llvm.vector.extract.v1i32.v2i32(<2 x i32> %op, i64 1)
203 ; Don't use SVE for 128-bit vectors.
204 define <2 x i32> @extract_subvector_v4i32(<4 x i32> %op) vscale_range(2,0) #0 {
205 ; CHECK-LABEL: extract_subvector_v4i32:
207 ; CHECK-NEXT: ext v0.16b, v0.16b, v0.16b, #8
208 ; CHECK-NEXT: // kill: def $d0 killed $d0 killed $q0
210 %ret = call <2 x i32> @llvm.vector.extract.v2i32.v4i32(<4 x i32> %op, i64 2)
214 define void @extract_subvector_v8i32(ptr %a, ptr %b) vscale_range(2,0) #0 {
215 ; CHECK-LABEL: extract_subvector_v8i32:
217 ; CHECK-NEXT: ptrue p0.s, vl8
218 ; CHECK-NEXT: ld1w { z0.s }, p0/z, [x0]
219 ; CHECK-NEXT: ext z0.b, z0.b, z0.b, #16
220 ; CHECK-NEXT: str q0, [x1]
222 %op = load <8 x i32>, ptr %a
223 %ret = call <4 x i32> @llvm.vector.extract.v4i32.v8i32(<8 x i32> %op, i64 4)
224 store <4 x i32> %ret, ptr %b
228 define void @extract_subvector_v16i32(ptr %a, ptr %b) #0 {
229 ; VBITS_GE_256-LABEL: extract_subvector_v16i32:
230 ; VBITS_GE_256: // %bb.0:
231 ; VBITS_GE_256-NEXT: ptrue p0.s, vl8
232 ; VBITS_GE_256-NEXT: mov x8, #8 // =0x8
233 ; VBITS_GE_256-NEXT: ld1w { z0.s }, p0/z, [x0, x8, lsl #2]
234 ; VBITS_GE_256-NEXT: st1w { z0.s }, p0, [x1]
235 ; VBITS_GE_256-NEXT: ret
237 ; VBITS_GE_512-LABEL: extract_subvector_v16i32:
238 ; VBITS_GE_512: // %bb.0:
239 ; VBITS_GE_512-NEXT: ptrue p0.s, vl16
240 ; VBITS_GE_512-NEXT: ld1w { z0.s }, p0/z, [x0]
241 ; VBITS_GE_512-NEXT: ptrue p0.s, vl8
242 ; VBITS_GE_512-NEXT: ext z0.b, z0.b, z0.b, #32
243 ; VBITS_GE_512-NEXT: st1w { z0.s }, p0, [x1]
244 ; VBITS_GE_512-NEXT: ret
245 %op = load <16 x i32>, ptr %a
246 %ret = call <8 x i32> @llvm.vector.extract.v8i32.v16i32(<16 x i32> %op, i64 8)
247 store <8 x i32> %ret, ptr %b
251 define void @extract_subvector_v32i32(ptr %a, ptr %b) vscale_range(8,0) #0 {
252 ; CHECK-LABEL: extract_subvector_v32i32:
254 ; CHECK-NEXT: ptrue p0.s, vl32
255 ; CHECK-NEXT: ld1w { z0.s }, p0/z, [x0]
256 ; CHECK-NEXT: ptrue p0.s, vl16
257 ; CHECK-NEXT: ext z0.b, z0.b, z0.b, #64
258 ; CHECK-NEXT: st1w { z0.s }, p0, [x1]
260 %op = load <32 x i32>, ptr %a
261 %ret = call <16 x i32> @llvm.vector.extract.v16i32.v32i32(<32 x i32> %op, i64 16)
262 store <16 x i32> %ret, ptr %b
266 define void @extract_subvector_v64i32(ptr %a, ptr %b) vscale_range(16,0) #0 {
267 ; CHECK-LABEL: extract_subvector_v64i32:
269 ; CHECK-NEXT: ptrue p0.s, vl64
270 ; CHECK-NEXT: ld1w { z0.s }, p0/z, [x0]
271 ; CHECK-NEXT: ptrue p0.s, vl32
272 ; CHECK-NEXT: ext z0.b, z0.b, z0.b, #128
273 ; CHECK-NEXT: st1w { z0.s }, p0, [x1]
275 %op = load <64 x i32>, ptr %a
276 %ret = call <32 x i32> @llvm.vector.extract.v32i32.v64i32(<64 x i32> %op, i64 32)
277 store <32 x i32> %ret, ptr %b
283 ; Don't use SVE for 128-bit vectors.
284 define <1 x i64> @extract_subvector_v2i64(<2 x i64> %op) vscale_range(2,0) #0 {
285 ; CHECK-LABEL: extract_subvector_v2i64:
287 ; CHECK-NEXT: ext v0.16b, v0.16b, v0.16b, #8
288 ; CHECK-NEXT: // kill: def $d0 killed $d0 killed $q0
290 %ret = call <1 x i64> @llvm.vector.extract.v1i64.v2i64(<2 x i64> %op, i64 1)
294 define void @extract_subvector_v4i64(ptr %a, ptr %b) vscale_range(2,0) #0 {
295 ; CHECK-LABEL: extract_subvector_v4i64:
297 ; CHECK-NEXT: ptrue p0.d, vl4
298 ; CHECK-NEXT: ld1d { z0.d }, p0/z, [x0]
299 ; CHECK-NEXT: ext z0.b, z0.b, z0.b, #16
300 ; CHECK-NEXT: str q0, [x1]
302 %op = load <4 x i64>, ptr %a
303 %ret = call <2 x i64> @llvm.vector.extract.v2i64.v4i64(<4 x i64> %op, i64 2)
304 store <2 x i64> %ret, ptr %b
308 define void @extract_subvector_v8i64(ptr %a, ptr %b) vscale_range(2,0) #0 {
309 ; CHECK-LABEL: extract_subvector_v8i64:
311 ; CHECK-NEXT: ptrue p0.d, vl4
312 ; CHECK-NEXT: mov x8, #4 // =0x4
313 ; CHECK-NEXT: ld1d { z0.d }, p0/z, [x0, x8, lsl #3]
314 ; CHECK-NEXT: st1d { z0.d }, p0, [x1]
316 %op = load <8 x i64>, ptr %a
317 %ret = call <4 x i64> @llvm.vector.extract.v4i64.v8i64(<8 x i64> %op, i64 4)
318 store <4 x i64> %ret, ptr %b
322 define void @extract_subvector_v16i64(ptr %a, ptr %b) #0 {
323 ; VBITS_GE_256-LABEL: extract_subvector_v16i64:
324 ; VBITS_GE_256: // %bb.0:
325 ; VBITS_GE_256-NEXT: ptrue p0.d, vl4
326 ; VBITS_GE_256-NEXT: mov x8, #12 // =0xc
327 ; VBITS_GE_256-NEXT: mov x9, #8 // =0x8
328 ; VBITS_GE_256-NEXT: ld1d { z0.d }, p0/z, [x0, x8, lsl #3]
329 ; VBITS_GE_256-NEXT: ld1d { z1.d }, p0/z, [x0, x9, lsl #3]
330 ; VBITS_GE_256-NEXT: mov x8, #4 // =0x4
331 ; VBITS_GE_256-NEXT: st1d { z0.d }, p0, [x1, x8, lsl #3]
332 ; VBITS_GE_256-NEXT: st1d { z1.d }, p0, [x1]
333 ; VBITS_GE_256-NEXT: ret
334 %op = load <16 x i64>, ptr %a
335 %ret = call <8 x i64> @llvm.vector.extract.v8i64.v16i64(<16 x i64> %op, i64 8)
336 store <8 x i64> %ret, ptr %b
340 define void @extract_subvector_v32i64(ptr %a, ptr %b) vscale_range(8,0) #0 {
341 ; CHECK-LABEL: extract_subvector_v32i64:
343 ; CHECK-NEXT: ptrue p0.d, vl16
344 ; CHECK-NEXT: mov x8, #16 // =0x10
345 ; CHECK-NEXT: ld1d { z0.d }, p0/z, [x0, x8, lsl #3]
346 ; CHECK-NEXT: st1d { z0.d }, p0, [x1]
348 %op = load <32 x i64>, ptr %a
349 %ret = call <16 x i64> @llvm.vector.extract.v16i64.v32i64(<32 x i64> %op, i64 16)
350 store <16 x i64> %ret, ptr %b
356 ; Don't use SVE for 64-bit vectors.
357 define <2 x half> @extract_subvector_v4f16(<4 x half> %op) vscale_range(16,0) #0 {
358 ; CHECK-LABEL: extract_subvector_v4f16:
360 ; CHECK-NEXT: // kill: def $d0 killed $d0 def $q0
361 ; CHECK-NEXT: dup v0.2s, v0.s[1]
363 %ret = call <2 x half> @llvm.vector.extract.v2f16.v4f16(<4 x half> %op, i64 2)
367 ; Don't use SVE for 128-bit vectors.
368 define <4 x half> @extract_subvector_v8f16(<8 x half> %op) vscale_range(2,0) #0 {
369 ; CHECK-LABEL: extract_subvector_v8f16:
371 ; CHECK-NEXT: ext v0.16b, v0.16b, v0.16b, #8
372 ; CHECK-NEXT: // kill: def $d0 killed $d0 killed $q0
374 %ret = call <4 x half> @llvm.vector.extract.v4f16.v8f16(<8 x half> %op, i64 4)
378 define void @extract_subvector_v16f16(ptr %a, ptr %b) vscale_range(2,0) #0 {
379 ; CHECK-LABEL: extract_subvector_v16f16:
381 ; CHECK-NEXT: ptrue p0.h, vl16
382 ; CHECK-NEXT: ld1h { z0.h }, p0/z, [x0]
383 ; CHECK-NEXT: ext z0.b, z0.b, z0.b, #16
384 ; CHECK-NEXT: str q0, [x1]
386 %op = load <16 x half>, ptr %a
387 %ret = call <8 x half> @llvm.vector.extract.v8f16.v16f16(<16 x half> %op, i64 8)
388 store <8 x half> %ret, ptr %b
392 define void @extract_subvector_v32f16(ptr %a, ptr %b) #0 {
393 ; VBITS_GE_256-LABEL: extract_subvector_v32f16:
394 ; VBITS_GE_256: // %bb.0:
395 ; VBITS_GE_256-NEXT: ptrue p0.h, vl16
396 ; VBITS_GE_256-NEXT: mov x8, #16 // =0x10
397 ; VBITS_GE_256-NEXT: ld1h { z0.h }, p0/z, [x0, x8, lsl #1]
398 ; VBITS_GE_256-NEXT: st1h { z0.h }, p0, [x1]
399 ; VBITS_GE_256-NEXT: ret
401 ; VBITS_GE_512-LABEL: extract_subvector_v32f16:
402 ; VBITS_GE_512: // %bb.0:
403 ; VBITS_GE_512-NEXT: ptrue p0.h, vl32
404 ; VBITS_GE_512-NEXT: ld1h { z0.h }, p0/z, [x0]
405 ; VBITS_GE_512-NEXT: ptrue p0.h, vl16
406 ; VBITS_GE_512-NEXT: ext z0.b, z0.b, z0.b, #32
407 ; VBITS_GE_512-NEXT: st1h { z0.h }, p0, [x1]
408 ; VBITS_GE_512-NEXT: ret
409 %op = load <32 x half>, ptr %a
410 %ret = call <16 x half> @llvm.vector.extract.v16f16.v32f16(<32 x half> %op, i64 16)
411 store <16 x half> %ret, ptr %b
415 define void @extract_subvector_v64f16(ptr %a, ptr %b) vscale_range(8,0) #0 {
416 ; CHECK-LABEL: extract_subvector_v64f16:
418 ; CHECK-NEXT: ptrue p0.h, vl64
419 ; CHECK-NEXT: ld1h { z0.h }, p0/z, [x0]
420 ; CHECK-NEXT: ptrue p0.h, vl32
421 ; CHECK-NEXT: ext z0.b, z0.b, z0.b, #64
422 ; CHECK-NEXT: st1h { z0.h }, p0, [x1]
424 %op = load <64 x half>, ptr %a
425 %ret = call <32 x half> @llvm.vector.extract.v32f16.v64f16(<64 x half> %op, i64 32)
426 store <32 x half> %ret, ptr %b
430 define void @extract_subvector_v128f16(ptr %a, ptr %b) vscale_range(16,0) #0 {
431 ; CHECK-LABEL: extract_subvector_v128f16:
433 ; CHECK-NEXT: ptrue p0.h, vl128
434 ; CHECK-NEXT: ld1h { z0.h }, p0/z, [x0]
435 ; CHECK-NEXT: ptrue p0.h, vl64
436 ; CHECK-NEXT: ext z0.b, z0.b, z0.b, #128
437 ; CHECK-NEXT: st1h { z0.h }, p0, [x1]
439 %op = load <128 x half>, ptr %a
440 %ret = call <64 x half> @llvm.vector.extract.v64f16.v128f16(<128 x half> %op, i64 64)
441 store <64 x half> %ret, ptr %b
447 ; Don't use SVE for 64-bit vectors.
448 define <1 x float> @extract_subvector_v2f32(<2 x float> %op) vscale_range(2,0) #0 {
449 ; CHECK-LABEL: extract_subvector_v2f32:
451 ; CHECK-NEXT: // kill: def $d0 killed $d0 def $q0
452 ; CHECK-NEXT: dup v0.2s, v0.s[1]
454 %ret = call <1 x float> @llvm.vector.extract.v1f32.v2f32(<2 x float> %op, i64 1)
458 ; Don't use SVE for 128-bit vectors.
459 define <2 x float> @extract_subvector_v4f32(<4 x float> %op) vscale_range(2,0) #0 {
460 ; CHECK-LABEL: extract_subvector_v4f32:
462 ; CHECK-NEXT: ext v0.16b, v0.16b, v0.16b, #8
463 ; CHECK-NEXT: // kill: def $d0 killed $d0 killed $q0
465 %ret = call <2 x float> @llvm.vector.extract.v2f32.v4f32(<4 x float> %op, i64 2)
469 define void @extract_subvector_v8f32(ptr %a, ptr %b) vscale_range(2,0) #0 {
470 ; CHECK-LABEL: extract_subvector_v8f32:
472 ; CHECK-NEXT: ptrue p0.s, vl8
473 ; CHECK-NEXT: ld1w { z0.s }, p0/z, [x0]
474 ; CHECK-NEXT: ext z0.b, z0.b, z0.b, #16
475 ; CHECK-NEXT: str q0, [x1]
477 %op = load <8 x float>, ptr %a
478 %ret = call <4 x float> @llvm.vector.extract.v4f32.v8f32(<8 x float> %op, i64 4)
479 store <4 x float> %ret, ptr %b
483 define void @extract_subvector_v16f32(ptr %a, ptr %b) #0 {
484 ; VBITS_GE_256-LABEL: extract_subvector_v16f32:
485 ; VBITS_GE_256: // %bb.0:
486 ; VBITS_GE_256-NEXT: ptrue p0.s, vl8
487 ; VBITS_GE_256-NEXT: mov x8, #8 // =0x8
488 ; VBITS_GE_256-NEXT: ld1w { z0.s }, p0/z, [x0, x8, lsl #2]
489 ; VBITS_GE_256-NEXT: st1w { z0.s }, p0, [x1]
490 ; VBITS_GE_256-NEXT: ret
492 ; VBITS_GE_512-LABEL: extract_subvector_v16f32:
493 ; VBITS_GE_512: // %bb.0:
494 ; VBITS_GE_512-NEXT: ptrue p0.s, vl16
495 ; VBITS_GE_512-NEXT: ld1w { z0.s }, p0/z, [x0]
496 ; VBITS_GE_512-NEXT: ptrue p0.s, vl8
497 ; VBITS_GE_512-NEXT: ext z0.b, z0.b, z0.b, #32
498 ; VBITS_GE_512-NEXT: st1w { z0.s }, p0, [x1]
499 ; VBITS_GE_512-NEXT: ret
500 %op = load <16 x float>, ptr %a
501 %ret = call <8 x float> @llvm.vector.extract.v8f32.v16f32(<16 x float> %op, i64 8)
502 store <8 x float> %ret, ptr %b
506 define void @extract_subvector_v32f32(ptr %a, ptr %b) vscale_range(8,0) #0 {
507 ; CHECK-LABEL: extract_subvector_v32f32:
509 ; CHECK-NEXT: ptrue p0.s, vl32
510 ; CHECK-NEXT: ld1w { z0.s }, p0/z, [x0]
511 ; CHECK-NEXT: ptrue p0.s, vl16
512 ; CHECK-NEXT: ext z0.b, z0.b, z0.b, #64
513 ; CHECK-NEXT: st1w { z0.s }, p0, [x1]
515 %op = load <32 x float>, ptr %a
516 %ret = call <16 x float> @llvm.vector.extract.v16f32.v32f32(<32 x float> %op, i64 16)
517 store <16 x float> %ret, ptr %b
521 define void @extract_subvector_v64f32(ptr %a, ptr %b) vscale_range(16,0) #0 {
522 ; CHECK-LABEL: extract_subvector_v64f32:
524 ; CHECK-NEXT: ptrue p0.s, vl64
525 ; CHECK-NEXT: ld1w { z0.s }, p0/z, [x0]
526 ; CHECK-NEXT: ptrue p0.s, vl32
527 ; CHECK-NEXT: ext z0.b, z0.b, z0.b, #128
528 ; CHECK-NEXT: st1w { z0.s }, p0, [x1]
530 %op = load <64 x float>, ptr %a
531 %ret = call <32 x float> @llvm.vector.extract.v32f32.v64f32(<64 x float> %op, i64 32)
532 store <32 x float> %ret, ptr %b
538 ; Don't use SVE for 128-bit vectors.
539 define <1 x double> @extract_subvector_v2f64(<2 x double> %op) vscale_range(2,0) #0 {
540 ; CHECK-LABEL: extract_subvector_v2f64:
542 ; CHECK-NEXT: ext v0.16b, v0.16b, v0.16b, #8
543 ; CHECK-NEXT: // kill: def $d0 killed $d0 killed $q0
545 %ret = call <1 x double> @llvm.vector.extract.v1f64.v2f64(<2 x double> %op, i64 1)
546 ret <1 x double> %ret
549 define void @extract_subvector_v4f64(ptr %a, ptr %b) vscale_range(2,0) #0 {
550 ; CHECK-LABEL: extract_subvector_v4f64:
552 ; CHECK-NEXT: ptrue p0.d, vl4
553 ; CHECK-NEXT: ld1d { z0.d }, p0/z, [x0]
554 ; CHECK-NEXT: ext z0.b, z0.b, z0.b, #16
555 ; CHECK-NEXT: str q0, [x1]
557 %op = load <4 x double>, ptr %a
558 %ret = call <2 x double> @llvm.vector.extract.v2f64.v4f64(<4 x double> %op, i64 2)
559 store <2 x double> %ret, ptr %b
563 define void @extract_subvector_v8f64(ptr %a, ptr %b) #0 {
564 ; VBITS_GE_256-LABEL: extract_subvector_v8f64:
565 ; VBITS_GE_256: // %bb.0:
566 ; VBITS_GE_256-NEXT: ptrue p0.d, vl4
567 ; VBITS_GE_256-NEXT: mov x8, #4 // =0x4
568 ; VBITS_GE_256-NEXT: ld1d { z0.d }, p0/z, [x0, x8, lsl #3]
569 ; VBITS_GE_256-NEXT: st1d { z0.d }, p0, [x1]
570 ; VBITS_GE_256-NEXT: ret
572 ; VBITS_GE_512-LABEL: extract_subvector_v8f64:
573 ; VBITS_GE_512: // %bb.0:
574 ; VBITS_GE_512-NEXT: ptrue p0.d, vl8
575 ; VBITS_GE_512-NEXT: ld1d { z0.d }, p0/z, [x0]
576 ; VBITS_GE_512-NEXT: ptrue p0.d, vl4
577 ; VBITS_GE_512-NEXT: ext z0.b, z0.b, z0.b, #32
578 ; VBITS_GE_512-NEXT: st1d { z0.d }, p0, [x1]
579 ; VBITS_GE_512-NEXT: ret
580 %op = load <8 x double>, ptr %a
581 %ret = call <4 x double> @llvm.vector.extract.v4f64.v8f64(<8 x double> %op, i64 4)
582 store <4 x double> %ret, ptr %b
586 define void @extract_subvector_v16f64(ptr %a, ptr %b) vscale_range(8,0) #0 {
587 ; CHECK-LABEL: extract_subvector_v16f64:
589 ; CHECK-NEXT: ptrue p0.d, vl16
590 ; CHECK-NEXT: ld1d { z0.d }, p0/z, [x0]
591 ; CHECK-NEXT: ptrue p0.d, vl8
592 ; CHECK-NEXT: ext z0.b, z0.b, z0.b, #64
593 ; CHECK-NEXT: st1d { z0.d }, p0, [x1]
595 %op = load <16 x double>, ptr %a
596 %ret = call <8 x double> @llvm.vector.extract.v8f64.v16f64(<16 x double> %op, i64 8)
597 store <8 x double> %ret, ptr %b
601 define void @extract_subvector_v32f64(ptr %a, ptr %b) vscale_range(16,0) #0 {
602 ; CHECK-LABEL: extract_subvector_v32f64:
604 ; CHECK-NEXT: ptrue p0.d, vl32
605 ; CHECK-NEXT: ld1d { z0.d }, p0/z, [x0]
606 ; CHECK-NEXT: ptrue p0.d, vl16
607 ; CHECK-NEXT: ext z0.b, z0.b, z0.b, #128
608 ; CHECK-NEXT: st1d { z0.d }, p0, [x1]
610 %op = load <32 x double>, ptr %a
611 %ret = call <16 x double> @llvm.vector.extract.v16f64.v32f64(<32 x double> %op, i64 16)
612 store <16 x double> %ret, ptr %b
616 ; Test for infinite loop due to fold:
617 ; extract_subvector(insert_subvector(x,y,c1),c2)--> extract_subvector(y,c2-c1)
618 define void @extract_subvector_legalization_v8i32() vscale_range(2,2) #0 {
619 ; CHECK-LABEL: extract_subvector_legalization_v8i32:
620 ; CHECK: // %bb.0: // %entry
621 ; CHECK-NEXT: ptrue p0.s
622 ; CHECK-NEXT: adrp x8, .LCPI40_0
623 ; CHECK-NEXT: add x8, x8, :lo12:.LCPI40_0
624 ; CHECK-NEXT: movi v2.2d, #0000000000000000
625 ; CHECK-NEXT: ptrue p1.d
626 ; CHECK-NEXT: ld1w { z0.s }, p0/z, [x8]
627 ; CHECK-NEXT: mov z1.d, z0.d
628 ; CHECK-NEXT: ext z1.b, z1.b, z0.b, #16
629 ; CHECK-NEXT: cmeq v0.4s, v0.4s, v2.4s
630 ; CHECK-NEXT: cmeq v1.4s, v1.4s, v2.4s
631 ; CHECK-NEXT: sunpklo z0.d, z0.s
632 ; CHECK-NEXT: sunpklo z1.d, z1.s
633 ; CHECK-NEXT: cmpne p0.d, p1/z, z1.d, #0
634 ; CHECK-NEXT: cmpne p1.d, p1/z, z0.d, #0
635 ; CHECK-NEXT: .LBB40_1: // %body
636 ; CHECK-NEXT: // =>This Inner Loop Header: Depth=1
637 ; CHECK-NEXT: st1d { z0.d }, p1, [x8]
638 ; CHECK-NEXT: st1d { z0.d }, p0, [x8]
639 ; CHECK-NEXT: b .LBB40_1
641 %splat = shufflevector <8 x i32> poison, <8 x i32> poison, <8 x i32> zeroinitializer
644 %0 = icmp eq <8 x i32> zeroinitializer, %splat
645 tail call void @llvm.masked.store.v8f64.p0(<8 x double> poison, ptr poison, i32 8, <8 x i1> %0)
648 declare void @llvm.masked.store.v8f64.p0(<8 x double>, ptr nocapture, i32 immarg, <8 x i1>)
650 declare <4 x i8> @llvm.vector.extract.v4i8.v8i8(<8 x i8>, i64)
651 declare <8 x i8> @llvm.vector.extract.v8i8.v16i8(<16 x i8>, i64)
652 declare <16 x i8> @llvm.vector.extract.v16i8.v32i8(<32 x i8>, i64)
653 declare <32 x i8> @llvm.vector.extract.v32i8.v64i8(<64 x i8>, i64)
654 declare <64 x i8> @llvm.vector.extract.v64i8.v128i8(<128 x i8>, i64)
655 declare <128 x i8> @llvm.vector.extract.v128i8.v256i8(<256 x i8>, i64)
657 declare <2 x i16> @llvm.vector.extract.v2i16.v4i16(<4 x i16>, i64)
658 declare <4 x i16> @llvm.vector.extract.v4i16.v8i16(<8 x i16>, i64)
659 declare <8 x i16> @llvm.vector.extract.v8i16.v16i16(<16 x i16>, i64)
660 declare <16 x i16> @llvm.vector.extract.v16i16.v32i16(<32 x i16>, i64)
661 declare <32 x i16> @llvm.vector.extract.v32i16.v64i16(<64 x i16>, i64)
662 declare <64 x i16> @llvm.vector.extract.v64i16.v128i16(<128 x i16>, i64)
664 declare <1 x i32> @llvm.vector.extract.v1i32.v2i32(<2 x i32>, i64)
665 declare <2 x i32> @llvm.vector.extract.v2i32.v4i32(<4 x i32>, i64)
666 declare <4 x i32> @llvm.vector.extract.v4i32.v8i32(<8 x i32>, i64)
667 declare <8 x i32> @llvm.vector.extract.v8i32.v16i32(<16 x i32>, i64)
668 declare <16 x i32> @llvm.vector.extract.v16i32.v32i32(<32 x i32>, i64)
669 declare <32 x i32> @llvm.vector.extract.v32i32.v64i32(<64 x i32>, i64)
671 declare <1 x i64> @llvm.vector.extract.v1i64.v2i64(<2 x i64>, i64)
672 declare <2 x i64> @llvm.vector.extract.v2i64.v4i64(<4 x i64>, i64)
673 declare <4 x i64> @llvm.vector.extract.v4i64.v8i64(<8 x i64>, i64)
674 declare <8 x i64> @llvm.vector.extract.v8i64.v16i64(<16 x i64>, i64)
675 declare <16 x i64> @llvm.vector.extract.v16i64.v32i64(<32 x i64>, i64)
677 declare <2 x half> @llvm.vector.extract.v2f16.v4f16(<4 x half>, i64)
678 declare <4 x half> @llvm.vector.extract.v4f16.v8f16(<8 x half>, i64)
679 declare <8 x half> @llvm.vector.extract.v8f16.v16f16(<16 x half>, i64)
680 declare <16 x half> @llvm.vector.extract.v16f16.v32f16(<32 x half>, i64)
681 declare <32 x half> @llvm.vector.extract.v32f16.v64f16(<64 x half>, i64)
682 declare <64 x half> @llvm.vector.extract.v64f16.v128f16(<128 x half>, i64)
684 declare <1 x float> @llvm.vector.extract.v1f32.v2f32(<2 x float>, i64)
685 declare <2 x float> @llvm.vector.extract.v2f32.v4f32(<4 x float>, i64)
686 declare <4 x float> @llvm.vector.extract.v4f32.v8f32(<8 x float>, i64)
687 declare <8 x float> @llvm.vector.extract.v8f32.v16f32(<16 x float>, i64)
688 declare <16 x float> @llvm.vector.extract.v16f32.v32f32(<32 x float>, i64)
689 declare <32 x float> @llvm.vector.extract.v32f32.v64f32(<64 x float>, i64)
691 declare <1 x double> @llvm.vector.extract.v1f64.v2f64(<2 x double>, i64)
692 declare <2 x double> @llvm.vector.extract.v2f64.v4f64(<4 x double>, i64)
693 declare <4 x double> @llvm.vector.extract.v4f64.v8f64(<8 x double>, i64)
694 declare <8 x double> @llvm.vector.extract.v8f64.v16f64(<16 x double>, i64)
695 declare <16 x double> @llvm.vector.extract.v16f64.v32f64(<32 x double>, i64)
697 attributes #0 = { "target-features"="+sve" }