1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=riscv32 -mattr=+d,+zfh,+zfbfmin,+zvfh,+zvfbfmin,+v -target-abi=ilp32d \
3 ; RUN: -verify-machineinstrs < %s | FileCheck %s --check-prefixes=CHECK,ZVFH
4 ; RUN: llc -mtriple=riscv64 -mattr=+d,+zfh,+zfbfmin,+zvfh,+zvfbfmin,+v -target-abi=lp64d \
5 ; RUN: -verify-machineinstrs < %s | FileCheck %s --check-prefixes=CHECK,ZVFH
6 ; RUN: llc -mtriple=riscv32 -mattr=+d,+zfh,+zfbfmin,+zvfhmin,+zvfbfmin,+v -target-abi=ilp32d \
7 ; RUN: -verify-machineinstrs < %s | FileCheck %s --check-prefixes=CHECK,ZVFHMIN
8 ; RUN: llc -mtriple=riscv64 -mattr=+d,+zfh,+zfbfmin,+zvfhmin,+zvfbfmin,+v -target-abi=lp64d \
9 ; RUN: -verify-machineinstrs < %s | FileCheck %s --check-prefixes=CHECK,ZVFHMIN
11 define <vscale x 1 x bfloat> @insertelt_nxv1bf16_0(<vscale x 1 x bfloat> %v, bfloat %elt) {
12 ; CHECK-LABEL: insertelt_nxv1bf16_0:
14 ; CHECK-NEXT: fmv.x.h a0, fa0
15 ; CHECK-NEXT: vsetvli a1, zero, e16, m1, tu, ma
16 ; CHECK-NEXT: vmv.s.x v8, a0
18 %r = insertelement <vscale x 1 x bfloat> %v, bfloat %elt, i32 0
19 ret <vscale x 1 x bfloat> %r
22 define <vscale x 1 x bfloat> @insertelt_nxv1bf16_imm(<vscale x 1 x bfloat> %v, bfloat %elt) {
23 ; CHECK-LABEL: insertelt_nxv1bf16_imm:
25 ; CHECK-NEXT: fmv.x.h a0, fa0
26 ; CHECK-NEXT: vsetivli zero, 4, e16, mf4, tu, ma
27 ; CHECK-NEXT: vmv.s.x v9, a0
28 ; CHECK-NEXT: vslideup.vi v8, v9, 3
30 %r = insertelement <vscale x 1 x bfloat> %v, bfloat %elt, i32 3
31 ret <vscale x 1 x bfloat> %r
34 define <vscale x 1 x bfloat> @insertelt_nxv1bf16_idx(<vscale x 1 x bfloat> %v, bfloat %elt, i32 zeroext %idx) {
35 ; CHECK-LABEL: insertelt_nxv1bf16_idx:
37 ; CHECK-NEXT: addi a1, a0, 1
38 ; CHECK-NEXT: fmv.x.h a2, fa0
39 ; CHECK-NEXT: vsetvli a3, zero, e16, m1, ta, ma
40 ; CHECK-NEXT: vmv.s.x v9, a2
41 ; CHECK-NEXT: vsetvli zero, a1, e16, mf4, tu, ma
42 ; CHECK-NEXT: vslideup.vx v8, v9, a0
44 %r = insertelement <vscale x 1 x bfloat> %v, bfloat %elt, i32 %idx
45 ret <vscale x 1 x bfloat> %r
48 define <vscale x 2 x bfloat> @insertelt_nxv2bf16_0(<vscale x 2 x bfloat> %v, bfloat %elt) {
49 ; CHECK-LABEL: insertelt_nxv2bf16_0:
51 ; CHECK-NEXT: fmv.x.h a0, fa0
52 ; CHECK-NEXT: vsetvli a1, zero, e16, m1, tu, ma
53 ; CHECK-NEXT: vmv.s.x v8, a0
55 %r = insertelement <vscale x 2 x bfloat> %v, bfloat %elt, i32 0
56 ret <vscale x 2 x bfloat> %r
59 define <vscale x 2 x bfloat> @insertelt_nxv2bf16_imm(<vscale x 2 x bfloat> %v, bfloat %elt) {
60 ; CHECK-LABEL: insertelt_nxv2bf16_imm:
62 ; CHECK-NEXT: fmv.x.h a0, fa0
63 ; CHECK-NEXT: vsetivli zero, 4, e16, mf2, tu, ma
64 ; CHECK-NEXT: vmv.s.x v9, a0
65 ; CHECK-NEXT: vslideup.vi v8, v9, 3
67 %r = insertelement <vscale x 2 x bfloat> %v, bfloat %elt, i32 3
68 ret <vscale x 2 x bfloat> %r
71 define <vscale x 2 x bfloat> @insertelt_nxv2bf16_idx(<vscale x 2 x bfloat> %v, bfloat %elt, i32 zeroext %idx) {
72 ; CHECK-LABEL: insertelt_nxv2bf16_idx:
74 ; CHECK-NEXT: addi a1, a0, 1
75 ; CHECK-NEXT: fmv.x.h a2, fa0
76 ; CHECK-NEXT: vsetvli a3, zero, e16, m1, ta, ma
77 ; CHECK-NEXT: vmv.s.x v9, a2
78 ; CHECK-NEXT: vsetvli zero, a1, e16, mf2, tu, ma
79 ; CHECK-NEXT: vslideup.vx v8, v9, a0
81 %r = insertelement <vscale x 2 x bfloat> %v, bfloat %elt, i32 %idx
82 ret <vscale x 2 x bfloat> %r
85 define <vscale x 4 x bfloat> @insertelt_nxv4bf16_0(<vscale x 4 x bfloat> %v, bfloat %elt) {
86 ; CHECK-LABEL: insertelt_nxv4bf16_0:
88 ; CHECK-NEXT: fmv.x.h a0, fa0
89 ; CHECK-NEXT: vsetvli a1, zero, e16, m1, tu, ma
90 ; CHECK-NEXT: vmv.s.x v8, a0
92 %r = insertelement <vscale x 4 x bfloat> %v, bfloat %elt, i32 0
93 ret <vscale x 4 x bfloat> %r
96 define <vscale x 4 x bfloat> @insertelt_nxv4bf16_imm(<vscale x 4 x bfloat> %v, bfloat %elt) {
97 ; CHECK-LABEL: insertelt_nxv4bf16_imm:
99 ; CHECK-NEXT: fmv.x.h a0, fa0
100 ; CHECK-NEXT: vsetivli zero, 4, e16, m1, tu, ma
101 ; CHECK-NEXT: vmv.s.x v9, a0
102 ; CHECK-NEXT: vslideup.vi v8, v9, 3
104 %r = insertelement <vscale x 4 x bfloat> %v, bfloat %elt, i32 3
105 ret <vscale x 4 x bfloat> %r
108 define <vscale x 4 x bfloat> @insertelt_nxv4bf16_idx(<vscale x 4 x bfloat> %v, bfloat %elt, i32 zeroext %idx) {
109 ; CHECK-LABEL: insertelt_nxv4bf16_idx:
111 ; CHECK-NEXT: addi a1, a0, 1
112 ; CHECK-NEXT: fmv.x.h a2, fa0
113 ; CHECK-NEXT: vsetvli a3, zero, e16, m1, ta, ma
114 ; CHECK-NEXT: vmv.s.x v9, a2
115 ; CHECK-NEXT: vsetvli zero, a1, e16, m1, tu, ma
116 ; CHECK-NEXT: vslideup.vx v8, v9, a0
118 %r = insertelement <vscale x 4 x bfloat> %v, bfloat %elt, i32 %idx
119 ret <vscale x 4 x bfloat> %r
122 define <vscale x 8 x bfloat> @insertelt_nxv8bf16_0(<vscale x 8 x bfloat> %v, bfloat %elt) {
123 ; CHECK-LABEL: insertelt_nxv8bf16_0:
125 ; CHECK-NEXT: fmv.x.h a0, fa0
126 ; CHECK-NEXT: vsetvli a1, zero, e16, m1, tu, ma
127 ; CHECK-NEXT: vmv.s.x v8, a0
129 %r = insertelement <vscale x 8 x bfloat> %v, bfloat %elt, i32 0
130 ret <vscale x 8 x bfloat> %r
133 define <vscale x 8 x bfloat> @insertelt_nxv8bf16_imm(<vscale x 8 x bfloat> %v, bfloat %elt) {
134 ; CHECK-LABEL: insertelt_nxv8bf16_imm:
136 ; CHECK-NEXT: fmv.x.h a0, fa0
137 ; CHECK-NEXT: vsetivli zero, 4, e16, m1, tu, ma
138 ; CHECK-NEXT: vmv.s.x v10, a0
139 ; CHECK-NEXT: vslideup.vi v8, v10, 3
141 %r = insertelement <vscale x 8 x bfloat> %v, bfloat %elt, i32 3
142 ret <vscale x 8 x bfloat> %r
145 define <vscale x 8 x bfloat> @insertelt_nxv8bf16_idx(<vscale x 8 x bfloat> %v, bfloat %elt, i32 zeroext %idx) {
146 ; CHECK-LABEL: insertelt_nxv8bf16_idx:
148 ; CHECK-NEXT: fmv.x.h a1, fa0
149 ; CHECK-NEXT: vsetvli a2, zero, e16, m1, ta, ma
150 ; CHECK-NEXT: vmv.s.x v10, a1
151 ; CHECK-NEXT: addi a1, a0, 1
152 ; CHECK-NEXT: vsetvli zero, a1, e16, m2, tu, ma
153 ; CHECK-NEXT: vslideup.vx v8, v10, a0
155 %r = insertelement <vscale x 8 x bfloat> %v, bfloat %elt, i32 %idx
156 ret <vscale x 8 x bfloat> %r
159 define <vscale x 16 x bfloat> @insertelt_nxv16bf16_0(<vscale x 16 x bfloat> %v, bfloat %elt) {
160 ; CHECK-LABEL: insertelt_nxv16bf16_0:
162 ; CHECK-NEXT: fmv.x.h a0, fa0
163 ; CHECK-NEXT: vsetvli a1, zero, e16, m1, tu, ma
164 ; CHECK-NEXT: vmv.s.x v8, a0
166 %r = insertelement <vscale x 16 x bfloat> %v, bfloat %elt, i32 0
167 ret <vscale x 16 x bfloat> %r
170 define <vscale x 16 x bfloat> @insertelt_nxv16bf16_imm(<vscale x 16 x bfloat> %v, bfloat %elt) {
171 ; CHECK-LABEL: insertelt_nxv16bf16_imm:
173 ; CHECK-NEXT: fmv.x.h a0, fa0
174 ; CHECK-NEXT: vsetivli zero, 4, e16, m1, tu, ma
175 ; CHECK-NEXT: vmv.s.x v12, a0
176 ; CHECK-NEXT: vslideup.vi v8, v12, 3
178 %r = insertelement <vscale x 16 x bfloat> %v, bfloat %elt, i32 3
179 ret <vscale x 16 x bfloat> %r
182 define <vscale x 16 x bfloat> @insertelt_nxv16bf16_idx(<vscale x 16 x bfloat> %v, bfloat %elt, i32 zeroext %idx) {
183 ; CHECK-LABEL: insertelt_nxv16bf16_idx:
185 ; CHECK-NEXT: fmv.x.h a1, fa0
186 ; CHECK-NEXT: vsetvli a2, zero, e16, m1, ta, ma
187 ; CHECK-NEXT: vmv.s.x v12, a1
188 ; CHECK-NEXT: addi a1, a0, 1
189 ; CHECK-NEXT: vsetvli zero, a1, e16, m4, tu, ma
190 ; CHECK-NEXT: vslideup.vx v8, v12, a0
192 %r = insertelement <vscale x 16 x bfloat> %v, bfloat %elt, i32 %idx
193 ret <vscale x 16 x bfloat> %r
196 define <vscale x 32 x bfloat> @insertelt_nxv32bf16_0(<vscale x 32 x bfloat> %v, bfloat %elt) {
197 ; CHECK-LABEL: insertelt_nxv32bf16_0:
199 ; CHECK-NEXT: fmv.x.h a0, fa0
200 ; CHECK-NEXT: vsetvli a1, zero, e16, m1, tu, ma
201 ; CHECK-NEXT: vmv.s.x v8, a0
203 %r = insertelement <vscale x 32 x bfloat> %v, bfloat %elt, i32 0
204 ret <vscale x 32 x bfloat> %r
207 define <vscale x 32 x bfloat> @insertelt_nxv32bf16_imm(<vscale x 32 x bfloat> %v, bfloat %elt) {
208 ; CHECK-LABEL: insertelt_nxv32bf16_imm:
210 ; CHECK-NEXT: fmv.x.h a0, fa0
211 ; CHECK-NEXT: vsetivli zero, 4, e16, m1, tu, ma
212 ; CHECK-NEXT: vmv.s.x v16, a0
213 ; CHECK-NEXT: vslideup.vi v8, v16, 3
215 %r = insertelement <vscale x 32 x bfloat> %v, bfloat %elt, i32 3
216 ret <vscale x 32 x bfloat> %r
219 define <vscale x 32 x bfloat> @insertelt_nxv32bf16_idx(<vscale x 32 x bfloat> %v, bfloat %elt, i32 zeroext %idx) {
220 ; CHECK-LABEL: insertelt_nxv32bf16_idx:
222 ; CHECK-NEXT: fmv.x.h a1, fa0
223 ; CHECK-NEXT: vsetvli a2, zero, e16, m1, ta, ma
224 ; CHECK-NEXT: vmv.s.x v16, a1
225 ; CHECK-NEXT: addi a1, a0, 1
226 ; CHECK-NEXT: vsetvli zero, a1, e16, m8, tu, ma
227 ; CHECK-NEXT: vslideup.vx v8, v16, a0
229 %r = insertelement <vscale x 32 x bfloat> %v, bfloat %elt, i32 %idx
230 ret <vscale x 32 x bfloat> %r
233 define <vscale x 1 x half> @insertelt_nxv1f16_0(<vscale x 1 x half> %v, half %elt) {
234 ; ZVFH-LABEL: insertelt_nxv1f16_0:
236 ; ZVFH-NEXT: vsetvli a0, zero, e16, m1, tu, ma
237 ; ZVFH-NEXT: vfmv.s.f v8, fa0
240 ; ZVFHMIN-LABEL: insertelt_nxv1f16_0:
242 ; ZVFHMIN-NEXT: fmv.x.h a0, fa0
243 ; ZVFHMIN-NEXT: vsetvli a1, zero, e16, m1, tu, ma
244 ; ZVFHMIN-NEXT: vmv.s.x v8, a0
246 %r = insertelement <vscale x 1 x half> %v, half %elt, i32 0
247 ret <vscale x 1 x half> %r
250 define <vscale x 1 x half> @insertelt_nxv1f16_imm(<vscale x 1 x half> %v, half %elt) {
251 ; ZVFH-LABEL: insertelt_nxv1f16_imm:
253 ; ZVFH-NEXT: vsetivli zero, 4, e16, mf4, tu, ma
254 ; ZVFH-NEXT: vfmv.s.f v9, fa0
255 ; ZVFH-NEXT: vslideup.vi v8, v9, 3
258 ; ZVFHMIN-LABEL: insertelt_nxv1f16_imm:
260 ; ZVFHMIN-NEXT: fmv.x.h a0, fa0
261 ; ZVFHMIN-NEXT: vsetivli zero, 4, e16, mf4, tu, ma
262 ; ZVFHMIN-NEXT: vmv.s.x v9, a0
263 ; ZVFHMIN-NEXT: vslideup.vi v8, v9, 3
265 %r = insertelement <vscale x 1 x half> %v, half %elt, i32 3
266 ret <vscale x 1 x half> %r
269 define <vscale x 1 x half> @insertelt_nxv1f16_idx(<vscale x 1 x half> %v, half %elt, i32 zeroext %idx) {
270 ; ZVFH-LABEL: insertelt_nxv1f16_idx:
272 ; ZVFH-NEXT: addi a1, a0, 1
273 ; ZVFH-NEXT: vsetvli a2, zero, e16, m1, ta, ma
274 ; ZVFH-NEXT: vfmv.s.f v9, fa0
275 ; ZVFH-NEXT: vsetvli zero, a1, e16, mf4, tu, ma
276 ; ZVFH-NEXT: vslideup.vx v8, v9, a0
279 ; ZVFHMIN-LABEL: insertelt_nxv1f16_idx:
281 ; ZVFHMIN-NEXT: addi a1, a0, 1
282 ; ZVFHMIN-NEXT: fmv.x.h a2, fa0
283 ; ZVFHMIN-NEXT: vsetvli a3, zero, e16, m1, ta, ma
284 ; ZVFHMIN-NEXT: vmv.s.x v9, a2
285 ; ZVFHMIN-NEXT: vsetvli zero, a1, e16, mf4, tu, ma
286 ; ZVFHMIN-NEXT: vslideup.vx v8, v9, a0
288 %r = insertelement <vscale x 1 x half> %v, half %elt, i32 %idx
289 ret <vscale x 1 x half> %r
292 define <vscale x 2 x half> @insertelt_nxv2f16_0(<vscale x 2 x half> %v, half %elt) {
293 ; ZVFH-LABEL: insertelt_nxv2f16_0:
295 ; ZVFH-NEXT: vsetvli a0, zero, e16, m1, tu, ma
296 ; ZVFH-NEXT: vfmv.s.f v8, fa0
299 ; ZVFHMIN-LABEL: insertelt_nxv2f16_0:
301 ; ZVFHMIN-NEXT: fmv.x.h a0, fa0
302 ; ZVFHMIN-NEXT: vsetvli a1, zero, e16, m1, tu, ma
303 ; ZVFHMIN-NEXT: vmv.s.x v8, a0
305 %r = insertelement <vscale x 2 x half> %v, half %elt, i32 0
306 ret <vscale x 2 x half> %r
309 define <vscale x 2 x half> @insertelt_nxv2f16_imm(<vscale x 2 x half> %v, half %elt) {
310 ; ZVFH-LABEL: insertelt_nxv2f16_imm:
312 ; ZVFH-NEXT: vsetivli zero, 4, e16, mf2, tu, ma
313 ; ZVFH-NEXT: vfmv.s.f v9, fa0
314 ; ZVFH-NEXT: vslideup.vi v8, v9, 3
317 ; ZVFHMIN-LABEL: insertelt_nxv2f16_imm:
319 ; ZVFHMIN-NEXT: fmv.x.h a0, fa0
320 ; ZVFHMIN-NEXT: vsetivli zero, 4, e16, mf2, tu, ma
321 ; ZVFHMIN-NEXT: vmv.s.x v9, a0
322 ; ZVFHMIN-NEXT: vslideup.vi v8, v9, 3
324 %r = insertelement <vscale x 2 x half> %v, half %elt, i32 3
325 ret <vscale x 2 x half> %r
328 define <vscale x 2 x half> @insertelt_nxv2f16_idx(<vscale x 2 x half> %v, half %elt, i32 zeroext %idx) {
329 ; ZVFH-LABEL: insertelt_nxv2f16_idx:
331 ; ZVFH-NEXT: addi a1, a0, 1
332 ; ZVFH-NEXT: vsetvli a2, zero, e16, m1, ta, ma
333 ; ZVFH-NEXT: vfmv.s.f v9, fa0
334 ; ZVFH-NEXT: vsetvli zero, a1, e16, mf2, tu, ma
335 ; ZVFH-NEXT: vslideup.vx v8, v9, a0
338 ; ZVFHMIN-LABEL: insertelt_nxv2f16_idx:
340 ; ZVFHMIN-NEXT: addi a1, a0, 1
341 ; ZVFHMIN-NEXT: fmv.x.h a2, fa0
342 ; ZVFHMIN-NEXT: vsetvli a3, zero, e16, m1, ta, ma
343 ; ZVFHMIN-NEXT: vmv.s.x v9, a2
344 ; ZVFHMIN-NEXT: vsetvli zero, a1, e16, mf2, tu, ma
345 ; ZVFHMIN-NEXT: vslideup.vx v8, v9, a0
347 %r = insertelement <vscale x 2 x half> %v, half %elt, i32 %idx
348 ret <vscale x 2 x half> %r
351 define <vscale x 4 x half> @insertelt_nxv4f16_0(<vscale x 4 x half> %v, half %elt) {
352 ; ZVFH-LABEL: insertelt_nxv4f16_0:
354 ; ZVFH-NEXT: vsetvli a0, zero, e16, m1, tu, ma
355 ; ZVFH-NEXT: vfmv.s.f v8, fa0
358 ; ZVFHMIN-LABEL: insertelt_nxv4f16_0:
360 ; ZVFHMIN-NEXT: fmv.x.h a0, fa0
361 ; ZVFHMIN-NEXT: vsetvli a1, zero, e16, m1, tu, ma
362 ; ZVFHMIN-NEXT: vmv.s.x v8, a0
364 %r = insertelement <vscale x 4 x half> %v, half %elt, i32 0
365 ret <vscale x 4 x half> %r
368 define <vscale x 4 x half> @insertelt_nxv4f16_imm(<vscale x 4 x half> %v, half %elt) {
369 ; ZVFH-LABEL: insertelt_nxv4f16_imm:
371 ; ZVFH-NEXT: vsetivli zero, 4, e16, m1, tu, ma
372 ; ZVFH-NEXT: vfmv.s.f v9, fa0
373 ; ZVFH-NEXT: vslideup.vi v8, v9, 3
376 ; ZVFHMIN-LABEL: insertelt_nxv4f16_imm:
378 ; ZVFHMIN-NEXT: fmv.x.h a0, fa0
379 ; ZVFHMIN-NEXT: vsetivli zero, 4, e16, m1, tu, ma
380 ; ZVFHMIN-NEXT: vmv.s.x v9, a0
381 ; ZVFHMIN-NEXT: vslideup.vi v8, v9, 3
383 %r = insertelement <vscale x 4 x half> %v, half %elt, i32 3
384 ret <vscale x 4 x half> %r
387 define <vscale x 4 x half> @insertelt_nxv4f16_idx(<vscale x 4 x half> %v, half %elt, i32 zeroext %idx) {
388 ; ZVFH-LABEL: insertelt_nxv4f16_idx:
390 ; ZVFH-NEXT: addi a1, a0, 1
391 ; ZVFH-NEXT: vsetvli a2, zero, e16, m1, ta, ma
392 ; ZVFH-NEXT: vfmv.s.f v9, fa0
393 ; ZVFH-NEXT: vsetvli zero, a1, e16, m1, tu, ma
394 ; ZVFH-NEXT: vslideup.vx v8, v9, a0
397 ; ZVFHMIN-LABEL: insertelt_nxv4f16_idx:
399 ; ZVFHMIN-NEXT: addi a1, a0, 1
400 ; ZVFHMIN-NEXT: fmv.x.h a2, fa0
401 ; ZVFHMIN-NEXT: vsetvli a3, zero, e16, m1, ta, ma
402 ; ZVFHMIN-NEXT: vmv.s.x v9, a2
403 ; ZVFHMIN-NEXT: vsetvli zero, a1, e16, m1, tu, ma
404 ; ZVFHMIN-NEXT: vslideup.vx v8, v9, a0
406 %r = insertelement <vscale x 4 x half> %v, half %elt, i32 %idx
407 ret <vscale x 4 x half> %r
410 define <vscale x 8 x half> @insertelt_nxv8f16_0(<vscale x 8 x half> %v, half %elt) {
411 ; ZVFH-LABEL: insertelt_nxv8f16_0:
413 ; ZVFH-NEXT: vsetvli a0, zero, e16, m1, tu, ma
414 ; ZVFH-NEXT: vfmv.s.f v8, fa0
417 ; ZVFHMIN-LABEL: insertelt_nxv8f16_0:
419 ; ZVFHMIN-NEXT: fmv.x.h a0, fa0
420 ; ZVFHMIN-NEXT: vsetvli a1, zero, e16, m1, tu, ma
421 ; ZVFHMIN-NEXT: vmv.s.x v8, a0
423 %r = insertelement <vscale x 8 x half> %v, half %elt, i32 0
424 ret <vscale x 8 x half> %r
427 define <vscale x 8 x half> @insertelt_nxv8f16_imm(<vscale x 8 x half> %v, half %elt) {
428 ; ZVFH-LABEL: insertelt_nxv8f16_imm:
430 ; ZVFH-NEXT: vsetivli zero, 4, e16, m1, tu, ma
431 ; ZVFH-NEXT: vfmv.s.f v10, fa0
432 ; ZVFH-NEXT: vslideup.vi v8, v10, 3
435 ; ZVFHMIN-LABEL: insertelt_nxv8f16_imm:
437 ; ZVFHMIN-NEXT: fmv.x.h a0, fa0
438 ; ZVFHMIN-NEXT: vsetivli zero, 4, e16, m1, tu, ma
439 ; ZVFHMIN-NEXT: vmv.s.x v10, a0
440 ; ZVFHMIN-NEXT: vslideup.vi v8, v10, 3
442 %r = insertelement <vscale x 8 x half> %v, half %elt, i32 3
443 ret <vscale x 8 x half> %r
446 define <vscale x 8 x half> @insertelt_nxv8f16_idx(<vscale x 8 x half> %v, half %elt, i32 zeroext %idx) {
447 ; ZVFH-LABEL: insertelt_nxv8f16_idx:
449 ; ZVFH-NEXT: vsetvli a1, zero, e16, m1, ta, ma
450 ; ZVFH-NEXT: vfmv.s.f v10, fa0
451 ; ZVFH-NEXT: addi a1, a0, 1
452 ; ZVFH-NEXT: vsetvli zero, a1, e16, m2, tu, ma
453 ; ZVFH-NEXT: vslideup.vx v8, v10, a0
456 ; ZVFHMIN-LABEL: insertelt_nxv8f16_idx:
458 ; ZVFHMIN-NEXT: fmv.x.h a1, fa0
459 ; ZVFHMIN-NEXT: vsetvli a2, zero, e16, m1, ta, ma
460 ; ZVFHMIN-NEXT: vmv.s.x v10, a1
461 ; ZVFHMIN-NEXT: addi a1, a0, 1
462 ; ZVFHMIN-NEXT: vsetvli zero, a1, e16, m2, tu, ma
463 ; ZVFHMIN-NEXT: vslideup.vx v8, v10, a0
465 %r = insertelement <vscale x 8 x half> %v, half %elt, i32 %idx
466 ret <vscale x 8 x half> %r
469 define <vscale x 16 x half> @insertelt_nxv16f16_0(<vscale x 16 x half> %v, half %elt) {
470 ; ZVFH-LABEL: insertelt_nxv16f16_0:
472 ; ZVFH-NEXT: vsetvli a0, zero, e16, m1, tu, ma
473 ; ZVFH-NEXT: vfmv.s.f v8, fa0
476 ; ZVFHMIN-LABEL: insertelt_nxv16f16_0:
478 ; ZVFHMIN-NEXT: fmv.x.h a0, fa0
479 ; ZVFHMIN-NEXT: vsetvli a1, zero, e16, m1, tu, ma
480 ; ZVFHMIN-NEXT: vmv.s.x v8, a0
482 %r = insertelement <vscale x 16 x half> %v, half %elt, i32 0
483 ret <vscale x 16 x half> %r
486 define <vscale x 16 x half> @insertelt_nxv16f16_imm(<vscale x 16 x half> %v, half %elt) {
487 ; ZVFH-LABEL: insertelt_nxv16f16_imm:
489 ; ZVFH-NEXT: vsetivli zero, 4, e16, m1, tu, ma
490 ; ZVFH-NEXT: vfmv.s.f v12, fa0
491 ; ZVFH-NEXT: vslideup.vi v8, v12, 3
494 ; ZVFHMIN-LABEL: insertelt_nxv16f16_imm:
496 ; ZVFHMIN-NEXT: fmv.x.h a0, fa0
497 ; ZVFHMIN-NEXT: vsetivli zero, 4, e16, m1, tu, ma
498 ; ZVFHMIN-NEXT: vmv.s.x v12, a0
499 ; ZVFHMIN-NEXT: vslideup.vi v8, v12, 3
501 %r = insertelement <vscale x 16 x half> %v, half %elt, i32 3
502 ret <vscale x 16 x half> %r
505 define <vscale x 16 x half> @insertelt_nxv16f16_idx(<vscale x 16 x half> %v, half %elt, i32 zeroext %idx) {
506 ; ZVFH-LABEL: insertelt_nxv16f16_idx:
508 ; ZVFH-NEXT: vsetvli a1, zero, e16, m1, ta, ma
509 ; ZVFH-NEXT: vfmv.s.f v12, fa0
510 ; ZVFH-NEXT: addi a1, a0, 1
511 ; ZVFH-NEXT: vsetvli zero, a1, e16, m4, tu, ma
512 ; ZVFH-NEXT: vslideup.vx v8, v12, a0
515 ; ZVFHMIN-LABEL: insertelt_nxv16f16_idx:
517 ; ZVFHMIN-NEXT: fmv.x.h a1, fa0
518 ; ZVFHMIN-NEXT: vsetvli a2, zero, e16, m1, ta, ma
519 ; ZVFHMIN-NEXT: vmv.s.x v12, a1
520 ; ZVFHMIN-NEXT: addi a1, a0, 1
521 ; ZVFHMIN-NEXT: vsetvli zero, a1, e16, m4, tu, ma
522 ; ZVFHMIN-NEXT: vslideup.vx v8, v12, a0
524 %r = insertelement <vscale x 16 x half> %v, half %elt, i32 %idx
525 ret <vscale x 16 x half> %r
528 define <vscale x 32 x half> @insertelt_nxv32f16_0(<vscale x 32 x half> %v, half %elt) {
529 ; ZVFH-LABEL: insertelt_nxv32f16_0:
531 ; ZVFH-NEXT: vsetvli a0, zero, e16, m1, tu, ma
532 ; ZVFH-NEXT: vfmv.s.f v8, fa0
535 ; ZVFHMIN-LABEL: insertelt_nxv32f16_0:
537 ; ZVFHMIN-NEXT: fmv.x.h a0, fa0
538 ; ZVFHMIN-NEXT: vsetvli a1, zero, e16, m1, tu, ma
539 ; ZVFHMIN-NEXT: vmv.s.x v8, a0
541 %r = insertelement <vscale x 32 x half> %v, half %elt, i32 0
542 ret <vscale x 32 x half> %r
545 define <vscale x 32 x half> @insertelt_nxv32f16_imm(<vscale x 32 x half> %v, half %elt) {
546 ; ZVFH-LABEL: insertelt_nxv32f16_imm:
548 ; ZVFH-NEXT: vsetivli zero, 4, e16, m1, tu, ma
549 ; ZVFH-NEXT: vfmv.s.f v16, fa0
550 ; ZVFH-NEXT: vslideup.vi v8, v16, 3
553 ; ZVFHMIN-LABEL: insertelt_nxv32f16_imm:
555 ; ZVFHMIN-NEXT: fmv.x.h a0, fa0
556 ; ZVFHMIN-NEXT: vsetivli zero, 4, e16, m1, tu, ma
557 ; ZVFHMIN-NEXT: vmv.s.x v16, a0
558 ; ZVFHMIN-NEXT: vslideup.vi v8, v16, 3
560 %r = insertelement <vscale x 32 x half> %v, half %elt, i32 3
561 ret <vscale x 32 x half> %r
564 define <vscale x 32 x half> @insertelt_nxv32f16_idx(<vscale x 32 x half> %v, half %elt, i32 zeroext %idx) {
565 ; ZVFH-LABEL: insertelt_nxv32f16_idx:
567 ; ZVFH-NEXT: vsetvli a1, zero, e16, m1, ta, ma
568 ; ZVFH-NEXT: vfmv.s.f v16, fa0
569 ; ZVFH-NEXT: addi a1, a0, 1
570 ; ZVFH-NEXT: vsetvli zero, a1, e16, m8, tu, ma
571 ; ZVFH-NEXT: vslideup.vx v8, v16, a0
574 ; ZVFHMIN-LABEL: insertelt_nxv32f16_idx:
576 ; ZVFHMIN-NEXT: fmv.x.h a1, fa0
577 ; ZVFHMIN-NEXT: vsetvli a2, zero, e16, m1, ta, ma
578 ; ZVFHMIN-NEXT: vmv.s.x v16, a1
579 ; ZVFHMIN-NEXT: addi a1, a0, 1
580 ; ZVFHMIN-NEXT: vsetvli zero, a1, e16, m8, tu, ma
581 ; ZVFHMIN-NEXT: vslideup.vx v8, v16, a0
583 %r = insertelement <vscale x 32 x half> %v, half %elt, i32 %idx
584 ret <vscale x 32 x half> %r
587 define <vscale x 1 x float> @insertelt_nxv1f32_0(<vscale x 1 x float> %v, float %elt) {
588 ; CHECK-LABEL: insertelt_nxv1f32_0:
590 ; CHECK-NEXT: vsetvli a0, zero, e32, m1, tu, ma
591 ; CHECK-NEXT: vfmv.s.f v8, fa0
593 %r = insertelement <vscale x 1 x float> %v, float %elt, i32 0
594 ret <vscale x 1 x float> %r
597 define <vscale x 1 x float> @insertelt_nxv1f32_imm(<vscale x 1 x float> %v, float %elt) {
598 ; CHECK-LABEL: insertelt_nxv1f32_imm:
600 ; CHECK-NEXT: vsetivli zero, 4, e32, mf2, tu, ma
601 ; CHECK-NEXT: vfmv.s.f v9, fa0
602 ; CHECK-NEXT: vslideup.vi v8, v9, 3
604 %r = insertelement <vscale x 1 x float> %v, float %elt, i32 3
605 ret <vscale x 1 x float> %r
608 define <vscale x 1 x float> @insertelt_nxv1f32_idx(<vscale x 1 x float> %v, float %elt, i32 zeroext %idx) {
609 ; CHECK-LABEL: insertelt_nxv1f32_idx:
611 ; CHECK-NEXT: addi a1, a0, 1
612 ; CHECK-NEXT: vsetvli a2, zero, e32, m1, ta, ma
613 ; CHECK-NEXT: vfmv.s.f v9, fa0
614 ; CHECK-NEXT: vsetvli zero, a1, e32, mf2, tu, ma
615 ; CHECK-NEXT: vslideup.vx v8, v9, a0
617 %r = insertelement <vscale x 1 x float> %v, float %elt, i32 %idx
618 ret <vscale x 1 x float> %r
621 define <vscale x 2 x float> @insertelt_nxv2f32_0(<vscale x 2 x float> %v, float %elt) {
622 ; CHECK-LABEL: insertelt_nxv2f32_0:
624 ; CHECK-NEXT: vsetvli a0, zero, e32, m1, tu, ma
625 ; CHECK-NEXT: vfmv.s.f v8, fa0
627 %r = insertelement <vscale x 2 x float> %v, float %elt, i32 0
628 ret <vscale x 2 x float> %r
631 define <vscale x 2 x float> @insertelt_nxv2f32_imm(<vscale x 2 x float> %v, float %elt) {
632 ; CHECK-LABEL: insertelt_nxv2f32_imm:
634 ; CHECK-NEXT: vsetivli zero, 4, e32, m1, tu, ma
635 ; CHECK-NEXT: vfmv.s.f v9, fa0
636 ; CHECK-NEXT: vslideup.vi v8, v9, 3
638 %r = insertelement <vscale x 2 x float> %v, float %elt, i32 3
639 ret <vscale x 2 x float> %r
642 define <vscale x 2 x float> @insertelt_nxv2f32_idx(<vscale x 2 x float> %v, float %elt, i32 zeroext %idx) {
643 ; CHECK-LABEL: insertelt_nxv2f32_idx:
645 ; CHECK-NEXT: addi a1, a0, 1
646 ; CHECK-NEXT: vsetvli a2, zero, e32, m1, ta, ma
647 ; CHECK-NEXT: vfmv.s.f v9, fa0
648 ; CHECK-NEXT: vsetvli zero, a1, e32, m1, tu, ma
649 ; CHECK-NEXT: vslideup.vx v8, v9, a0
651 %r = insertelement <vscale x 2 x float> %v, float %elt, i32 %idx
652 ret <vscale x 2 x float> %r
655 define <vscale x 4 x float> @insertelt_nxv4f32_0(<vscale x 4 x float> %v, float %elt) {
656 ; CHECK-LABEL: insertelt_nxv4f32_0:
658 ; CHECK-NEXT: vsetvli a0, zero, e32, m1, tu, ma
659 ; CHECK-NEXT: vfmv.s.f v8, fa0
661 %r = insertelement <vscale x 4 x float> %v, float %elt, i32 0
662 ret <vscale x 4 x float> %r
665 define <vscale x 4 x float> @insertelt_nxv4f32_imm(<vscale x 4 x float> %v, float %elt) {
666 ; CHECK-LABEL: insertelt_nxv4f32_imm:
668 ; CHECK-NEXT: vsetivli zero, 4, e32, m1, tu, ma
669 ; CHECK-NEXT: vfmv.s.f v10, fa0
670 ; CHECK-NEXT: vslideup.vi v8, v10, 3
672 %r = insertelement <vscale x 4 x float> %v, float %elt, i32 3
673 ret <vscale x 4 x float> %r
676 define <vscale x 4 x float> @insertelt_nxv4f32_idx(<vscale x 4 x float> %v, float %elt, i32 zeroext %idx) {
677 ; CHECK-LABEL: insertelt_nxv4f32_idx:
679 ; CHECK-NEXT: vsetvli a1, zero, e32, m1, ta, ma
680 ; CHECK-NEXT: vfmv.s.f v10, fa0
681 ; CHECK-NEXT: addi a1, a0, 1
682 ; CHECK-NEXT: vsetvli zero, a1, e32, m2, tu, ma
683 ; CHECK-NEXT: vslideup.vx v8, v10, a0
685 %r = insertelement <vscale x 4 x float> %v, float %elt, i32 %idx
686 ret <vscale x 4 x float> %r
689 define <vscale x 8 x float> @insertelt_nxv8f32_0(<vscale x 8 x float> %v, float %elt) {
690 ; CHECK-LABEL: insertelt_nxv8f32_0:
692 ; CHECK-NEXT: vsetvli a0, zero, e32, m1, tu, ma
693 ; CHECK-NEXT: vfmv.s.f v8, fa0
695 %r = insertelement <vscale x 8 x float> %v, float %elt, i32 0
696 ret <vscale x 8 x float> %r
699 define <vscale x 8 x float> @insertelt_nxv8f32_imm(<vscale x 8 x float> %v, float %elt) {
700 ; CHECK-LABEL: insertelt_nxv8f32_imm:
702 ; CHECK-NEXT: vsetivli zero, 4, e32, m1, tu, ma
703 ; CHECK-NEXT: vfmv.s.f v12, fa0
704 ; CHECK-NEXT: vslideup.vi v8, v12, 3
706 %r = insertelement <vscale x 8 x float> %v, float %elt, i32 3
707 ret <vscale x 8 x float> %r
710 define <vscale x 8 x float> @insertelt_nxv8f32_idx(<vscale x 8 x float> %v, float %elt, i32 zeroext %idx) {
711 ; CHECK-LABEL: insertelt_nxv8f32_idx:
713 ; CHECK-NEXT: vsetvli a1, zero, e32, m1, ta, ma
714 ; CHECK-NEXT: vfmv.s.f v12, fa0
715 ; CHECK-NEXT: addi a1, a0, 1
716 ; CHECK-NEXT: vsetvli zero, a1, e32, m4, tu, ma
717 ; CHECK-NEXT: vslideup.vx v8, v12, a0
719 %r = insertelement <vscale x 8 x float> %v, float %elt, i32 %idx
720 ret <vscale x 8 x float> %r
723 define <vscale x 16 x float> @insertelt_nxv16f32_0(<vscale x 16 x float> %v, float %elt) {
724 ; CHECK-LABEL: insertelt_nxv16f32_0:
726 ; CHECK-NEXT: vsetvli a0, zero, e32, m1, tu, ma
727 ; CHECK-NEXT: vfmv.s.f v8, fa0
729 %r = insertelement <vscale x 16 x float> %v, float %elt, i32 0
730 ret <vscale x 16 x float> %r
733 define <vscale x 16 x float> @insertelt_nxv16f32_imm(<vscale x 16 x float> %v, float %elt) {
734 ; CHECK-LABEL: insertelt_nxv16f32_imm:
736 ; CHECK-NEXT: vsetivli zero, 4, e32, m1, tu, ma
737 ; CHECK-NEXT: vfmv.s.f v16, fa0
738 ; CHECK-NEXT: vslideup.vi v8, v16, 3
740 %r = insertelement <vscale x 16 x float> %v, float %elt, i32 3
741 ret <vscale x 16 x float> %r
744 define <vscale x 16 x float> @insertelt_nxv16f32_idx(<vscale x 16 x float> %v, float %elt, i32 zeroext %idx) {
745 ; CHECK-LABEL: insertelt_nxv16f32_idx:
747 ; CHECK-NEXT: vsetvli a1, zero, e32, m1, ta, ma
748 ; CHECK-NEXT: vfmv.s.f v16, fa0
749 ; CHECK-NEXT: addi a1, a0, 1
750 ; CHECK-NEXT: vsetvli zero, a1, e32, m8, tu, ma
751 ; CHECK-NEXT: vslideup.vx v8, v16, a0
753 %r = insertelement <vscale x 16 x float> %v, float %elt, i32 %idx
754 ret <vscale x 16 x float> %r
757 define <vscale x 1 x double> @insertelt_nxv1f64_0(<vscale x 1 x double> %v, double %elt) {
758 ; CHECK-LABEL: insertelt_nxv1f64_0:
760 ; CHECK-NEXT: vsetvli a0, zero, e64, m1, tu, ma
761 ; CHECK-NEXT: vfmv.s.f v8, fa0
763 %r = insertelement <vscale x 1 x double> %v, double %elt, i32 0
764 ret <vscale x 1 x double> %r
767 define <vscale x 1 x double> @insertelt_nxv1f64_imm(<vscale x 1 x double> %v, double %elt) {
768 ; CHECK-LABEL: insertelt_nxv1f64_imm:
770 ; CHECK-NEXT: vsetivli zero, 4, e64, m1, tu, ma
771 ; CHECK-NEXT: vfmv.s.f v9, fa0
772 ; CHECK-NEXT: vslideup.vi v8, v9, 3
774 %r = insertelement <vscale x 1 x double> %v, double %elt, i32 3
775 ret <vscale x 1 x double> %r
778 define <vscale x 1 x double> @insertelt_nxv1f64_idx(<vscale x 1 x double> %v, double %elt, i32 zeroext %idx) {
779 ; CHECK-LABEL: insertelt_nxv1f64_idx:
781 ; CHECK-NEXT: addi a1, a0, 1
782 ; CHECK-NEXT: vsetvli a2, zero, e64, m1, ta, ma
783 ; CHECK-NEXT: vfmv.s.f v9, fa0
784 ; CHECK-NEXT: vsetvli zero, a1, e64, m1, tu, ma
785 ; CHECK-NEXT: vslideup.vx v8, v9, a0
787 %r = insertelement <vscale x 1 x double> %v, double %elt, i32 %idx
788 ret <vscale x 1 x double> %r
791 define <vscale x 2 x double> @insertelt_nxv2f64_0(<vscale x 2 x double> %v, double %elt) {
792 ; CHECK-LABEL: insertelt_nxv2f64_0:
794 ; CHECK-NEXT: vsetvli a0, zero, e64, m1, tu, ma
795 ; CHECK-NEXT: vfmv.s.f v8, fa0
797 %r = insertelement <vscale x 2 x double> %v, double %elt, i32 0
798 ret <vscale x 2 x double> %r
801 define <vscale x 2 x double> @insertelt_nxv2f64_imm(<vscale x 2 x double> %v, double %elt) {
802 ; CHECK-LABEL: insertelt_nxv2f64_imm:
804 ; CHECK-NEXT: vsetivli zero, 4, e64, m2, tu, ma
805 ; CHECK-NEXT: vfmv.s.f v10, fa0
806 ; CHECK-NEXT: vslideup.vi v8, v10, 3
808 %r = insertelement <vscale x 2 x double> %v, double %elt, i32 3
809 ret <vscale x 2 x double> %r
812 define <vscale x 2 x double> @insertelt_nxv2f64_idx(<vscale x 2 x double> %v, double %elt, i32 zeroext %idx) {
813 ; CHECK-LABEL: insertelt_nxv2f64_idx:
815 ; CHECK-NEXT: vsetvli a1, zero, e64, m1, ta, ma
816 ; CHECK-NEXT: vfmv.s.f v10, fa0
817 ; CHECK-NEXT: addi a1, a0, 1
818 ; CHECK-NEXT: vsetvli zero, a1, e64, m2, tu, ma
819 ; CHECK-NEXT: vslideup.vx v8, v10, a0
821 %r = insertelement <vscale x 2 x double> %v, double %elt, i32 %idx
822 ret <vscale x 2 x double> %r
825 define <vscale x 4 x double> @insertelt_nxv4f64_0(<vscale x 4 x double> %v, double %elt) {
826 ; CHECK-LABEL: insertelt_nxv4f64_0:
828 ; CHECK-NEXT: vsetvli a0, zero, e64, m1, tu, ma
829 ; CHECK-NEXT: vfmv.s.f v8, fa0
831 %r = insertelement <vscale x 4 x double> %v, double %elt, i32 0
832 ret <vscale x 4 x double> %r
835 define <vscale x 4 x double> @insertelt_nxv4f64_imm(<vscale x 4 x double> %v, double %elt) {
836 ; CHECK-LABEL: insertelt_nxv4f64_imm:
838 ; CHECK-NEXT: vsetivli zero, 4, e64, m2, tu, ma
839 ; CHECK-NEXT: vfmv.s.f v12, fa0
840 ; CHECK-NEXT: vslideup.vi v8, v12, 3
842 %r = insertelement <vscale x 4 x double> %v, double %elt, i32 3
843 ret <vscale x 4 x double> %r
846 define <vscale x 4 x double> @insertelt_nxv4f64_idx(<vscale x 4 x double> %v, double %elt, i32 zeroext %idx) {
847 ; CHECK-LABEL: insertelt_nxv4f64_idx:
849 ; CHECK-NEXT: vsetvli a1, zero, e64, m1, ta, ma
850 ; CHECK-NEXT: vfmv.s.f v12, fa0
851 ; CHECK-NEXT: addi a1, a0, 1
852 ; CHECK-NEXT: vsetvli zero, a1, e64, m4, tu, ma
853 ; CHECK-NEXT: vslideup.vx v8, v12, a0
855 %r = insertelement <vscale x 4 x double> %v, double %elt, i32 %idx
856 ret <vscale x 4 x double> %r
859 define <vscale x 8 x double> @insertelt_nxv8f64_0(<vscale x 8 x double> %v, double %elt) {
860 ; CHECK-LABEL: insertelt_nxv8f64_0:
862 ; CHECK-NEXT: vsetvli a0, zero, e64, m1, tu, ma
863 ; CHECK-NEXT: vfmv.s.f v8, fa0
865 %r = insertelement <vscale x 8 x double> %v, double %elt, i32 0
866 ret <vscale x 8 x double> %r
869 define <vscale x 8 x double> @insertelt_nxv8f64_imm(<vscale x 8 x double> %v, double %elt) {
870 ; CHECK-LABEL: insertelt_nxv8f64_imm:
872 ; CHECK-NEXT: vsetivli zero, 4, e64, m2, tu, ma
873 ; CHECK-NEXT: vfmv.s.f v16, fa0
874 ; CHECK-NEXT: vslideup.vi v8, v16, 3
876 %r = insertelement <vscale x 8 x double> %v, double %elt, i32 3
877 ret <vscale x 8 x double> %r
880 define <vscale x 8 x double> @insertelt_nxv8f64_idx(<vscale x 8 x double> %v, double %elt, i32 zeroext %idx) {
881 ; CHECK-LABEL: insertelt_nxv8f64_idx:
883 ; CHECK-NEXT: vsetvli a1, zero, e64, m1, ta, ma
884 ; CHECK-NEXT: vfmv.s.f v16, fa0
885 ; CHECK-NEXT: addi a1, a0, 1
886 ; CHECK-NEXT: vsetvli zero, a1, e64, m8, tu, ma
887 ; CHECK-NEXT: vslideup.vx v8, v16, a0
889 %r = insertelement <vscale x 8 x double> %v, double %elt, i32 %idx
890 ret <vscale x 8 x double> %r