1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple riscv32 -mattr=+m,+d,+zfh,+zvfh,+v,+zvfbfmin -verify-machineinstrs < %s | FileCheck %s
3 ; RUN: llc -mtriple riscv64 -mattr=+m,+d,+zfh,+zvfh,+v,+zvfbfmin -verify-machineinstrs < %s | FileCheck %s
5 define <vscale x 4 x i32> @extract_nxv8i32_nxv4i32_0(<vscale x 8 x i32> %vec) {
6 ; CHECK-LABEL: extract_nxv8i32_nxv4i32_0:
9 %c = call <vscale x 4 x i32> @llvm.vector.extract.nxv4i32.nxv8i32(<vscale x 8 x i32> %vec, i64 0)
10 ret <vscale x 4 x i32> %c
13 define <vscale x 4 x i32> @extract_nxv8i32_nxv4i32_4(<vscale x 8 x i32> %vec) {
14 ; CHECK-LABEL: extract_nxv8i32_nxv4i32_4:
16 ; CHECK-NEXT: vmv2r.v v8, v10
18 %c = call <vscale x 4 x i32> @llvm.vector.extract.nxv4i32.nxv8i32(<vscale x 8 x i32> %vec, i64 4)
19 ret <vscale x 4 x i32> %c
22 define <vscale x 2 x i32> @extract_nxv8i32_nxv2i32_0(<vscale x 8 x i32> %vec) {
23 ; CHECK-LABEL: extract_nxv8i32_nxv2i32_0:
26 %c = call <vscale x 2 x i32> @llvm.vector.extract.nxv2i32.nxv8i32(<vscale x 8 x i32> %vec, i64 0)
27 ret <vscale x 2 x i32> %c
30 define <vscale x 2 x i32> @extract_nxv8i32_nxv2i32_2(<vscale x 8 x i32> %vec) {
31 ; CHECK-LABEL: extract_nxv8i32_nxv2i32_2:
33 ; CHECK-NEXT: vmv1r.v v8, v9
35 %c = call <vscale x 2 x i32> @llvm.vector.extract.nxv2i32.nxv8i32(<vscale x 8 x i32> %vec, i64 2)
36 ret <vscale x 2 x i32> %c
39 define <vscale x 2 x i32> @extract_nxv8i32_nxv2i32_4(<vscale x 8 x i32> %vec) {
40 ; CHECK-LABEL: extract_nxv8i32_nxv2i32_4:
42 ; CHECK-NEXT: vmv1r.v v8, v10
44 %c = call <vscale x 2 x i32> @llvm.vector.extract.nxv2i32.nxv8i32(<vscale x 8 x i32> %vec, i64 4)
45 ret <vscale x 2 x i32> %c
48 define <vscale x 2 x i32> @extract_nxv8i32_nxv2i32_6(<vscale x 8 x i32> %vec) {
49 ; CHECK-LABEL: extract_nxv8i32_nxv2i32_6:
51 ; CHECK-NEXT: vmv1r.v v8, v11
53 %c = call <vscale x 2 x i32> @llvm.vector.extract.nxv2i32.nxv8i32(<vscale x 8 x i32> %vec, i64 6)
54 ret <vscale x 2 x i32> %c
57 define <vscale x 8 x i32> @extract_nxv16i32_nxv8i32_0(<vscale x 16 x i32> %vec) {
58 ; CHECK-LABEL: extract_nxv16i32_nxv8i32_0:
61 %c = call <vscale x 8 x i32> @llvm.vector.extract.nxv8i32.nxv16i32(<vscale x 16 x i32> %vec, i64 0)
62 ret <vscale x 8 x i32> %c
65 define <vscale x 8 x i32> @extract_nxv16i32_nxv8i32_8(<vscale x 16 x i32> %vec) {
66 ; CHECK-LABEL: extract_nxv16i32_nxv8i32_8:
68 ; CHECK-NEXT: vmv4r.v v8, v12
70 %c = call <vscale x 8 x i32> @llvm.vector.extract.nxv8i32.nxv16i32(<vscale x 16 x i32> %vec, i64 8)
71 ret <vscale x 8 x i32> %c
74 define <vscale x 4 x i32> @extract_nxv16i32_nxv4i32_0(<vscale x 16 x i32> %vec) {
75 ; CHECK-LABEL: extract_nxv16i32_nxv4i32_0:
78 %c = call <vscale x 4 x i32> @llvm.vector.extract.nxv4i32.nxv16i32(<vscale x 16 x i32> %vec, i64 0)
79 ret <vscale x 4 x i32> %c
82 define <vscale x 4 x i32> @extract_nxv16i32_nxv4i32_4(<vscale x 16 x i32> %vec) {
83 ; CHECK-LABEL: extract_nxv16i32_nxv4i32_4:
85 ; CHECK-NEXT: vmv2r.v v8, v10
87 %c = call <vscale x 4 x i32> @llvm.vector.extract.nxv4i32.nxv16i32(<vscale x 16 x i32> %vec, i64 4)
88 ret <vscale x 4 x i32> %c
91 define <vscale x 4 x i32> @extract_nxv16i32_nxv4i32_8(<vscale x 16 x i32> %vec) {
92 ; CHECK-LABEL: extract_nxv16i32_nxv4i32_8:
94 ; CHECK-NEXT: vmv2r.v v8, v12
96 %c = call <vscale x 4 x i32> @llvm.vector.extract.nxv4i32.nxv16i32(<vscale x 16 x i32> %vec, i64 8)
97 ret <vscale x 4 x i32> %c
100 define <vscale x 4 x i32> @extract_nxv16i32_nxv4i32_12(<vscale x 16 x i32> %vec) {
101 ; CHECK-LABEL: extract_nxv16i32_nxv4i32_12:
103 ; CHECK-NEXT: vmv2r.v v8, v14
105 %c = call <vscale x 4 x i32> @llvm.vector.extract.nxv4i32.nxv16i32(<vscale x 16 x i32> %vec, i64 12)
106 ret <vscale x 4 x i32> %c
109 define <vscale x 2 x i32> @extract_nxv16i32_nxv2i32_0(<vscale x 16 x i32> %vec) {
110 ; CHECK-LABEL: extract_nxv16i32_nxv2i32_0:
113 %c = call <vscale x 2 x i32> @llvm.vector.extract.nxv2i32.nxv16i32(<vscale x 16 x i32> %vec, i64 0)
114 ret <vscale x 2 x i32> %c
117 define <vscale x 2 x i32> @extract_nxv16i32_nxv2i32_2(<vscale x 16 x i32> %vec) {
118 ; CHECK-LABEL: extract_nxv16i32_nxv2i32_2:
120 ; CHECK-NEXT: vmv1r.v v8, v9
122 %c = call <vscale x 2 x i32> @llvm.vector.extract.nxv2i32.nxv16i32(<vscale x 16 x i32> %vec, i64 2)
123 ret <vscale x 2 x i32> %c
126 define <vscale x 2 x i32> @extract_nxv16i32_nxv2i32_4(<vscale x 16 x i32> %vec) {
127 ; CHECK-LABEL: extract_nxv16i32_nxv2i32_4:
129 ; CHECK-NEXT: vmv1r.v v8, v10
131 %c = call <vscale x 2 x i32> @llvm.vector.extract.nxv2i32.nxv16i32(<vscale x 16 x i32> %vec, i64 4)
132 ret <vscale x 2 x i32> %c
135 define <vscale x 2 x i32> @extract_nxv16i32_nxv2i32_6(<vscale x 16 x i32> %vec) {
136 ; CHECK-LABEL: extract_nxv16i32_nxv2i32_6:
138 ; CHECK-NEXT: vmv1r.v v8, v11
140 %c = call <vscale x 2 x i32> @llvm.vector.extract.nxv2i32.nxv16i32(<vscale x 16 x i32> %vec, i64 6)
141 ret <vscale x 2 x i32> %c
144 define <vscale x 2 x i32> @extract_nxv16i32_nxv2i32_8(<vscale x 16 x i32> %vec) {
145 ; CHECK-LABEL: extract_nxv16i32_nxv2i32_8:
147 ; CHECK-NEXT: vmv1r.v v8, v12
149 %c = call <vscale x 2 x i32> @llvm.vector.extract.nxv2i32.nxv16i32(<vscale x 16 x i32> %vec, i64 8)
150 ret <vscale x 2 x i32> %c
153 define <vscale x 2 x i32> @extract_nxv16i32_nxv2i32_10(<vscale x 16 x i32> %vec) {
154 ; CHECK-LABEL: extract_nxv16i32_nxv2i32_10:
156 ; CHECK-NEXT: vmv1r.v v8, v13
158 %c = call <vscale x 2 x i32> @llvm.vector.extract.nxv2i32.nxv16i32(<vscale x 16 x i32> %vec, i64 10)
159 ret <vscale x 2 x i32> %c
162 define <vscale x 2 x i32> @extract_nxv16i32_nxv2i32_12(<vscale x 16 x i32> %vec) {
163 ; CHECK-LABEL: extract_nxv16i32_nxv2i32_12:
165 ; CHECK-NEXT: vmv1r.v v8, v14
167 %c = call <vscale x 2 x i32> @llvm.vector.extract.nxv2i32.nxv16i32(<vscale x 16 x i32> %vec, i64 12)
168 ret <vscale x 2 x i32> %c
171 define <vscale x 2 x i32> @extract_nxv16i32_nxv2i32_14(<vscale x 16 x i32> %vec) {
172 ; CHECK-LABEL: extract_nxv16i32_nxv2i32_14:
174 ; CHECK-NEXT: vmv1r.v v8, v15
176 %c = call <vscale x 2 x i32> @llvm.vector.extract.nxv2i32.nxv16i32(<vscale x 16 x i32> %vec, i64 14)
177 ret <vscale x 2 x i32> %c
180 define <vscale x 1 x i32> @extract_nxv16i32_nxv1i32_0(<vscale x 16 x i32> %vec) {
181 ; CHECK-LABEL: extract_nxv16i32_nxv1i32_0:
184 %c = call <vscale x 1 x i32> @llvm.vector.extract.nxv1i32.nxv16i32(<vscale x 16 x i32> %vec, i64 0)
185 ret <vscale x 1 x i32> %c
188 define <vscale x 1 x i32> @extract_nxv16i32_nxv1i32_1(<vscale x 16 x i32> %vec) {
189 ; CHECK-LABEL: extract_nxv16i32_nxv1i32_1:
191 ; CHECK-NEXT: csrr a0, vlenb
192 ; CHECK-NEXT: srli a0, a0, 3
193 ; CHECK-NEXT: vsetvli a1, zero, e32, m1, ta, ma
194 ; CHECK-NEXT: vslidedown.vx v8, v8, a0
196 %c = call <vscale x 1 x i32> @llvm.vector.extract.nxv1i32.nxv16i32(<vscale x 16 x i32> %vec, i64 1)
197 ret <vscale x 1 x i32> %c
200 define <vscale x 1 x i32> @extract_nxv16i32_nxv1i32_3(<vscale x 16 x i32> %vec) {
201 ; CHECK-LABEL: extract_nxv16i32_nxv1i32_3:
203 ; CHECK-NEXT: csrr a0, vlenb
204 ; CHECK-NEXT: srli a0, a0, 3
205 ; CHECK-NEXT: vsetvli a1, zero, e32, m1, ta, ma
206 ; CHECK-NEXT: vslidedown.vx v8, v9, a0
208 %c = call <vscale x 1 x i32> @llvm.vector.extract.nxv1i32.nxv16i32(<vscale x 16 x i32> %vec, i64 3)
209 ret <vscale x 1 x i32> %c
212 define <vscale x 1 x i32> @extract_nxv16i32_nxv1i32_15(<vscale x 16 x i32> %vec) {
213 ; CHECK-LABEL: extract_nxv16i32_nxv1i32_15:
215 ; CHECK-NEXT: csrr a0, vlenb
216 ; CHECK-NEXT: srli a0, a0, 3
217 ; CHECK-NEXT: vsetvli a1, zero, e32, m1, ta, ma
218 ; CHECK-NEXT: vslidedown.vx v8, v15, a0
220 %c = call <vscale x 1 x i32> @llvm.vector.extract.nxv1i32.nxv16i32(<vscale x 16 x i32> %vec, i64 15)
221 ret <vscale x 1 x i32> %c
224 define <vscale x 1 x i32> @extract_nxv16i32_nxv1i32_2(<vscale x 16 x i32> %vec) {
225 ; CHECK-LABEL: extract_nxv16i32_nxv1i32_2:
227 ; CHECK-NEXT: vmv1r.v v8, v9
229 %c = call <vscale x 1 x i32> @llvm.vector.extract.nxv1i32.nxv16i32(<vscale x 16 x i32> %vec, i64 2)
230 ret <vscale x 1 x i32> %c
233 define <vscale x 1 x i32> @extract_nxv2i32_nxv1i32_0(<vscale x 2 x i32> %vec) {
234 ; CHECK-LABEL: extract_nxv2i32_nxv1i32_0:
237 %c = call <vscale x 1 x i32> @llvm.vector.extract.nxv1i32.nxv2i32(<vscale x 2 x i32> %vec, i64 0)
238 ret <vscale x 1 x i32> %c
241 define <vscale x 2 x i8> @extract_nxv32i8_nxv2i8_0(<vscale x 32 x i8> %vec) {
242 ; CHECK-LABEL: extract_nxv32i8_nxv2i8_0:
245 %c = call <vscale x 2 x i8> @llvm.vector.extract.nxv2i8.nxv32i8(<vscale x 32 x i8> %vec, i64 0)
246 ret <vscale x 2 x i8> %c
249 define <vscale x 2 x i8> @extract_nxv32i8_nxv2i8_2(<vscale x 32 x i8> %vec) {
250 ; CHECK-LABEL: extract_nxv32i8_nxv2i8_2:
252 ; CHECK-NEXT: csrr a0, vlenb
253 ; CHECK-NEXT: srli a0, a0, 2
254 ; CHECK-NEXT: vsetvli a1, zero, e8, m1, ta, ma
255 ; CHECK-NEXT: vslidedown.vx v8, v8, a0
257 %c = call <vscale x 2 x i8> @llvm.vector.extract.nxv2i8.nxv32i8(<vscale x 32 x i8> %vec, i64 2)
258 ret <vscale x 2 x i8> %c
261 define <vscale x 2 x i8> @extract_nxv32i8_nxv2i8_4(<vscale x 32 x i8> %vec) {
262 ; CHECK-LABEL: extract_nxv32i8_nxv2i8_4:
264 ; CHECK-NEXT: csrr a0, vlenb
265 ; CHECK-NEXT: srli a0, a0, 1
266 ; CHECK-NEXT: vsetvli a1, zero, e8, m1, ta, ma
267 ; CHECK-NEXT: vslidedown.vx v8, v8, a0
269 %c = call <vscale x 2 x i8> @llvm.vector.extract.nxv2i8.nxv32i8(<vscale x 32 x i8> %vec, i64 4)
270 ret <vscale x 2 x i8> %c
273 define <vscale x 2 x i8> @extract_nxv32i8_nxv2i8_6(<vscale x 32 x i8> %vec) {
274 ; CHECK-LABEL: extract_nxv32i8_nxv2i8_6:
276 ; CHECK-NEXT: csrr a0, vlenb
277 ; CHECK-NEXT: srli a1, a0, 3
278 ; CHECK-NEXT: slli a1, a1, 1
279 ; CHECK-NEXT: sub a0, a0, a1
280 ; CHECK-NEXT: vsetvli a1, zero, e8, m1, ta, ma
281 ; CHECK-NEXT: vslidedown.vx v8, v8, a0
283 %c = call <vscale x 2 x i8> @llvm.vector.extract.nxv2i8.nxv32i8(<vscale x 32 x i8> %vec, i64 6)
284 ret <vscale x 2 x i8> %c
287 define <vscale x 2 x i8> @extract_nxv32i8_nxv2i8_8(<vscale x 32 x i8> %vec) {
288 ; CHECK-LABEL: extract_nxv32i8_nxv2i8_8:
290 ; CHECK-NEXT: vmv1r.v v8, v9
292 %c = call <vscale x 2 x i8> @llvm.vector.extract.nxv2i8.nxv32i8(<vscale x 32 x i8> %vec, i64 8)
293 ret <vscale x 2 x i8> %c
296 define <vscale x 2 x i8> @extract_nxv32i8_nxv2i8_22(<vscale x 32 x i8> %vec) {
297 ; CHECK-LABEL: extract_nxv32i8_nxv2i8_22:
299 ; CHECK-NEXT: csrr a0, vlenb
300 ; CHECK-NEXT: srli a1, a0, 3
301 ; CHECK-NEXT: slli a1, a1, 1
302 ; CHECK-NEXT: sub a0, a0, a1
303 ; CHECK-NEXT: vsetvli a1, zero, e8, m1, ta, ma
304 ; CHECK-NEXT: vslidedown.vx v8, v10, a0
306 %c = call <vscale x 2 x i8> @llvm.vector.extract.nxv2i8.nxv32i8(<vscale x 32 x i8> %vec, i64 22)
307 ret <vscale x 2 x i8> %c
310 define <vscale x 1 x i8> @extract_nxv8i8_nxv1i8_7(<vscale x 8 x i8> %vec) {
311 ; CHECK-LABEL: extract_nxv8i8_nxv1i8_7:
313 ; CHECK-NEXT: csrr a0, vlenb
314 ; CHECK-NEXT: srli a1, a0, 3
315 ; CHECK-NEXT: sub a0, a0, a1
316 ; CHECK-NEXT: vsetvli a1, zero, e8, m1, ta, ma
317 ; CHECK-NEXT: vslidedown.vx v8, v8, a0
319 %c = call <vscale x 1 x i8> @llvm.vector.extract.nxv1i8.nxv8i8(<vscale x 8 x i8> %vec, i64 7)
320 ret <vscale x 1 x i8> %c
323 define <vscale x 1 x i8> @extract_nxv4i8_nxv1i8_3(<vscale x 4 x i8> %vec) {
324 ; CHECK-LABEL: extract_nxv4i8_nxv1i8_3:
326 ; CHECK-NEXT: csrr a0, vlenb
327 ; CHECK-NEXT: srli a0, a0, 3
328 ; CHECK-NEXT: slli a1, a0, 1
329 ; CHECK-NEXT: add a0, a1, a0
330 ; CHECK-NEXT: vsetvli a1, zero, e8, mf2, ta, ma
331 ; CHECK-NEXT: vslidedown.vx v8, v8, a0
333 %c = call <vscale x 1 x i8> @llvm.vector.extract.nxv1i8.nxv4i8(<vscale x 4 x i8> %vec, i64 3)
334 ret <vscale x 1 x i8> %c
337 define <vscale x 2 x half> @extract_nxv2f16_nxv16f16_0(<vscale x 16 x half> %vec) {
338 ; CHECK-LABEL: extract_nxv2f16_nxv16f16_0:
341 %c = call <vscale x 2 x half> @llvm.vector.extract.nxv2f16.nxv16f16(<vscale x 16 x half> %vec, i64 0)
342 ret <vscale x 2 x half> %c
345 define <vscale x 2 x half> @extract_nxv2f16_nxv16f16_2(<vscale x 16 x half> %vec) {
346 ; CHECK-LABEL: extract_nxv2f16_nxv16f16_2:
348 ; CHECK-NEXT: csrr a0, vlenb
349 ; CHECK-NEXT: srli a0, a0, 2
350 ; CHECK-NEXT: vsetvli a1, zero, e16, m1, ta, ma
351 ; CHECK-NEXT: vslidedown.vx v8, v8, a0
353 %c = call <vscale x 2 x half> @llvm.vector.extract.nxv2f16.nxv16f16(<vscale x 16 x half> %vec, i64 2)
354 ret <vscale x 2 x half> %c
357 define <vscale x 2 x half> @extract_nxv2f16_nxv16f16_4(<vscale x 16 x half> %vec) {
358 ; CHECK-LABEL: extract_nxv2f16_nxv16f16_4:
360 ; CHECK-NEXT: vmv1r.v v8, v9
362 %c = call <vscale x 2 x half> @llvm.vector.extract.nxv2f16.nxv16f16(<vscale x 16 x half> %vec, i64 4)
363 ret <vscale x 2 x half> %c
366 define <vscale x 8 x i1> @extract_nxv64i1_nxv8i1_0(<vscale x 64 x i1> %mask) {
367 ; CHECK-LABEL: extract_nxv64i1_nxv8i1_0:
370 %c = call <vscale x 8 x i1> @llvm.vector.extract.nxv8i1(<vscale x 64 x i1> %mask, i64 0)
371 ret <vscale x 8 x i1> %c
374 define <vscale x 8 x i1> @extract_nxv64i1_nxv8i1_8(<vscale x 64 x i1> %mask) {
375 ; CHECK-LABEL: extract_nxv64i1_nxv8i1_8:
377 ; CHECK-NEXT: csrr a0, vlenb
378 ; CHECK-NEXT: srli a0, a0, 3
379 ; CHECK-NEXT: vsetvli a1, zero, e8, m1, ta, ma
380 ; CHECK-NEXT: vslidedown.vx v0, v0, a0
382 %c = call <vscale x 8 x i1> @llvm.vector.extract.nxv8i1(<vscale x 64 x i1> %mask, i64 8)
383 ret <vscale x 8 x i1> %c
386 define <vscale x 2 x i1> @extract_nxv64i1_nxv2i1_0(<vscale x 64 x i1> %mask) {
387 ; CHECK-LABEL: extract_nxv64i1_nxv2i1_0:
390 %c = call <vscale x 2 x i1> @llvm.vector.extract.nxv2i1(<vscale x 64 x i1> %mask, i64 0)
391 ret <vscale x 2 x i1> %c
394 define <vscale x 2 x i1> @extract_nxv64i1_nxv2i1_2(<vscale x 64 x i1> %mask) {
395 ; CHECK-LABEL: extract_nxv64i1_nxv2i1_2:
397 ; CHECK-NEXT: vsetvli a0, zero, e8, m8, ta, ma
398 ; CHECK-NEXT: vmv.v.i v8, 0
399 ; CHECK-NEXT: vmerge.vim v8, v8, 1, v0
400 ; CHECK-NEXT: csrr a0, vlenb
401 ; CHECK-NEXT: srli a0, a0, 2
402 ; CHECK-NEXT: vsetvli a1, zero, e8, m1, ta, ma
403 ; CHECK-NEXT: vslidedown.vx v8, v8, a0
404 ; CHECK-NEXT: vsetvli a0, zero, e8, mf4, ta, ma
405 ; CHECK-NEXT: vmsne.vi v0, v8, 0
407 %c = call <vscale x 2 x i1> @llvm.vector.extract.nxv2i1(<vscale x 64 x i1> %mask, i64 2)
408 ret <vscale x 2 x i1> %c
411 define <vscale x 4 x i1> @extract_nxv4i1_nxv32i1_0(<vscale x 32 x i1> %x) {
412 ; CHECK-LABEL: extract_nxv4i1_nxv32i1_0:
415 %c = call <vscale x 4 x i1> @llvm.vector.extract.nxv4i1(<vscale x 32 x i1> %x, i64 0)
416 ret <vscale x 4 x i1> %c
419 define <vscale x 4 x i1> @extract_nxv4i1_nxv32i1_4(<vscale x 32 x i1> %x) {
420 ; CHECK-LABEL: extract_nxv4i1_nxv32i1_4:
422 ; CHECK-NEXT: vsetvli a0, zero, e8, m4, ta, ma
423 ; CHECK-NEXT: vmv.v.i v8, 0
424 ; CHECK-NEXT: vmerge.vim v8, v8, 1, v0
425 ; CHECK-NEXT: csrr a0, vlenb
426 ; CHECK-NEXT: srli a0, a0, 1
427 ; CHECK-NEXT: vsetvli a1, zero, e8, m1, ta, ma
428 ; CHECK-NEXT: vslidedown.vx v8, v8, a0
429 ; CHECK-NEXT: vsetvli a0, zero, e8, mf2, ta, ma
430 ; CHECK-NEXT: vmsne.vi v0, v8, 0
432 %c = call <vscale x 4 x i1> @llvm.vector.extract.nxv4i1(<vscale x 32 x i1> %x, i64 4)
433 ret <vscale x 4 x i1> %c
436 define <vscale x 16 x i1> @extract_nxv16i1_nxv32i1_0(<vscale x 32 x i1> %x) {
437 ; CHECK-LABEL: extract_nxv16i1_nxv32i1_0:
440 %c = call <vscale x 16 x i1> @llvm.vector.extract.nxv16i1(<vscale x 32 x i1> %x, i64 0)
441 ret <vscale x 16 x i1> %c
444 define <vscale x 16 x i1> @extract_nxv16i1_nxv32i1_16(<vscale x 32 x i1> %x) {
445 ; CHECK-LABEL: extract_nxv16i1_nxv32i1_16:
447 ; CHECK-NEXT: csrr a0, vlenb
448 ; CHECK-NEXT: srli a0, a0, 2
449 ; CHECK-NEXT: vsetvli a1, zero, e8, mf2, ta, ma
450 ; CHECK-NEXT: vslidedown.vx v0, v0, a0
452 %c = call <vscale x 16 x i1> @llvm.vector.extract.nxv16i1(<vscale x 32 x i1> %x, i64 16)
453 ret <vscale x 16 x i1> %c
457 ; Extract f16 vector that needs widening from one that needs widening.
459 define <vscale x 6 x half> @extract_nxv6f16_nxv12f16_0(<vscale x 12 x half> %in) {
460 ; CHECK-LABEL: extract_nxv6f16_nxv12f16_0:
463 %res = call <vscale x 6 x half> @llvm.vector.extract.nxv6f16.nxv12f16(<vscale x 12 x half> %in, i64 0)
464 ret <vscale x 6 x half> %res
467 define <vscale x 6 x half> @extract_nxv6f16_nxv12f16_6(<vscale x 12 x half> %in) {
468 ; CHECK-LABEL: extract_nxv6f16_nxv12f16_6:
470 ; CHECK-NEXT: csrr a0, vlenb
471 ; CHECK-NEXT: srli a0, a0, 2
472 ; CHECK-NEXT: vsetvli a1, zero, e16, m1, ta, ma
473 ; CHECK-NEXT: vslidedown.vx v13, v10, a0
474 ; CHECK-NEXT: vslidedown.vx v12, v9, a0
475 ; CHECK-NEXT: add a1, a0, a0
476 ; CHECK-NEXT: vsetvli zero, a1, e16, m1, ta, ma
477 ; CHECK-NEXT: vslideup.vx v12, v10, a0
478 ; CHECK-NEXT: vmv2r.v v8, v12
480 %res = call <vscale x 6 x half> @llvm.vector.extract.nxv6f16.nxv12f16(<vscale x 12 x half> %in, i64 6)
481 ret <vscale x 6 x half> %res
484 define <vscale x 2 x bfloat> @extract_nxv2bf16_nxv16bf16_0(<vscale x 16 x bfloat> %vec) {
485 ; CHECK-LABEL: extract_nxv2bf16_nxv16bf16_0:
488 %c = call <vscale x 2 x bfloat> @llvm.vector.extract.nxv2bf16.nxv16bf16(<vscale x 16 x bfloat> %vec, i64 0)
489 ret <vscale x 2 x bfloat> %c
492 define <vscale x 2 x bfloat> @extract_nxv2bf16_nxv16bf16_2(<vscale x 16 x bfloat> %vec) {
493 ; CHECK-LABEL: extract_nxv2bf16_nxv16bf16_2:
495 ; CHECK-NEXT: csrr a0, vlenb
496 ; CHECK-NEXT: srli a0, a0, 2
497 ; CHECK-NEXT: vsetvli a1, zero, e16, m1, ta, ma
498 ; CHECK-NEXT: vslidedown.vx v8, v8, a0
500 %c = call <vscale x 2 x bfloat> @llvm.vector.extract.nxv2bf16.nxv16bf16(<vscale x 16 x bfloat> %vec, i64 2)
501 ret <vscale x 2 x bfloat> %c
504 define <vscale x 2 x bfloat> @extract_nxv2bf16_nxv16bf16_4(<vscale x 16 x bfloat> %vec) {
505 ; CHECK-LABEL: extract_nxv2bf16_nxv16bf16_4:
507 ; CHECK-NEXT: vmv1r.v v8, v9
509 %c = call <vscale x 2 x bfloat> @llvm.vector.extract.nxv2bf16.nxv16bf16(<vscale x 16 x bfloat> %vec, i64 4)
510 ret <vscale x 2 x bfloat> %c
513 define <vscale x 6 x bfloat> @extract_nxv6bf16_nxv12bf16_0(<vscale x 12 x bfloat> %in) {
514 ; CHECK-LABEL: extract_nxv6bf16_nxv12bf16_0:
517 %res = call <vscale x 6 x bfloat> @llvm.vector.extract.nxv6bf16.nxv12bf16(<vscale x 12 x bfloat> %in, i64 0)
518 ret <vscale x 6 x bfloat> %res
521 define <vscale x 6 x bfloat> @extract_nxv6bf16_nxv12bf16_6(<vscale x 12 x bfloat> %in) {
522 ; CHECK-LABEL: extract_nxv6bf16_nxv12bf16_6:
524 ; CHECK-NEXT: csrr a0, vlenb
525 ; CHECK-NEXT: srli a0, a0, 2
526 ; CHECK-NEXT: vsetvli a1, zero, e16, m1, ta, ma
527 ; CHECK-NEXT: vslidedown.vx v13, v10, a0
528 ; CHECK-NEXT: vslidedown.vx v12, v9, a0
529 ; CHECK-NEXT: add a1, a0, a0
530 ; CHECK-NEXT: vsetvli zero, a1, e16, m1, ta, ma
531 ; CHECK-NEXT: vslideup.vx v12, v10, a0
532 ; CHECK-NEXT: vmv2r.v v8, v12
534 %res = call <vscale x 6 x bfloat> @llvm.vector.extract.nxv6bf16.nxv12bf16(<vscale x 12 x bfloat> %in, i64 6)
535 ret <vscale x 6 x bfloat> %res
538 declare <vscale x 6 x half> @llvm.vector.extract.nxv6f16.nxv12f16(<vscale x 12 x half>, i64)
540 declare <vscale x 1 x i8> @llvm.vector.extract.nxv1i8.nxv4i8(<vscale x 4 x i8> %vec, i64 %idx)
541 declare <vscale x 1 x i8> @llvm.vector.extract.nxv1i8.nxv8i8(<vscale x 8 x i8> %vec, i64 %idx)
543 declare <vscale x 2 x i8> @llvm.vector.extract.nxv2i8.nxv32i8(<vscale x 32 x i8> %vec, i64 %idx)
545 declare <vscale x 1 x i32> @llvm.vector.extract.nxv1i32.nxv2i32(<vscale x 2 x i32> %vec, i64 %idx)
547 declare <vscale x 2 x i32> @llvm.vector.extract.nxv2i32.nxv8i32(<vscale x 8 x i32> %vec, i64 %idx)
548 declare <vscale x 4 x i32> @llvm.vector.extract.nxv4i32.nxv8i32(<vscale x 8 x i32> %vec, i64 %idx)
550 declare <vscale x 1 x i32> @llvm.vector.extract.nxv1i32.nxv16i32(<vscale x 16 x i32> %vec, i64 %idx)
551 declare <vscale x 2 x i32> @llvm.vector.extract.nxv2i32.nxv16i32(<vscale x 16 x i32> %vec, i64 %idx)
552 declare <vscale x 4 x i32> @llvm.vector.extract.nxv4i32.nxv16i32(<vscale x 16 x i32> %vec, i64 %idx)
553 declare <vscale x 8 x i32> @llvm.vector.extract.nxv8i32.nxv16i32(<vscale x 16 x i32> %vec, i64 %idx)
555 declare <vscale x 2 x half> @llvm.vector.extract.nxv2f16.nxv16f16(<vscale x 16 x half> %vec, i64 %idx)
557 declare <vscale x 4 x i1> @llvm.vector.extract.nxv4i1(<vscale x 32 x i1> %vec, i64 %idx)
558 declare <vscale x 16 x i1> @llvm.vector.extract.nxv16i1(<vscale x 32 x i1> %vec, i64 %idx)
560 declare <vscale x 2 x i1> @llvm.vector.extract.nxv2i1(<vscale x 64 x i1> %vec, i64 %idx)
561 declare <vscale x 8 x i1> @llvm.vector.extract.nxv8i1(<vscale x 64 x i1> %vec, i64 %idx)