1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=riscv32 -target-abi=ilp32d -mattr=+v,+zfh,+zvfh,+f,+d -verify-machineinstrs < %s | FileCheck %s --check-prefixes=CHECK,RV32
3 ; RUN: llc -mtriple=riscv64 -target-abi=lp64d -mattr=+v,+zfh,+zvfh,+f,+d -verify-machineinstrs < %s | FileCheck %s --check-prefixes=CHECK,RV64
5 define <4 x i32> @insertelt_v4i32_0(<4 x i32> %a, i32 %y) {
6 ; CHECK-LABEL: insertelt_v4i32_0:
8 ; CHECK-NEXT: vsetivli zero, 4, e32, m1, tu, ma
9 ; CHECK-NEXT: vmv.s.x v8, a0
11 %b = insertelement <4 x i32> %a, i32 %y, i32 0
15 define <4 x i32> @insertelt_v4i32_3(<4 x i32> %a, i32 %y) {
16 ; CHECK-LABEL: insertelt_v4i32_3:
18 ; CHECK-NEXT: vsetivli zero, 4, e32, m1, ta, ma
19 ; CHECK-NEXT: vmv.s.x v9, a0
20 ; CHECK-NEXT: vslideup.vi v8, v9, 3
22 %b = insertelement <4 x i32> %a, i32 %y, i32 3
26 define <4 x i32> @insertelt_v4i32_idx(<4 x i32> %a, i32 %y, i32 zeroext %idx) {
27 ; CHECK-LABEL: insertelt_v4i32_idx:
29 ; CHECK-NEXT: addi a2, a1, 1
30 ; CHECK-NEXT: vsetivli zero, 4, e32, m1, ta, ma
31 ; CHECK-NEXT: vmv.s.x v9, a0
32 ; CHECK-NEXT: vsetvli zero, a2, e32, m1, tu, ma
33 ; CHECK-NEXT: vslideup.vx v8, v9, a1
35 %b = insertelement <4 x i32> %a, i32 %y, i32 %idx
39 define <32 x i32> @insertelt_v32i32_0(<32 x i32> %a, i32 %y) {
40 ; CHECK-LABEL: insertelt_v32i32_0:
42 ; CHECK-NEXT: li a1, 32
43 ; CHECK-NEXT: vsetvli zero, a1, e32, m1, tu, ma
44 ; CHECK-NEXT: vmv.s.x v8, a0
46 %b = insertelement <32 x i32> %a, i32 %y, i32 0
50 ; FIXME: Should only require an m2 slideup
51 define <32 x i32> @insertelt_v32i32_4(<32 x i32> %a, i32 %y) {
52 ; CHECK-LABEL: insertelt_v32i32_4:
54 ; CHECK-NEXT: li a1, 32
55 ; CHECK-NEXT: vsetvli zero, a1, e32, m1, ta, ma
56 ; CHECK-NEXT: vmv.s.x v16, a0
57 ; CHECK-NEXT: vsetivli zero, 5, e32, m2, tu, ma
58 ; CHECK-NEXT: vslideup.vi v8, v16, 4
60 %b = insertelement <32 x i32> %a, i32 %y, i32 4
64 define <32 x i32> @insertelt_v32i32_31(<32 x i32> %a, i32 %y) {
65 ; CHECK-LABEL: insertelt_v32i32_31:
67 ; CHECK-NEXT: li a1, 32
68 ; CHECK-NEXT: vsetvli zero, a1, e32, m1, ta, ma
69 ; CHECK-NEXT: vmv.s.x v16, a0
70 ; CHECK-NEXT: vsetvli zero, a1, e32, m8, ta, ma
71 ; CHECK-NEXT: vslideup.vi v8, v16, 31
73 %b = insertelement <32 x i32> %a, i32 %y, i32 31
77 define <32 x i32> @insertelt_v32i32_idx(<32 x i32> %a, i32 %y, i32 zeroext %idx) {
78 ; CHECK-LABEL: insertelt_v32i32_idx:
80 ; CHECK-NEXT: li a2, 32
81 ; CHECK-NEXT: vsetvli zero, a2, e32, m1, ta, ma
82 ; CHECK-NEXT: vmv.s.x v16, a0
83 ; CHECK-NEXT: addi a0, a1, 1
84 ; CHECK-NEXT: vsetvli zero, a0, e32, m8, tu, ma
85 ; CHECK-NEXT: vslideup.vx v8, v16, a1
87 %b = insertelement <32 x i32> %a, i32 %y, i32 %idx
91 define <64 x i32> @insertelt_v64i32_0(<64 x i32> %a, i32 %y) {
92 ; CHECK-LABEL: insertelt_v64i32_0:
94 ; CHECK-NEXT: li a1, 32
95 ; CHECK-NEXT: vsetvli zero, a1, e32, m1, tu, ma
96 ; CHECK-NEXT: vmv.s.x v8, a0
98 %b = insertelement <64 x i32> %a, i32 %y, i32 0
102 define <64 x i32> @insertelt_v64i32_63(<64 x i32> %a, i32 %y) {
103 ; CHECK-LABEL: insertelt_v64i32_63:
105 ; CHECK-NEXT: li a1, 32
106 ; CHECK-NEXT: vsetvli zero, a1, e32, m1, ta, ma
107 ; CHECK-NEXT: vmv.s.x v24, a0
108 ; CHECK-NEXT: vsetvli zero, a1, e32, m8, ta, ma
109 ; CHECK-NEXT: vslideup.vi v16, v24, 31
111 %b = insertelement <64 x i32> %a, i32 %y, i32 63
115 define <64 x i32> @insertelt_v64i32_idx(<64 x i32> %a, i32 %y, i32 zeroext %idx) {
116 ; RV32-LABEL: insertelt_v64i32_idx:
118 ; RV32-NEXT: addi sp, sp, -384
119 ; RV32-NEXT: .cfi_def_cfa_offset 384
120 ; RV32-NEXT: sw ra, 380(sp) # 4-byte Folded Spill
121 ; RV32-NEXT: sw s0, 376(sp) # 4-byte Folded Spill
122 ; RV32-NEXT: .cfi_offset ra, -4
123 ; RV32-NEXT: .cfi_offset s0, -8
124 ; RV32-NEXT: addi s0, sp, 384
125 ; RV32-NEXT: .cfi_def_cfa s0, 0
126 ; RV32-NEXT: andi sp, sp, -128
127 ; RV32-NEXT: andi a1, a1, 63
128 ; RV32-NEXT: slli a1, a1, 2
129 ; RV32-NEXT: mv a2, sp
130 ; RV32-NEXT: add a1, a2, a1
131 ; RV32-NEXT: addi a3, sp, 128
132 ; RV32-NEXT: li a4, 32
133 ; RV32-NEXT: vsetvli zero, a4, e32, m8, ta, ma
134 ; RV32-NEXT: vse32.v v16, (a3)
135 ; RV32-NEXT: vse32.v v8, (a2)
136 ; RV32-NEXT: sw a0, 0(a1)
137 ; RV32-NEXT: vle32.v v8, (a2)
138 ; RV32-NEXT: vle32.v v16, (a3)
139 ; RV32-NEXT: addi sp, s0, -384
140 ; RV32-NEXT: lw ra, 380(sp) # 4-byte Folded Reload
141 ; RV32-NEXT: lw s0, 376(sp) # 4-byte Folded Reload
142 ; RV32-NEXT: addi sp, sp, 384
145 ; RV64-LABEL: insertelt_v64i32_idx:
147 ; RV64-NEXT: addi sp, sp, -384
148 ; RV64-NEXT: .cfi_def_cfa_offset 384
149 ; RV64-NEXT: sd ra, 376(sp) # 8-byte Folded Spill
150 ; RV64-NEXT: sd s0, 368(sp) # 8-byte Folded Spill
151 ; RV64-NEXT: .cfi_offset ra, -8
152 ; RV64-NEXT: .cfi_offset s0, -16
153 ; RV64-NEXT: addi s0, sp, 384
154 ; RV64-NEXT: .cfi_def_cfa s0, 0
155 ; RV64-NEXT: andi sp, sp, -128
156 ; RV64-NEXT: andi a1, a1, 63
157 ; RV64-NEXT: slli a1, a1, 2
158 ; RV64-NEXT: mv a2, sp
159 ; RV64-NEXT: add a1, a2, a1
160 ; RV64-NEXT: addi a3, sp, 128
161 ; RV64-NEXT: li a4, 32
162 ; RV64-NEXT: vsetvli zero, a4, e32, m8, ta, ma
163 ; RV64-NEXT: vse32.v v16, (a3)
164 ; RV64-NEXT: vse32.v v8, (a2)
165 ; RV64-NEXT: sw a0, 0(a1)
166 ; RV64-NEXT: vle32.v v8, (a2)
167 ; RV64-NEXT: vle32.v v16, (a3)
168 ; RV64-NEXT: addi sp, s0, -384
169 ; RV64-NEXT: ld ra, 376(sp) # 8-byte Folded Reload
170 ; RV64-NEXT: ld s0, 368(sp) # 8-byte Folded Reload
171 ; RV64-NEXT: addi sp, sp, 384
173 %b = insertelement <64 x i32> %a, i32 %y, i32 %idx
177 ; FIXME: This codegen needs to be improved. These tests previously asserted
178 ; type legalizing the i64 type on RV32.
180 define <4 x i64> @insertelt_v4i64(<4 x i64> %a, i64 %y) {
181 ; RV32-LABEL: insertelt_v4i64:
183 ; RV32-NEXT: vsetivli zero, 2, e32, m2, ta, ma
184 ; RV32-NEXT: vslide1down.vx v10, v8, a0
185 ; RV32-NEXT: vslide1down.vx v10, v10, a1
186 ; RV32-NEXT: vsetivli zero, 4, e64, m2, ta, ma
187 ; RV32-NEXT: vslideup.vi v8, v10, 3
190 ; RV64-LABEL: insertelt_v4i64:
192 ; RV64-NEXT: vsetivli zero, 4, e64, m2, ta, ma
193 ; RV64-NEXT: vmv.s.x v10, a0
194 ; RV64-NEXT: vslideup.vi v8, v10, 3
196 %b = insertelement <4 x i64> %a, i64 %y, i32 3
200 define void @insertelt_v4i64_store(ptr %x, i64 %y) {
201 ; RV32-LABEL: insertelt_v4i64_store:
203 ; RV32-NEXT: sw a2, 28(a0)
204 ; RV32-NEXT: sw a1, 24(a0)
207 ; RV64-LABEL: insertelt_v4i64_store:
209 ; RV64-NEXT: sd a1, 24(a0)
211 %a = load <4 x i64>, ptr %x
212 %b = insertelement <4 x i64> %a, i64 %y, i32 3
213 store <4 x i64> %b, ptr %x
217 ; This uses a non-power of 2 type so that it isn't an MVT.
218 ; The align keeps the type legalizer from using a 256 bit load so we must split
219 ; it. This some operations that weren't support for scalable vectors when
220 ; this test was written.
221 define <3 x i64> @insertelt_v3i64(<3 x i64> %a, i64 %y) {
222 ; RV32-LABEL: insertelt_v3i64:
224 ; RV32-NEXT: vsetivli zero, 1, e32, m1, ta, ma
225 ; RV32-NEXT: vslidedown.vi v9, v8, 3
226 ; RV32-NEXT: vmv.x.s a2, v9
227 ; RV32-NEXT: vslidedown.vi v9, v8, 2
228 ; RV32-NEXT: vmv.x.s a3, v9
229 ; RV32-NEXT: vslidedown.vi v9, v8, 1
230 ; RV32-NEXT: vmv.x.s a4, v9
231 ; RV32-NEXT: vmv.x.s a5, v8
232 ; RV32-NEXT: vsetivli zero, 8, e32, m2, ta, ma
233 ; RV32-NEXT: vslide1down.vx v8, v8, a5
234 ; RV32-NEXT: vslide1down.vx v8, v8, a4
235 ; RV32-NEXT: vslide1down.vx v8, v8, a3
236 ; RV32-NEXT: vslide1down.vx v8, v8, a2
237 ; RV32-NEXT: vslide1down.vx v8, v8, a0
238 ; RV32-NEXT: vslide1down.vx v8, v8, a1
239 ; RV32-NEXT: vslidedown.vi v8, v8, 2
242 ; RV64-LABEL: insertelt_v3i64:
244 ; RV64-NEXT: vsetivli zero, 1, e64, m1, ta, ma
245 ; RV64-NEXT: vslidedown.vi v9, v8, 1
246 ; RV64-NEXT: vmv.x.s a1, v9
247 ; RV64-NEXT: vmv.x.s a2, v8
248 ; RV64-NEXT: vsetivli zero, 4, e64, m2, ta, ma
249 ; RV64-NEXT: vslide1down.vx v8, v8, a2
250 ; RV64-NEXT: vslide1down.vx v8, v8, a1
251 ; RV64-NEXT: vslide1down.vx v8, v8, a0
252 ; RV64-NEXT: vslidedown.vi v8, v8, 1
254 %b = insertelement <3 x i64> %a, i64 %y, i32 2
258 define void @insertelt_v3i64_store(ptr %x, i64 %y) {
259 ; RV32-LABEL: insertelt_v3i64_store:
261 ; RV32-NEXT: sw a2, 20(a0)
262 ; RV32-NEXT: sw a1, 16(a0)
265 ; RV64-LABEL: insertelt_v3i64_store:
267 ; RV64-NEXT: sd a1, 16(a0)
269 %a = load <3 x i64>, ptr %x, align 8
270 %b = insertelement <3 x i64> %a, i64 %y, i32 2
271 store <3 x i64> %b, ptr %x
275 define <16 x i8> @insertelt_v16i8(<16 x i8> %a, i8 %y) {
276 ; CHECK-LABEL: insertelt_v16i8:
278 ; CHECK-NEXT: vsetivli zero, 15, e8, m1, tu, ma
279 ; CHECK-NEXT: vmv.s.x v9, a0
280 ; CHECK-NEXT: vslideup.vi v8, v9, 14
282 %b = insertelement <16 x i8> %a, i8 %y, i32 14
286 define void @insertelt_v16i8_store(ptr %x, i8 %y) {
287 ; CHECK-LABEL: insertelt_v16i8_store:
289 ; CHECK-NEXT: sb a1, 14(a0)
291 %a = load <16 x i8>, ptr %x
292 %b = insertelement <16 x i8> %a, i8 %y, i32 14
293 store <16 x i8> %b, ptr %x
297 define <32 x i16> @insertelt_v32i16(<32 x i16> %a, i16 %y, i32 %idx) {
298 ; RV32-LABEL: insertelt_v32i16:
300 ; RV32-NEXT: li a2, 32
301 ; RV32-NEXT: vsetvli zero, a2, e16, m1, ta, ma
302 ; RV32-NEXT: vmv.s.x v12, a0
303 ; RV32-NEXT: addi a0, a1, 1
304 ; RV32-NEXT: vsetvli zero, a0, e16, m4, tu, ma
305 ; RV32-NEXT: vslideup.vx v8, v12, a1
308 ; RV64-LABEL: insertelt_v32i16:
310 ; RV64-NEXT: li a2, 32
311 ; RV64-NEXT: vsetvli zero, a2, e16, m1, ta, ma
312 ; RV64-NEXT: vmv.s.x v12, a0
313 ; RV64-NEXT: slli a1, a1, 32
314 ; RV64-NEXT: srli a1, a1, 32
315 ; RV64-NEXT: addi a0, a1, 1
316 ; RV64-NEXT: vsetvli zero, a0, e16, m4, tu, ma
317 ; RV64-NEXT: vslideup.vx v8, v12, a1
319 %b = insertelement <32 x i16> %a, i16 %y, i32 %idx
323 define void @insertelt_v32i16_store(ptr %x, i16 %y, i32 %idx) {
324 ; RV32-LABEL: insertelt_v32i16_store:
326 ; RV32-NEXT: slli a2, a2, 1
327 ; RV32-NEXT: add a0, a0, a2
328 ; RV32-NEXT: sh a1, 0(a0)
331 ; RV64-LABEL: insertelt_v32i16_store:
333 ; RV64-NEXT: slli a2, a2, 32
334 ; RV64-NEXT: srli a2, a2, 31
335 ; RV64-NEXT: add a0, a0, a2
336 ; RV64-NEXT: sh a1, 0(a0)
338 %a = load <32 x i16>, ptr %x
339 %b = insertelement <32 x i16> %a, i16 %y, i32 %idx
340 store <32 x i16> %b, ptr %x
344 define <8 x float> @insertelt_v8f32(<8 x float> %a, float %y, i32 %idx) {
345 ; RV32-LABEL: insertelt_v8f32:
347 ; RV32-NEXT: vsetivli zero, 8, e32, m1, ta, ma
348 ; RV32-NEXT: vfmv.s.f v10, fa0
349 ; RV32-NEXT: addi a1, a0, 1
350 ; RV32-NEXT: vsetvli zero, a1, e32, m2, tu, ma
351 ; RV32-NEXT: vslideup.vx v8, v10, a0
354 ; RV64-LABEL: insertelt_v8f32:
356 ; RV64-NEXT: vsetivli zero, 8, e32, m1, ta, ma
357 ; RV64-NEXT: vfmv.s.f v10, fa0
358 ; RV64-NEXT: slli a0, a0, 32
359 ; RV64-NEXT: srli a0, a0, 32
360 ; RV64-NEXT: addi a1, a0, 1
361 ; RV64-NEXT: vsetvli zero, a1, e32, m2, tu, ma
362 ; RV64-NEXT: vslideup.vx v8, v10, a0
364 %b = insertelement <8 x float> %a, float %y, i32 %idx
368 define void @insertelt_v8f32_store(ptr %x, float %y, i32 %idx) {
369 ; RV32-LABEL: insertelt_v8f32_store:
371 ; RV32-NEXT: slli a1, a1, 2
372 ; RV32-NEXT: add a0, a0, a1
373 ; RV32-NEXT: fsw fa0, 0(a0)
376 ; RV64-LABEL: insertelt_v8f32_store:
378 ; RV64-NEXT: slli a1, a1, 32
379 ; RV64-NEXT: srli a1, a1, 30
380 ; RV64-NEXT: add a0, a0, a1
381 ; RV64-NEXT: fsw fa0, 0(a0)
383 %a = load <8 x float>, ptr %x
384 %b = insertelement <8 x float> %a, float %y, i32 %idx
385 store <8 x float> %b, ptr %x
389 define <8 x i64> @insertelt_v8i64_0(<8 x i64> %a, ptr %x) {
390 ; CHECK-LABEL: insertelt_v8i64_0:
392 ; CHECK-NEXT: li a0, -1
393 ; CHECK-NEXT: vsetivli zero, 8, e64, m1, tu, ma
394 ; CHECK-NEXT: vmv.s.x v8, a0
396 %b = insertelement <8 x i64> %a, i64 -1, i32 0
400 define void @insertelt_v8i64_0_store(ptr %x) {
401 ; RV32-LABEL: insertelt_v8i64_0_store:
403 ; RV32-NEXT: li a1, -1
404 ; RV32-NEXT: sw a1, 4(a0)
405 ; RV32-NEXT: sw a1, 0(a0)
408 ; RV64-LABEL: insertelt_v8i64_0_store:
410 ; RV64-NEXT: li a1, -1
411 ; RV64-NEXT: sd a1, 0(a0)
413 %a = load <8 x i64>, ptr %x
414 %b = insertelement <8 x i64> %a, i64 -1, i32 0
415 store <8 x i64> %b, ptr %x
419 define <8 x i64> @insertelt_v8i64(<8 x i64> %a, i32 %idx) {
420 ; RV32-LABEL: insertelt_v8i64:
422 ; RV32-NEXT: vsetivli zero, 8, e64, m1, ta, ma
423 ; RV32-NEXT: vmv.v.i v12, -1
424 ; RV32-NEXT: addi a1, a0, 1
425 ; RV32-NEXT: vsetvli zero, a1, e64, m4, tu, ma
426 ; RV32-NEXT: vslideup.vx v8, v12, a0
429 ; RV64-LABEL: insertelt_v8i64:
431 ; RV64-NEXT: vsetivli zero, 8, e64, m1, ta, ma
432 ; RV64-NEXT: vmv.v.i v12, -1
433 ; RV64-NEXT: slli a0, a0, 32
434 ; RV64-NEXT: srli a0, a0, 32
435 ; RV64-NEXT: addi a1, a0, 1
436 ; RV64-NEXT: vsetvli zero, a1, e64, m4, tu, ma
437 ; RV64-NEXT: vslideup.vx v8, v12, a0
439 %b = insertelement <8 x i64> %a, i64 -1, i32 %idx
443 define void @insertelt_v8i64_store(ptr %x, i32 %idx) {
444 ; RV32-LABEL: insertelt_v8i64_store:
446 ; RV32-NEXT: slli a1, a1, 3
447 ; RV32-NEXT: add a0, a0, a1
448 ; RV32-NEXT: li a1, -1
449 ; RV32-NEXT: sw a1, 4(a0)
450 ; RV32-NEXT: sw a1, 0(a0)
453 ; RV64-LABEL: insertelt_v8i64_store:
455 ; RV64-NEXT: slli a1, a1, 32
456 ; RV64-NEXT: srli a1, a1, 29
457 ; RV64-NEXT: add a0, a0, a1
458 ; RV64-NEXT: li a1, -1
459 ; RV64-NEXT: sd a1, 0(a0)
461 %a = load <8 x i64>, ptr %x
462 %b = insertelement <8 x i64> %a, i64 -1, i32 %idx
463 store <8 x i64> %b, ptr %x
467 define <8 x i64> @insertelt_c6_v8i64_0(<8 x i64> %a, ptr %x) {
468 ; CHECK-LABEL: insertelt_c6_v8i64_0:
470 ; CHECK-NEXT: li a0, 6
471 ; CHECK-NEXT: vsetivli zero, 8, e64, m1, tu, ma
472 ; CHECK-NEXT: vmv.s.x v8, a0
474 %b = insertelement <8 x i64> %a, i64 6, i32 0
478 define void @insertelt_c6_v8i64_0_store(ptr %x) {
479 ; RV32-LABEL: insertelt_c6_v8i64_0_store:
481 ; RV32-NEXT: sw zero, 4(a0)
482 ; RV32-NEXT: li a1, 6
483 ; RV32-NEXT: sw a1, 0(a0)
486 ; RV64-LABEL: insertelt_c6_v8i64_0_store:
488 ; RV64-NEXT: li a1, 6
489 ; RV64-NEXT: sd a1, 0(a0)
491 %a = load <8 x i64>, ptr %x
492 %b = insertelement <8 x i64> %a, i64 6, i32 0
493 store <8 x i64> %b, ptr %x
497 define <8 x i64> @insertelt_c6_v8i64(<8 x i64> %a, i32 %idx) {
498 ; RV32-LABEL: insertelt_c6_v8i64:
500 ; RV32-NEXT: vsetivli zero, 8, e64, m1, ta, ma
501 ; RV32-NEXT: vmv.v.i v12, 6
502 ; RV32-NEXT: addi a1, a0, 1
503 ; RV32-NEXT: vsetvli zero, a1, e64, m4, tu, ma
504 ; RV32-NEXT: vslideup.vx v8, v12, a0
507 ; RV64-LABEL: insertelt_c6_v8i64:
509 ; RV64-NEXT: vsetivli zero, 8, e64, m1, ta, ma
510 ; RV64-NEXT: vmv.v.i v12, 6
511 ; RV64-NEXT: slli a0, a0, 32
512 ; RV64-NEXT: srli a0, a0, 32
513 ; RV64-NEXT: addi a1, a0, 1
514 ; RV64-NEXT: vsetvli zero, a1, e64, m4, tu, ma
515 ; RV64-NEXT: vslideup.vx v8, v12, a0
517 %b = insertelement <8 x i64> %a, i64 6, i32 %idx
521 define void @insertelt_c6_v8i64_store(ptr %x, i32 %idx) {
522 ; RV32-LABEL: insertelt_c6_v8i64_store:
524 ; RV32-NEXT: slli a1, a1, 3
525 ; RV32-NEXT: add a0, a0, a1
526 ; RV32-NEXT: sw zero, 4(a0)
527 ; RV32-NEXT: li a1, 6
528 ; RV32-NEXT: sw a1, 0(a0)
531 ; RV64-LABEL: insertelt_c6_v8i64_store:
533 ; RV64-NEXT: slli a1, a1, 32
534 ; RV64-NEXT: srli a1, a1, 29
535 ; RV64-NEXT: add a0, a0, a1
536 ; RV64-NEXT: li a1, 6
537 ; RV64-NEXT: sd a1, 0(a0)
539 %a = load <8 x i64>, ptr %x
540 %b = insertelement <8 x i64> %a, i64 6, i32 %idx
541 store <8 x i64> %b, ptr %x
545 ; Test that using a insertelement at element 0 by a later operation doesn't
546 ; crash the compiler.
547 define void @insertelt_c6_v8i64_0_add(ptr %x, ptr %y) {
548 ; CHECK-LABEL: insertelt_c6_v8i64_0_add:
550 ; CHECK-NEXT: vsetivli zero, 8, e64, m4, ta, ma
551 ; CHECK-NEXT: vle64.v v8, (a0)
552 ; CHECK-NEXT: li a2, 6
553 ; CHECK-NEXT: vsetvli zero, zero, e64, m4, tu, ma
554 ; CHECK-NEXT: vmv.s.x v8, a2
555 ; CHECK-NEXT: vsetvli zero, zero, e64, m4, ta, ma
556 ; CHECK-NEXT: vle64.v v12, (a1)
557 ; CHECK-NEXT: vadd.vv v8, v8, v12
558 ; CHECK-NEXT: vse64.v v8, (a0)
560 %a = load <8 x i64>, ptr %x
561 %b = insertelement <8 x i64> %a, i64 6, i32 0
562 %c = load <8 x i64>, ptr %y
563 %d = add <8 x i64> %b, %c
564 store <8 x i64> %d, ptr %x