1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=riscv32 -mattr=+v -verify-machineinstrs < %s | FileCheck %s --check-prefixes=CHECK,RV32
3 ; RUN: llc -mtriple=riscv64 -mattr=+v -verify-machineinstrs < %s | FileCheck %s --check-prefixes=CHECK,RV64
5 define <vscale x 1 x i8> @vadd_vx_nxv1i8(<vscale x 1 x i8> %va, i8 signext %b) {
6 ; CHECK-LABEL: vadd_vx_nxv1i8:
8 ; CHECK-NEXT: vsetvli a1, zero, e8, mf8, ta, ma
9 ; CHECK-NEXT: vadd.vx v8, v8, a0
11 %head = insertelement <vscale x 1 x i8> poison, i8 %b, i32 0
12 %splat = shufflevector <vscale x 1 x i8> %head, <vscale x 1 x i8> poison, <vscale x 1 x i32> zeroinitializer
13 %vc = add <vscale x 1 x i8> %va, %splat
14 ret <vscale x 1 x i8> %vc
17 define <vscale x 1 x i8> @vadd_vx_nxv1i8_0(<vscale x 1 x i8> %va) {
18 ; CHECK-LABEL: vadd_vx_nxv1i8_0:
20 ; CHECK-NEXT: vsetvli a0, zero, e8, mf8, ta, ma
21 ; CHECK-NEXT: vadd.vi v8, v8, -1
23 %head = insertelement <vscale x 1 x i8> poison, i8 -1, i32 0
24 %splat = shufflevector <vscale x 1 x i8> %head, <vscale x 1 x i8> poison, <vscale x 1 x i32> zeroinitializer
25 %vc = add <vscale x 1 x i8> %va, %splat
26 ret <vscale x 1 x i8> %vc
29 define <vscale x 1 x i8> @vadd_vx_nxv1i8_1(<vscale x 1 x i8> %va) {
30 ; CHECK-LABEL: vadd_vx_nxv1i8_1:
32 ; CHECK-NEXT: vsetvli a0, zero, e8, mf8, ta, ma
33 ; CHECK-NEXT: vadd.vi v8, v8, 2
35 %head = insertelement <vscale x 1 x i8> poison, i8 2, i32 0
36 %splat = shufflevector <vscale x 1 x i8> %head, <vscale x 1 x i8> poison, <vscale x 1 x i32> zeroinitializer
37 %vc = add <vscale x 1 x i8> %va, %splat
38 ret <vscale x 1 x i8> %vc
41 ; Test constant adds to see if we can optimize them away for scalable vectors.
42 define <vscale x 1 x i8> @vadd_ii_nxv1i8_1() {
43 ; CHECK-LABEL: vadd_ii_nxv1i8_1:
45 ; CHECK-NEXT: vsetvli a0, zero, e8, mf8, ta, ma
46 ; CHECK-NEXT: vmv.v.i v8, 5
48 %heada = insertelement <vscale x 1 x i8> poison, i8 2, i32 0
49 %splata = shufflevector <vscale x 1 x i8> %heada, <vscale x 1 x i8> poison, <vscale x 1 x i32> zeroinitializer
50 %headb = insertelement <vscale x 1 x i8> poison, i8 3, i32 0
51 %splatb = shufflevector <vscale x 1 x i8> %headb, <vscale x 1 x i8> poison, <vscale x 1 x i32> zeroinitializer
52 %vc = add <vscale x 1 x i8> %splata, %splatb
53 ret <vscale x 1 x i8> %vc
56 define <vscale x 2 x i8> @vadd_vx_nxv2i8(<vscale x 2 x i8> %va, i8 signext %b) {
57 ; CHECK-LABEL: vadd_vx_nxv2i8:
59 ; CHECK-NEXT: vsetvli a1, zero, e8, mf4, ta, ma
60 ; CHECK-NEXT: vadd.vx v8, v8, a0
62 %head = insertelement <vscale x 2 x i8> poison, i8 %b, i32 0
63 %splat = shufflevector <vscale x 2 x i8> %head, <vscale x 2 x i8> poison, <vscale x 2 x i32> zeroinitializer
64 %vc = add <vscale x 2 x i8> %va, %splat
65 ret <vscale x 2 x i8> %vc
68 define <vscale x 2 x i8> @vadd_vx_nxv2i8_0(<vscale x 2 x i8> %va) {
69 ; CHECK-LABEL: vadd_vx_nxv2i8_0:
71 ; CHECK-NEXT: vsetvli a0, zero, e8, mf4, ta, ma
72 ; CHECK-NEXT: vadd.vi v8, v8, -1
74 %head = insertelement <vscale x 2 x i8> poison, i8 -1, i32 0
75 %splat = shufflevector <vscale x 2 x i8> %head, <vscale x 2 x i8> poison, <vscale x 2 x i32> zeroinitializer
76 %vc = add <vscale x 2 x i8> %va, %splat
77 ret <vscale x 2 x i8> %vc
80 define <vscale x 2 x i8> @vadd_vx_nxv2i8_1(<vscale x 2 x i8> %va) {
81 ; CHECK-LABEL: vadd_vx_nxv2i8_1:
83 ; CHECK-NEXT: vsetvli a0, zero, e8, mf4, ta, ma
84 ; CHECK-NEXT: vadd.vi v8, v8, 2
86 %head = insertelement <vscale x 2 x i8> poison, i8 2, i32 0
87 %splat = shufflevector <vscale x 2 x i8> %head, <vscale x 2 x i8> poison, <vscale x 2 x i32> zeroinitializer
88 %vc = add <vscale x 2 x i8> %va, %splat
89 ret <vscale x 2 x i8> %vc
92 define <vscale x 4 x i8> @vadd_vx_nxv4i8(<vscale x 4 x i8> %va, i8 signext %b) {
93 ; CHECK-LABEL: vadd_vx_nxv4i8:
95 ; CHECK-NEXT: vsetvli a1, zero, e8, mf2, ta, ma
96 ; CHECK-NEXT: vadd.vx v8, v8, a0
98 %head = insertelement <vscale x 4 x i8> poison, i8 %b, i32 0
99 %splat = shufflevector <vscale x 4 x i8> %head, <vscale x 4 x i8> poison, <vscale x 4 x i32> zeroinitializer
100 %vc = add <vscale x 4 x i8> %va, %splat
101 ret <vscale x 4 x i8> %vc
104 define <vscale x 4 x i8> @vadd_vx_nxv4i8_0(<vscale x 4 x i8> %va) {
105 ; CHECK-LABEL: vadd_vx_nxv4i8_0:
107 ; CHECK-NEXT: vsetvli a0, zero, e8, mf2, ta, ma
108 ; CHECK-NEXT: vadd.vi v8, v8, -1
110 %head = insertelement <vscale x 4 x i8> poison, i8 -1, i32 0
111 %splat = shufflevector <vscale x 4 x i8> %head, <vscale x 4 x i8> poison, <vscale x 4 x i32> zeroinitializer
112 %vc = add <vscale x 4 x i8> %va, %splat
113 ret <vscale x 4 x i8> %vc
116 define <vscale x 4 x i8> @vadd_vx_nxv4i8_1(<vscale x 4 x i8> %va) {
117 ; CHECK-LABEL: vadd_vx_nxv4i8_1:
119 ; CHECK-NEXT: vsetvli a0, zero, e8, mf2, ta, ma
120 ; CHECK-NEXT: vadd.vi v8, v8, 2
122 %head = insertelement <vscale x 4 x i8> poison, i8 2, i32 0
123 %splat = shufflevector <vscale x 4 x i8> %head, <vscale x 4 x i8> poison, <vscale x 4 x i32> zeroinitializer
124 %vc = add <vscale x 4 x i8> %va, %splat
125 ret <vscale x 4 x i8> %vc
128 define <vscale x 8 x i8> @vadd_vx_nxv8i8(<vscale x 8 x i8> %va, i8 signext %b) {
129 ; CHECK-LABEL: vadd_vx_nxv8i8:
131 ; CHECK-NEXT: vsetvli a1, zero, e8, m1, ta, ma
132 ; CHECK-NEXT: vadd.vx v8, v8, a0
134 %head = insertelement <vscale x 8 x i8> poison, i8 %b, i32 0
135 %splat = shufflevector <vscale x 8 x i8> %head, <vscale x 8 x i8> poison, <vscale x 8 x i32> zeroinitializer
136 %vc = add <vscale x 8 x i8> %va, %splat
137 ret <vscale x 8 x i8> %vc
140 define <vscale x 8 x i8> @vadd_vx_nxv8i8_0(<vscale x 8 x i8> %va) {
141 ; CHECK-LABEL: vadd_vx_nxv8i8_0:
143 ; CHECK-NEXT: vsetvli a0, zero, e8, m1, ta, ma
144 ; CHECK-NEXT: vadd.vi v8, v8, -1
146 %head = insertelement <vscale x 8 x i8> poison, i8 -1, i32 0
147 %splat = shufflevector <vscale x 8 x i8> %head, <vscale x 8 x i8> poison, <vscale x 8 x i32> zeroinitializer
148 %vc = add <vscale x 8 x i8> %va, %splat
149 ret <vscale x 8 x i8> %vc
152 define <vscale x 8 x i8> @vadd_vx_nxv8i8_1(<vscale x 8 x i8> %va) {
153 ; CHECK-LABEL: vadd_vx_nxv8i8_1:
155 ; CHECK-NEXT: vsetvli a0, zero, e8, m1, ta, ma
156 ; CHECK-NEXT: vadd.vi v8, v8, 2
158 %head = insertelement <vscale x 8 x i8> poison, i8 2, i32 0
159 %splat = shufflevector <vscale x 8 x i8> %head, <vscale x 8 x i8> poison, <vscale x 8 x i32> zeroinitializer
160 %vc = add <vscale x 8 x i8> %va, %splat
161 ret <vscale x 8 x i8> %vc
164 define <vscale x 16 x i8> @vadd_vx_nxv16i8(<vscale x 16 x i8> %va, i8 signext %b) {
165 ; CHECK-LABEL: vadd_vx_nxv16i8:
167 ; CHECK-NEXT: vsetvli a1, zero, e8, m2, ta, ma
168 ; CHECK-NEXT: vadd.vx v8, v8, a0
170 %head = insertelement <vscale x 16 x i8> poison, i8 %b, i32 0
171 %splat = shufflevector <vscale x 16 x i8> %head, <vscale x 16 x i8> poison, <vscale x 16 x i32> zeroinitializer
172 %vc = add <vscale x 16 x i8> %va, %splat
173 ret <vscale x 16 x i8> %vc
176 define <vscale x 16 x i8> @vadd_vx_nxv16i8_0(<vscale x 16 x i8> %va) {
177 ; CHECK-LABEL: vadd_vx_nxv16i8_0:
179 ; CHECK-NEXT: vsetvli a0, zero, e8, m2, ta, ma
180 ; CHECK-NEXT: vadd.vi v8, v8, -1
182 %head = insertelement <vscale x 16 x i8> poison, i8 -1, i32 0
183 %splat = shufflevector <vscale x 16 x i8> %head, <vscale x 16 x i8> poison, <vscale x 16 x i32> zeroinitializer
184 %vc = add <vscale x 16 x i8> %va, %splat
185 ret <vscale x 16 x i8> %vc
188 define <vscale x 16 x i8> @vadd_vx_nxv16i8_1(<vscale x 16 x i8> %va) {
189 ; CHECK-LABEL: vadd_vx_nxv16i8_1:
191 ; CHECK-NEXT: vsetvli a0, zero, e8, m2, ta, ma
192 ; CHECK-NEXT: vadd.vi v8, v8, 2
194 %head = insertelement <vscale x 16 x i8> poison, i8 2, i32 0
195 %splat = shufflevector <vscale x 16 x i8> %head, <vscale x 16 x i8> poison, <vscale x 16 x i32> zeroinitializer
196 %vc = add <vscale x 16 x i8> %va, %splat
197 ret <vscale x 16 x i8> %vc
200 define <vscale x 32 x i8> @vadd_vx_nxv32i8(<vscale x 32 x i8> %va, i8 signext %b) {
201 ; CHECK-LABEL: vadd_vx_nxv32i8:
203 ; CHECK-NEXT: vsetvli a1, zero, e8, m4, ta, ma
204 ; CHECK-NEXT: vadd.vx v8, v8, a0
206 %head = insertelement <vscale x 32 x i8> poison, i8 %b, i32 0
207 %splat = shufflevector <vscale x 32 x i8> %head, <vscale x 32 x i8> poison, <vscale x 32 x i32> zeroinitializer
208 %vc = add <vscale x 32 x i8> %va, %splat
209 ret <vscale x 32 x i8> %vc
212 define <vscale x 32 x i8> @vadd_vx_nxv32i8_0(<vscale x 32 x i8> %va) {
213 ; CHECK-LABEL: vadd_vx_nxv32i8_0:
215 ; CHECK-NEXT: vsetvli a0, zero, e8, m4, ta, ma
216 ; CHECK-NEXT: vadd.vi v8, v8, -1
218 %head = insertelement <vscale x 32 x i8> poison, i8 -1, i32 0
219 %splat = shufflevector <vscale x 32 x i8> %head, <vscale x 32 x i8> poison, <vscale x 32 x i32> zeroinitializer
220 %vc = add <vscale x 32 x i8> %va, %splat
221 ret <vscale x 32 x i8> %vc
224 define <vscale x 32 x i8> @vadd_vx_nxv32i8_1(<vscale x 32 x i8> %va) {
225 ; CHECK-LABEL: vadd_vx_nxv32i8_1:
227 ; CHECK-NEXT: vsetvli a0, zero, e8, m4, ta, ma
228 ; CHECK-NEXT: vadd.vi v8, v8, 2
230 %head = insertelement <vscale x 32 x i8> poison, i8 2, i32 0
231 %splat = shufflevector <vscale x 32 x i8> %head, <vscale x 32 x i8> poison, <vscale x 32 x i32> zeroinitializer
232 %vc = add <vscale x 32 x i8> %va, %splat
233 ret <vscale x 32 x i8> %vc
236 define <vscale x 64 x i8> @vadd_vx_nxv64i8(<vscale x 64 x i8> %va, i8 signext %b) {
237 ; CHECK-LABEL: vadd_vx_nxv64i8:
239 ; CHECK-NEXT: vsetvli a1, zero, e8, m8, ta, ma
240 ; CHECK-NEXT: vadd.vx v8, v8, a0
242 %head = insertelement <vscale x 64 x i8> poison, i8 %b, i32 0
243 %splat = shufflevector <vscale x 64 x i8> %head, <vscale x 64 x i8> poison, <vscale x 64 x i32> zeroinitializer
244 %vc = add <vscale x 64 x i8> %va, %splat
245 ret <vscale x 64 x i8> %vc
248 define <vscale x 64 x i8> @vadd_vx_nxv64i8_0(<vscale x 64 x i8> %va) {
249 ; CHECK-LABEL: vadd_vx_nxv64i8_0:
251 ; CHECK-NEXT: vsetvli a0, zero, e8, m8, ta, ma
252 ; CHECK-NEXT: vadd.vi v8, v8, -1
254 %head = insertelement <vscale x 64 x i8> poison, i8 -1, i32 0
255 %splat = shufflevector <vscale x 64 x i8> %head, <vscale x 64 x i8> poison, <vscale x 64 x i32> zeroinitializer
256 %vc = add <vscale x 64 x i8> %va, %splat
257 ret <vscale x 64 x i8> %vc
260 define <vscale x 64 x i8> @vadd_vx_nxv64i8_1(<vscale x 64 x i8> %va) {
261 ; CHECK-LABEL: vadd_vx_nxv64i8_1:
263 ; CHECK-NEXT: vsetvli a0, zero, e8, m8, ta, ma
264 ; CHECK-NEXT: vadd.vi v8, v8, 2
266 %head = insertelement <vscale x 64 x i8> poison, i8 2, i32 0
267 %splat = shufflevector <vscale x 64 x i8> %head, <vscale x 64 x i8> poison, <vscale x 64 x i32> zeroinitializer
268 %vc = add <vscale x 64 x i8> %va, %splat
269 ret <vscale x 64 x i8> %vc
272 define <vscale x 1 x i16> @vadd_vx_nxv1i16(<vscale x 1 x i16> %va, i16 signext %b) {
273 ; CHECK-LABEL: vadd_vx_nxv1i16:
275 ; CHECK-NEXT: vsetvli a1, zero, e16, mf4, ta, ma
276 ; CHECK-NEXT: vadd.vx v8, v8, a0
278 %head = insertelement <vscale x 1 x i16> poison, i16 %b, i32 0
279 %splat = shufflevector <vscale x 1 x i16> %head, <vscale x 1 x i16> poison, <vscale x 1 x i32> zeroinitializer
280 %vc = add <vscale x 1 x i16> %va, %splat
281 ret <vscale x 1 x i16> %vc
284 define <vscale x 1 x i16> @vadd_vx_nxv1i16_0(<vscale x 1 x i16> %va) {
285 ; CHECK-LABEL: vadd_vx_nxv1i16_0:
287 ; CHECK-NEXT: vsetvli a0, zero, e16, mf4, ta, ma
288 ; CHECK-NEXT: vadd.vi v8, v8, -1
290 %head = insertelement <vscale x 1 x i16> poison, i16 -1, i32 0
291 %splat = shufflevector <vscale x 1 x i16> %head, <vscale x 1 x i16> poison, <vscale x 1 x i32> zeroinitializer
292 %vc = add <vscale x 1 x i16> %va, %splat
293 ret <vscale x 1 x i16> %vc
296 define <vscale x 1 x i16> @vadd_vx_nxv1i16_1(<vscale x 1 x i16> %va) {
297 ; CHECK-LABEL: vadd_vx_nxv1i16_1:
299 ; CHECK-NEXT: vsetvli a0, zero, e16, mf4, ta, ma
300 ; CHECK-NEXT: vadd.vi v8, v8, 2
302 %head = insertelement <vscale x 1 x i16> poison, i16 2, i32 0
303 %splat = shufflevector <vscale x 1 x i16> %head, <vscale x 1 x i16> poison, <vscale x 1 x i32> zeroinitializer
304 %vc = add <vscale x 1 x i16> %va, %splat
305 ret <vscale x 1 x i16> %vc
308 define <vscale x 2 x i16> @vadd_vx_nxv2i16(<vscale x 2 x i16> %va, i16 signext %b) {
309 ; CHECK-LABEL: vadd_vx_nxv2i16:
311 ; CHECK-NEXT: vsetvli a1, zero, e16, mf2, ta, ma
312 ; CHECK-NEXT: vadd.vx v8, v8, a0
314 %head = insertelement <vscale x 2 x i16> poison, i16 %b, i32 0
315 %splat = shufflevector <vscale x 2 x i16> %head, <vscale x 2 x i16> poison, <vscale x 2 x i32> zeroinitializer
316 %vc = add <vscale x 2 x i16> %va, %splat
317 ret <vscale x 2 x i16> %vc
320 define <vscale x 2 x i16> @vadd_vx_nxv2i16_0(<vscale x 2 x i16> %va) {
321 ; CHECK-LABEL: vadd_vx_nxv2i16_0:
323 ; CHECK-NEXT: vsetvli a0, zero, e16, mf2, ta, ma
324 ; CHECK-NEXT: vadd.vi v8, v8, -1
326 %head = insertelement <vscale x 2 x i16> poison, i16 -1, i32 0
327 %splat = shufflevector <vscale x 2 x i16> %head, <vscale x 2 x i16> poison, <vscale x 2 x i32> zeroinitializer
328 %vc = add <vscale x 2 x i16> %va, %splat
329 ret <vscale x 2 x i16> %vc
332 define <vscale x 2 x i16> @vadd_vx_nxv2i16_1(<vscale x 2 x i16> %va) {
333 ; CHECK-LABEL: vadd_vx_nxv2i16_1:
335 ; CHECK-NEXT: vsetvli a0, zero, e16, mf2, ta, ma
336 ; CHECK-NEXT: vadd.vi v8, v8, 2
338 %head = insertelement <vscale x 2 x i16> poison, i16 2, i32 0
339 %splat = shufflevector <vscale x 2 x i16> %head, <vscale x 2 x i16> poison, <vscale x 2 x i32> zeroinitializer
340 %vc = add <vscale x 2 x i16> %va, %splat
341 ret <vscale x 2 x i16> %vc
344 define <vscale x 4 x i16> @vadd_vx_nxv4i16(<vscale x 4 x i16> %va, i16 signext %b) {
345 ; CHECK-LABEL: vadd_vx_nxv4i16:
347 ; CHECK-NEXT: vsetvli a1, zero, e16, m1, ta, ma
348 ; CHECK-NEXT: vadd.vx v8, v8, a0
350 %head = insertelement <vscale x 4 x i16> poison, i16 %b, i32 0
351 %splat = shufflevector <vscale x 4 x i16> %head, <vscale x 4 x i16> poison, <vscale x 4 x i32> zeroinitializer
352 %vc = add <vscale x 4 x i16> %va, %splat
353 ret <vscale x 4 x i16> %vc
356 define <vscale x 4 x i16> @vadd_vx_nxv4i16_0(<vscale x 4 x i16> %va) {
357 ; CHECK-LABEL: vadd_vx_nxv4i16_0:
359 ; CHECK-NEXT: vsetvli a0, zero, e16, m1, ta, ma
360 ; CHECK-NEXT: vadd.vi v8, v8, -1
362 %head = insertelement <vscale x 4 x i16> poison, i16 -1, i32 0
363 %splat = shufflevector <vscale x 4 x i16> %head, <vscale x 4 x i16> poison, <vscale x 4 x i32> zeroinitializer
364 %vc = add <vscale x 4 x i16> %va, %splat
365 ret <vscale x 4 x i16> %vc
368 define <vscale x 4 x i16> @vadd_vx_nxv4i16_1(<vscale x 4 x i16> %va) {
369 ; CHECK-LABEL: vadd_vx_nxv4i16_1:
371 ; CHECK-NEXT: vsetvli a0, zero, e16, m1, ta, ma
372 ; CHECK-NEXT: vadd.vi v8, v8, 2
374 %head = insertelement <vscale x 4 x i16> poison, i16 2, i32 0
375 %splat = shufflevector <vscale x 4 x i16> %head, <vscale x 4 x i16> poison, <vscale x 4 x i32> zeroinitializer
376 %vc = add <vscale x 4 x i16> %va, %splat
377 ret <vscale x 4 x i16> %vc
380 define <vscale x 8 x i16> @vadd_vx_nxv8i16(<vscale x 8 x i16> %va, i16 signext %b) {
381 ; CHECK-LABEL: vadd_vx_nxv8i16:
383 ; CHECK-NEXT: vsetvli a1, zero, e16, m2, ta, ma
384 ; CHECK-NEXT: vadd.vx v8, v8, a0
386 %head = insertelement <vscale x 8 x i16> poison, i16 %b, i32 0
387 %splat = shufflevector <vscale x 8 x i16> %head, <vscale x 8 x i16> poison, <vscale x 8 x i32> zeroinitializer
388 %vc = add <vscale x 8 x i16> %va, %splat
389 ret <vscale x 8 x i16> %vc
392 define <vscale x 8 x i16> @vadd_vx_nxv8i16_0(<vscale x 8 x i16> %va) {
393 ; CHECK-LABEL: vadd_vx_nxv8i16_0:
395 ; CHECK-NEXT: vsetvli a0, zero, e16, m2, ta, ma
396 ; CHECK-NEXT: vadd.vi v8, v8, -1
398 %head = insertelement <vscale x 8 x i16> poison, i16 -1, i32 0
399 %splat = shufflevector <vscale x 8 x i16> %head, <vscale x 8 x i16> poison, <vscale x 8 x i32> zeroinitializer
400 %vc = add <vscale x 8 x i16> %va, %splat
401 ret <vscale x 8 x i16> %vc
404 define <vscale x 8 x i16> @vadd_vx_nxv8i16_1(<vscale x 8 x i16> %va) {
405 ; CHECK-LABEL: vadd_vx_nxv8i16_1:
407 ; CHECK-NEXT: vsetvli a0, zero, e16, m2, ta, ma
408 ; CHECK-NEXT: vadd.vi v8, v8, 2
410 %head = insertelement <vscale x 8 x i16> poison, i16 2, i32 0
411 %splat = shufflevector <vscale x 8 x i16> %head, <vscale x 8 x i16> poison, <vscale x 8 x i32> zeroinitializer
412 %vc = add <vscale x 8 x i16> %va, %splat
413 ret <vscale x 8 x i16> %vc
416 define <vscale x 16 x i16> @vadd_vx_nxv16i16(<vscale x 16 x i16> %va, i16 signext %b) {
417 ; CHECK-LABEL: vadd_vx_nxv16i16:
419 ; CHECK-NEXT: vsetvli a1, zero, e16, m4, ta, ma
420 ; CHECK-NEXT: vadd.vx v8, v8, a0
422 %head = insertelement <vscale x 16 x i16> poison, i16 %b, i32 0
423 %splat = shufflevector <vscale x 16 x i16> %head, <vscale x 16 x i16> poison, <vscale x 16 x i32> zeroinitializer
424 %vc = add <vscale x 16 x i16> %va, %splat
425 ret <vscale x 16 x i16> %vc
428 define <vscale x 16 x i16> @vadd_vx_nxv16i16_0(<vscale x 16 x i16> %va) {
429 ; CHECK-LABEL: vadd_vx_nxv16i16_0:
431 ; CHECK-NEXT: vsetvli a0, zero, e16, m4, ta, ma
432 ; CHECK-NEXT: vadd.vi v8, v8, -1
434 %head = insertelement <vscale x 16 x i16> poison, i16 -1, i32 0
435 %splat = shufflevector <vscale x 16 x i16> %head, <vscale x 16 x i16> poison, <vscale x 16 x i32> zeroinitializer
436 %vc = add <vscale x 16 x i16> %va, %splat
437 ret <vscale x 16 x i16> %vc
440 define <vscale x 16 x i16> @vadd_vx_nxv16i16_1(<vscale x 16 x i16> %va) {
441 ; CHECK-LABEL: vadd_vx_nxv16i16_1:
443 ; CHECK-NEXT: vsetvli a0, zero, e16, m4, ta, ma
444 ; CHECK-NEXT: vadd.vi v8, v8, 2
446 %head = insertelement <vscale x 16 x i16> poison, i16 2, i32 0
447 %splat = shufflevector <vscale x 16 x i16> %head, <vscale x 16 x i16> poison, <vscale x 16 x i32> zeroinitializer
448 %vc = add <vscale x 16 x i16> %va, %splat
449 ret <vscale x 16 x i16> %vc
452 define <vscale x 32 x i16> @vadd_vx_nxv32i16(<vscale x 32 x i16> %va, i16 signext %b) {
453 ; CHECK-LABEL: vadd_vx_nxv32i16:
455 ; CHECK-NEXT: vsetvli a1, zero, e16, m8, ta, ma
456 ; CHECK-NEXT: vadd.vx v8, v8, a0
458 %head = insertelement <vscale x 32 x i16> poison, i16 %b, i32 0
459 %splat = shufflevector <vscale x 32 x i16> %head, <vscale x 32 x i16> poison, <vscale x 32 x i32> zeroinitializer
460 %vc = add <vscale x 32 x i16> %va, %splat
461 ret <vscale x 32 x i16> %vc
464 define <vscale x 32 x i16> @vadd_vx_nxv32i16_0(<vscale x 32 x i16> %va) {
465 ; CHECK-LABEL: vadd_vx_nxv32i16_0:
467 ; CHECK-NEXT: vsetvli a0, zero, e16, m8, ta, ma
468 ; CHECK-NEXT: vadd.vi v8, v8, -1
470 %head = insertelement <vscale x 32 x i16> poison, i16 -1, i32 0
471 %splat = shufflevector <vscale x 32 x i16> %head, <vscale x 32 x i16> poison, <vscale x 32 x i32> zeroinitializer
472 %vc = add <vscale x 32 x i16> %va, %splat
473 ret <vscale x 32 x i16> %vc
476 define <vscale x 32 x i16> @vadd_vx_nxv32i16_1(<vscale x 32 x i16> %va) {
477 ; CHECK-LABEL: vadd_vx_nxv32i16_1:
479 ; CHECK-NEXT: vsetvli a0, zero, e16, m8, ta, ma
480 ; CHECK-NEXT: vadd.vi v8, v8, 2
482 %head = insertelement <vscale x 32 x i16> poison, i16 2, i32 0
483 %splat = shufflevector <vscale x 32 x i16> %head, <vscale x 32 x i16> poison, <vscale x 32 x i32> zeroinitializer
484 %vc = add <vscale x 32 x i16> %va, %splat
485 ret <vscale x 32 x i16> %vc
488 define <vscale x 1 x i32> @vadd_vx_nxv1i32(<vscale x 1 x i32> %va, i32 signext %b) {
489 ; CHECK-LABEL: vadd_vx_nxv1i32:
491 ; CHECK-NEXT: vsetvli a1, zero, e32, mf2, ta, ma
492 ; CHECK-NEXT: vadd.vx v8, v8, a0
494 %head = insertelement <vscale x 1 x i32> poison, i32 %b, i32 0
495 %splat = shufflevector <vscale x 1 x i32> %head, <vscale x 1 x i32> poison, <vscale x 1 x i32> zeroinitializer
496 %vc = add <vscale x 1 x i32> %va, %splat
497 ret <vscale x 1 x i32> %vc
500 define <vscale x 1 x i32> @vadd_vx_nxv1i32_0(<vscale x 1 x i32> %va) {
501 ; CHECK-LABEL: vadd_vx_nxv1i32_0:
503 ; CHECK-NEXT: vsetvli a0, zero, e32, mf2, ta, ma
504 ; CHECK-NEXT: vadd.vi v8, v8, -1
506 %head = insertelement <vscale x 1 x i32> poison, i32 -1, i32 0
507 %splat = shufflevector <vscale x 1 x i32> %head, <vscale x 1 x i32> poison, <vscale x 1 x i32> zeroinitializer
508 %vc = add <vscale x 1 x i32> %va, %splat
509 ret <vscale x 1 x i32> %vc
512 define <vscale x 1 x i32> @vadd_vx_nxv1i32_1(<vscale x 1 x i32> %va) {
513 ; CHECK-LABEL: vadd_vx_nxv1i32_1:
515 ; CHECK-NEXT: vsetvli a0, zero, e32, mf2, ta, ma
516 ; CHECK-NEXT: vadd.vi v8, v8, 2
518 %head = insertelement <vscale x 1 x i32> poison, i32 2, i32 0
519 %splat = shufflevector <vscale x 1 x i32> %head, <vscale x 1 x i32> poison, <vscale x 1 x i32> zeroinitializer
520 %vc = add <vscale x 1 x i32> %va, %splat
521 ret <vscale x 1 x i32> %vc
524 define <vscale x 2 x i32> @vadd_vx_nxv2i32(<vscale x 2 x i32> %va, i32 signext %b) {
525 ; CHECK-LABEL: vadd_vx_nxv2i32:
527 ; CHECK-NEXT: vsetvli a1, zero, e32, m1, ta, ma
528 ; CHECK-NEXT: vadd.vx v8, v8, a0
530 %head = insertelement <vscale x 2 x i32> poison, i32 %b, i32 0
531 %splat = shufflevector <vscale x 2 x i32> %head, <vscale x 2 x i32> poison, <vscale x 2 x i32> zeroinitializer
532 %vc = add <vscale x 2 x i32> %va, %splat
533 ret <vscale x 2 x i32> %vc
536 define <vscale x 2 x i32> @vadd_vx_nxv2i32_0(<vscale x 2 x i32> %va) {
537 ; CHECK-LABEL: vadd_vx_nxv2i32_0:
539 ; CHECK-NEXT: vsetvli a0, zero, e32, m1, ta, ma
540 ; CHECK-NEXT: vadd.vi v8, v8, -1
542 %head = insertelement <vscale x 2 x i32> poison, i32 -1, i32 0
543 %splat = shufflevector <vscale x 2 x i32> %head, <vscale x 2 x i32> poison, <vscale x 2 x i32> zeroinitializer
544 %vc = add <vscale x 2 x i32> %va, %splat
545 ret <vscale x 2 x i32> %vc
548 define <vscale x 2 x i32> @vadd_vx_nxv2i32_1(<vscale x 2 x i32> %va) {
549 ; CHECK-LABEL: vadd_vx_nxv2i32_1:
551 ; CHECK-NEXT: vsetvli a0, zero, e32, m1, ta, ma
552 ; CHECK-NEXT: vadd.vi v8, v8, 2
554 %head = insertelement <vscale x 2 x i32> poison, i32 2, i32 0
555 %splat = shufflevector <vscale x 2 x i32> %head, <vscale x 2 x i32> poison, <vscale x 2 x i32> zeroinitializer
556 %vc = add <vscale x 2 x i32> %va, %splat
557 ret <vscale x 2 x i32> %vc
560 define <vscale x 4 x i32> @vadd_vx_nxv4i32(<vscale x 4 x i32> %va, i32 signext %b) {
561 ; CHECK-LABEL: vadd_vx_nxv4i32:
563 ; CHECK-NEXT: vsetvli a1, zero, e32, m2, ta, ma
564 ; CHECK-NEXT: vadd.vx v8, v8, a0
566 %head = insertelement <vscale x 4 x i32> poison, i32 %b, i32 0
567 %splat = shufflevector <vscale x 4 x i32> %head, <vscale x 4 x i32> poison, <vscale x 4 x i32> zeroinitializer
568 %vc = add <vscale x 4 x i32> %va, %splat
569 ret <vscale x 4 x i32> %vc
572 define <vscale x 4 x i32> @vadd_vx_nxv4i32_0(<vscale x 4 x i32> %va) {
573 ; CHECK-LABEL: vadd_vx_nxv4i32_0:
575 ; CHECK-NEXT: vsetvli a0, zero, e32, m2, ta, ma
576 ; CHECK-NEXT: vadd.vi v8, v8, -1
578 %head = insertelement <vscale x 4 x i32> poison, i32 -1, i32 0
579 %splat = shufflevector <vscale x 4 x i32> %head, <vscale x 4 x i32> poison, <vscale x 4 x i32> zeroinitializer
580 %vc = add <vscale x 4 x i32> %va, %splat
581 ret <vscale x 4 x i32> %vc
584 define <vscale x 4 x i32> @vadd_vx_nxv4i32_1(<vscale x 4 x i32> %va) {
585 ; CHECK-LABEL: vadd_vx_nxv4i32_1:
587 ; CHECK-NEXT: vsetvli a0, zero, e32, m2, ta, ma
588 ; CHECK-NEXT: vadd.vi v8, v8, 2
590 %head = insertelement <vscale x 4 x i32> poison, i32 2, i32 0
591 %splat = shufflevector <vscale x 4 x i32> %head, <vscale x 4 x i32> poison, <vscale x 4 x i32> zeroinitializer
592 %vc = add <vscale x 4 x i32> %va, %splat
593 ret <vscale x 4 x i32> %vc
596 define <vscale x 8 x i32> @vadd_vx_nxv8i32(<vscale x 8 x i32> %va, i32 signext %b) {
597 ; CHECK-LABEL: vadd_vx_nxv8i32:
599 ; CHECK-NEXT: vsetvli a1, zero, e32, m4, ta, ma
600 ; CHECK-NEXT: vadd.vx v8, v8, a0
602 %head = insertelement <vscale x 8 x i32> poison, i32 %b, i32 0
603 %splat = shufflevector <vscale x 8 x i32> %head, <vscale x 8 x i32> poison, <vscale x 8 x i32> zeroinitializer
604 %vc = add <vscale x 8 x i32> %va, %splat
605 ret <vscale x 8 x i32> %vc
608 define <vscale x 8 x i32> @vadd_vx_nxv8i32_0(<vscale x 8 x i32> %va) {
609 ; CHECK-LABEL: vadd_vx_nxv8i32_0:
611 ; CHECK-NEXT: vsetvli a0, zero, e32, m4, ta, ma
612 ; CHECK-NEXT: vadd.vi v8, v8, -1
614 %head = insertelement <vscale x 8 x i32> poison, i32 -1, i32 0
615 %splat = shufflevector <vscale x 8 x i32> %head, <vscale x 8 x i32> poison, <vscale x 8 x i32> zeroinitializer
616 %vc = add <vscale x 8 x i32> %va, %splat
617 ret <vscale x 8 x i32> %vc
620 define <vscale x 8 x i32> @vadd_vx_nxv8i32_1(<vscale x 8 x i32> %va) {
621 ; CHECK-LABEL: vadd_vx_nxv8i32_1:
623 ; CHECK-NEXT: vsetvli a0, zero, e32, m4, ta, ma
624 ; CHECK-NEXT: vadd.vi v8, v8, 2
626 %head = insertelement <vscale x 8 x i32> poison, i32 2, i32 0
627 %splat = shufflevector <vscale x 8 x i32> %head, <vscale x 8 x i32> poison, <vscale x 8 x i32> zeroinitializer
628 %vc = add <vscale x 8 x i32> %va, %splat
629 ret <vscale x 8 x i32> %vc
632 define <vscale x 16 x i32> @vadd_vx_nxv16i32(<vscale x 16 x i32> %va, i32 signext %b) {
633 ; CHECK-LABEL: vadd_vx_nxv16i32:
635 ; CHECK-NEXT: vsetvli a1, zero, e32, m8, ta, ma
636 ; CHECK-NEXT: vadd.vx v8, v8, a0
638 %head = insertelement <vscale x 16 x i32> poison, i32 %b, i32 0
639 %splat = shufflevector <vscale x 16 x i32> %head, <vscale x 16 x i32> poison, <vscale x 16 x i32> zeroinitializer
640 %vc = add <vscale x 16 x i32> %va, %splat
641 ret <vscale x 16 x i32> %vc
644 define <vscale x 16 x i32> @vadd_vx_nxv16i32_0(<vscale x 16 x i32> %va) {
645 ; CHECK-LABEL: vadd_vx_nxv16i32_0:
647 ; CHECK-NEXT: vsetvli a0, zero, e32, m8, ta, ma
648 ; CHECK-NEXT: vadd.vi v8, v8, -1
650 %head = insertelement <vscale x 16 x i32> poison, i32 -1, i32 0
651 %splat = shufflevector <vscale x 16 x i32> %head, <vscale x 16 x i32> poison, <vscale x 16 x i32> zeroinitializer
652 %vc = add <vscale x 16 x i32> %va, %splat
653 ret <vscale x 16 x i32> %vc
656 define <vscale x 16 x i32> @vadd_vx_nxv16i32_1(<vscale x 16 x i32> %va) {
657 ; CHECK-LABEL: vadd_vx_nxv16i32_1:
659 ; CHECK-NEXT: vsetvli a0, zero, e32, m8, ta, ma
660 ; CHECK-NEXT: vadd.vi v8, v8, 2
662 %head = insertelement <vscale x 16 x i32> poison, i32 2, i32 0
663 %splat = shufflevector <vscale x 16 x i32> %head, <vscale x 16 x i32> poison, <vscale x 16 x i32> zeroinitializer
664 %vc = add <vscale x 16 x i32> %va, %splat
665 ret <vscale x 16 x i32> %vc
668 define <vscale x 1 x i64> @vadd_vx_nxv1i64(<vscale x 1 x i64> %va, i64 %b) {
669 ; RV32-LABEL: vadd_vx_nxv1i64:
671 ; RV32-NEXT: addi sp, sp, -16
672 ; RV32-NEXT: .cfi_def_cfa_offset 16
673 ; RV32-NEXT: sw a1, 12(sp)
674 ; RV32-NEXT: sw a0, 8(sp)
675 ; RV32-NEXT: addi a0, sp, 8
676 ; RV32-NEXT: vsetvli a1, zero, e64, m1, ta, ma
677 ; RV32-NEXT: vlse64.v v9, (a0), zero
678 ; RV32-NEXT: vadd.vv v8, v8, v9
679 ; RV32-NEXT: addi sp, sp, 16
682 ; RV64-LABEL: vadd_vx_nxv1i64:
684 ; RV64-NEXT: vsetvli a1, zero, e64, m1, ta, ma
685 ; RV64-NEXT: vadd.vx v8, v8, a0
687 %head = insertelement <vscale x 1 x i64> poison, i64 %b, i32 0
688 %splat = shufflevector <vscale x 1 x i64> %head, <vscale x 1 x i64> poison, <vscale x 1 x i32> zeroinitializer
689 %vc = add <vscale x 1 x i64> %va, %splat
690 ret <vscale x 1 x i64> %vc
693 define <vscale x 1 x i64> @vadd_vx_nxv1i64_0(<vscale x 1 x i64> %va) {
694 ; CHECK-LABEL: vadd_vx_nxv1i64_0:
696 ; CHECK-NEXT: vsetvli a0, zero, e64, m1, ta, ma
697 ; CHECK-NEXT: vadd.vi v8, v8, -1
699 %head = insertelement <vscale x 1 x i64> poison, i64 -1, i32 0
700 %splat = shufflevector <vscale x 1 x i64> %head, <vscale x 1 x i64> poison, <vscale x 1 x i32> zeroinitializer
701 %vc = add <vscale x 1 x i64> %va, %splat
702 ret <vscale x 1 x i64> %vc
705 define <vscale x 1 x i64> @vadd_vx_nxv1i64_1(<vscale x 1 x i64> %va) {
706 ; CHECK-LABEL: vadd_vx_nxv1i64_1:
708 ; CHECK-NEXT: vsetvli a0, zero, e64, m1, ta, ma
709 ; CHECK-NEXT: vadd.vi v8, v8, 2
711 %head = insertelement <vscale x 1 x i64> poison, i64 2, i32 0
712 %splat = shufflevector <vscale x 1 x i64> %head, <vscale x 1 x i64> poison, <vscale x 1 x i32> zeroinitializer
713 %vc = add <vscale x 1 x i64> %va, %splat
714 ret <vscale x 1 x i64> %vc
717 define <vscale x 2 x i64> @vadd_vx_nxv2i64(<vscale x 2 x i64> %va, i64 %b) {
718 ; RV32-LABEL: vadd_vx_nxv2i64:
720 ; RV32-NEXT: addi sp, sp, -16
721 ; RV32-NEXT: .cfi_def_cfa_offset 16
722 ; RV32-NEXT: sw a1, 12(sp)
723 ; RV32-NEXT: sw a0, 8(sp)
724 ; RV32-NEXT: addi a0, sp, 8
725 ; RV32-NEXT: vsetvli a1, zero, e64, m2, ta, ma
726 ; RV32-NEXT: vlse64.v v10, (a0), zero
727 ; RV32-NEXT: vadd.vv v8, v8, v10
728 ; RV32-NEXT: addi sp, sp, 16
731 ; RV64-LABEL: vadd_vx_nxv2i64:
733 ; RV64-NEXT: vsetvli a1, zero, e64, m2, ta, ma
734 ; RV64-NEXT: vadd.vx v8, v8, a0
736 %head = insertelement <vscale x 2 x i64> poison, i64 %b, i32 0
737 %splat = shufflevector <vscale x 2 x i64> %head, <vscale x 2 x i64> poison, <vscale x 2 x i32> zeroinitializer
738 %vc = add <vscale x 2 x i64> %va, %splat
739 ret <vscale x 2 x i64> %vc
742 define <vscale x 2 x i64> @vadd_vx_nxv2i64_0(<vscale x 2 x i64> %va) {
743 ; CHECK-LABEL: vadd_vx_nxv2i64_0:
745 ; CHECK-NEXT: vsetvli a0, zero, e64, m2, ta, ma
746 ; CHECK-NEXT: vadd.vi v8, v8, -1
748 %head = insertelement <vscale x 2 x i64> poison, i64 -1, i32 0
749 %splat = shufflevector <vscale x 2 x i64> %head, <vscale x 2 x i64> poison, <vscale x 2 x i32> zeroinitializer
750 %vc = add <vscale x 2 x i64> %va, %splat
751 ret <vscale x 2 x i64> %vc
754 define <vscale x 2 x i64> @vadd_vx_nxv2i64_1(<vscale x 2 x i64> %va) {
755 ; CHECK-LABEL: vadd_vx_nxv2i64_1:
757 ; CHECK-NEXT: vsetvli a0, zero, e64, m2, ta, ma
758 ; CHECK-NEXT: vadd.vi v8, v8, 2
760 %head = insertelement <vscale x 2 x i64> poison, i64 2, i32 0
761 %splat = shufflevector <vscale x 2 x i64> %head, <vscale x 2 x i64> poison, <vscale x 2 x i32> zeroinitializer
762 %vc = add <vscale x 2 x i64> %va, %splat
763 ret <vscale x 2 x i64> %vc
766 define <vscale x 4 x i64> @vadd_vx_nxv4i64(<vscale x 4 x i64> %va, i64 %b) {
767 ; RV32-LABEL: vadd_vx_nxv4i64:
769 ; RV32-NEXT: addi sp, sp, -16
770 ; RV32-NEXT: .cfi_def_cfa_offset 16
771 ; RV32-NEXT: sw a1, 12(sp)
772 ; RV32-NEXT: sw a0, 8(sp)
773 ; RV32-NEXT: addi a0, sp, 8
774 ; RV32-NEXT: vsetvli a1, zero, e64, m4, ta, ma
775 ; RV32-NEXT: vlse64.v v12, (a0), zero
776 ; RV32-NEXT: vadd.vv v8, v8, v12
777 ; RV32-NEXT: addi sp, sp, 16
780 ; RV64-LABEL: vadd_vx_nxv4i64:
782 ; RV64-NEXT: vsetvli a1, zero, e64, m4, ta, ma
783 ; RV64-NEXT: vadd.vx v8, v8, a0
785 %head = insertelement <vscale x 4 x i64> poison, i64 %b, i32 0
786 %splat = shufflevector <vscale x 4 x i64> %head, <vscale x 4 x i64> poison, <vscale x 4 x i32> zeroinitializer
787 %vc = add <vscale x 4 x i64> %va, %splat
788 ret <vscale x 4 x i64> %vc
791 define <vscale x 4 x i64> @vadd_vx_nxv4i64_0(<vscale x 4 x i64> %va) {
792 ; CHECK-LABEL: vadd_vx_nxv4i64_0:
794 ; CHECK-NEXT: vsetvli a0, zero, e64, m4, ta, ma
795 ; CHECK-NEXT: vadd.vi v8, v8, -1
797 %head = insertelement <vscale x 4 x i64> poison, i64 -1, i32 0
798 %splat = shufflevector <vscale x 4 x i64> %head, <vscale x 4 x i64> poison, <vscale x 4 x i32> zeroinitializer
799 %vc = add <vscale x 4 x i64> %va, %splat
800 ret <vscale x 4 x i64> %vc
803 define <vscale x 4 x i64> @vadd_vx_nxv4i64_1(<vscale x 4 x i64> %va) {
804 ; CHECK-LABEL: vadd_vx_nxv4i64_1:
806 ; CHECK-NEXT: vsetvli a0, zero, e64, m4, ta, ma
807 ; CHECK-NEXT: vadd.vi v8, v8, 2
809 %head = insertelement <vscale x 4 x i64> poison, i64 2, i32 0
810 %splat = shufflevector <vscale x 4 x i64> %head, <vscale x 4 x i64> poison, <vscale x 4 x i32> zeroinitializer
811 %vc = add <vscale x 4 x i64> %va, %splat
812 ret <vscale x 4 x i64> %vc
815 define <vscale x 8 x i64> @vadd_vx_nxv8i64(<vscale x 8 x i64> %va, i64 %b) {
816 ; RV32-LABEL: vadd_vx_nxv8i64:
818 ; RV32-NEXT: addi sp, sp, -16
819 ; RV32-NEXT: .cfi_def_cfa_offset 16
820 ; RV32-NEXT: sw a1, 12(sp)
821 ; RV32-NEXT: sw a0, 8(sp)
822 ; RV32-NEXT: addi a0, sp, 8
823 ; RV32-NEXT: vsetvli a1, zero, e64, m8, ta, ma
824 ; RV32-NEXT: vlse64.v v16, (a0), zero
825 ; RV32-NEXT: vadd.vv v8, v8, v16
826 ; RV32-NEXT: addi sp, sp, 16
829 ; RV64-LABEL: vadd_vx_nxv8i64:
831 ; RV64-NEXT: vsetvli a1, zero, e64, m8, ta, ma
832 ; RV64-NEXT: vadd.vx v8, v8, a0
834 %head = insertelement <vscale x 8 x i64> poison, i64 %b, i32 0
835 %splat = shufflevector <vscale x 8 x i64> %head, <vscale x 8 x i64> poison, <vscale x 8 x i32> zeroinitializer
836 %vc = add <vscale x 8 x i64> %va, %splat
837 ret <vscale x 8 x i64> %vc
840 define <vscale x 8 x i64> @vadd_vx_nxv8i64_0(<vscale x 8 x i64> %va) {
841 ; CHECK-LABEL: vadd_vx_nxv8i64_0:
843 ; CHECK-NEXT: vsetvli a0, zero, e64, m8, ta, ma
844 ; CHECK-NEXT: vadd.vi v8, v8, -1
846 %head = insertelement <vscale x 8 x i64> poison, i64 -1, i32 0
847 %splat = shufflevector <vscale x 8 x i64> %head, <vscale x 8 x i64> poison, <vscale x 8 x i32> zeroinitializer
848 %vc = add <vscale x 8 x i64> %va, %splat
849 ret <vscale x 8 x i64> %vc
852 define <vscale x 8 x i64> @vadd_vx_nxv8i64_1(<vscale x 8 x i64> %va) {
853 ; CHECK-LABEL: vadd_vx_nxv8i64_1:
855 ; CHECK-NEXT: vsetvli a0, zero, e64, m8, ta, ma
856 ; CHECK-NEXT: vadd.vi v8, v8, 2
858 %head = insertelement <vscale x 8 x i64> poison, i64 2, i32 0
859 %splat = shufflevector <vscale x 8 x i64> %head, <vscale x 8 x i64> poison, <vscale x 8 x i32> zeroinitializer
860 %vc = add <vscale x 8 x i64> %va, %splat
861 ret <vscale x 8 x i64> %vc
864 define <vscale x 8 x i64> @vadd_xx_nxv8i64(i64 %a, i64 %b) nounwind {
865 ; RV32-LABEL: vadd_xx_nxv8i64:
867 ; RV32-NEXT: addi sp, sp, -16
868 ; RV32-NEXT: sw a1, 12(sp)
869 ; RV32-NEXT: sw a0, 8(sp)
870 ; RV32-NEXT: addi a0, sp, 8
871 ; RV32-NEXT: vsetvli a1, zero, e64, m8, ta, ma
872 ; RV32-NEXT: vlse64.v v8, (a0), zero
873 ; RV32-NEXT: sw a3, 4(sp)
874 ; RV32-NEXT: sw a2, 0(sp)
875 ; RV32-NEXT: mv a0, sp
876 ; RV32-NEXT: vlse64.v v16, (a0), zero
877 ; RV32-NEXT: vadd.vv v8, v8, v16
878 ; RV32-NEXT: addi sp, sp, 16
881 ; RV64-LABEL: vadd_xx_nxv8i64:
883 ; RV64-NEXT: add a0, a0, a1
884 ; RV64-NEXT: vsetvli a1, zero, e64, m8, ta, ma
885 ; RV64-NEXT: vmv.v.x v8, a0
887 %head1 = insertelement <vscale x 8 x i64> poison, i64 %a, i32 0
888 %splat1 = shufflevector <vscale x 8 x i64> %head1, <vscale x 8 x i64> poison, <vscale x 8 x i32> zeroinitializer
889 %head2 = insertelement <vscale x 8 x i64> poison, i64 %b, i32 0
890 %splat2 = shufflevector <vscale x 8 x i64> %head2, <vscale x 8 x i64> poison, <vscale x 8 x i32> zeroinitializer
891 %v = add <vscale x 8 x i64> %splat1, %splat2
892 ret <vscale x 8 x i64> %v
895 define <vscale x 8 x i32> @vadd_vv_mask_nxv8i32(<vscale x 8 x i32> %va, <vscale x 8 x i32> %vb, <vscale x 8 x i1> %mask) {
896 ; CHECK-LABEL: vadd_vv_mask_nxv8i32:
898 ; CHECK-NEXT: vsetvli a0, zero, e32, m4, ta, mu
899 ; CHECK-NEXT: vadd.vv v8, v8, v12, v0.t
901 %vs = select <vscale x 8 x i1> %mask, <vscale x 8 x i32> %vb, <vscale x 8 x i32> zeroinitializer
902 %vc = add <vscale x 8 x i32> %va, %vs
903 ret <vscale x 8 x i32> %vc
906 define <vscale x 8 x i32> @vadd_vx_mask_nxv8i32(<vscale x 8 x i32> %va, i32 signext %b, <vscale x 8 x i1> %mask) {
907 ; CHECK-LABEL: vadd_vx_mask_nxv8i32:
909 ; CHECK-NEXT: vsetvli a1, zero, e32, m4, ta, mu
910 ; CHECK-NEXT: vadd.vx v8, v8, a0, v0.t
912 %head = insertelement <vscale x 8 x i32> poison, i32 %b, i32 0
913 %splat = shufflevector <vscale x 8 x i32> %head, <vscale x 8 x i32> poison, <vscale x 8 x i32> zeroinitializer
914 %vs = select <vscale x 8 x i1> %mask, <vscale x 8 x i32> %splat, <vscale x 8 x i32> zeroinitializer
915 %vc = add <vscale x 8 x i32> %va, %vs
916 ret <vscale x 8 x i32> %vc
919 define <vscale x 8 x i32> @vadd_vi_mask_nxv8i32(<vscale x 8 x i32> %va, <vscale x 8 x i1> %mask) {
920 ; CHECK-LABEL: vadd_vi_mask_nxv8i32:
922 ; CHECK-NEXT: vsetvli a0, zero, e32, m4, ta, mu
923 ; CHECK-NEXT: vadd.vi v8, v8, 7, v0.t
925 %head = insertelement <vscale x 8 x i32> poison, i32 7, i32 0
926 %splat = shufflevector <vscale x 8 x i32> %head, <vscale x 8 x i32> poison, <vscale x 8 x i32> zeroinitializer
927 %vs = select <vscale x 8 x i1> %mask, <vscale x 8 x i32> %splat, <vscale x 8 x i32> zeroinitializer
928 %vc = add <vscale x 8 x i32> %va, %vs
929 ret <vscale x 8 x i32> %vc
932 define <vscale x 8 x i32> @vadd_vv_mask_negative0_nxv8i32(<vscale x 8 x i32> %va, <vscale x 8 x i32> %vb, <vscale x 8 x i1> %mask) {
933 ; CHECK-LABEL: vadd_vv_mask_negative0_nxv8i32:
935 ; CHECK-NEXT: vsetvli a0, zero, e32, m4, ta, ma
936 ; CHECK-NEXT: vmv.v.i v16, 1
937 ; CHECK-NEXT: vmerge.vvm v12, v16, v12, v0
938 ; CHECK-NEXT: vadd.vv v8, v8, v12
940 %head = insertelement <vscale x 8 x i32> poison, i32 1, i32 0
941 %one = shufflevector <vscale x 8 x i32> %head, <vscale x 8 x i32> poison, <vscale x 8 x i32> zeroinitializer
942 %vs = select <vscale x 8 x i1> %mask, <vscale x 8 x i32> %vb, <vscale x 8 x i32> %one
943 %vc = add <vscale x 8 x i32> %va, %vs
944 ret <vscale x 8 x i32> %vc
947 define <vscale x 8 x i32> @vadd_vv_mask_negative1_nxv8i32(<vscale x 8 x i32> %va, <vscale x 8 x i32> %vb, <vscale x 8 x i1> %mask) {
948 ; CHECK-LABEL: vadd_vv_mask_negative1_nxv8i32:
950 ; CHECK-NEXT: vsetvli a0, zero, e32, m4, ta, ma
951 ; CHECK-NEXT: vmv.v.i v16, 0
952 ; CHECK-NEXT: vmerge.vvm v12, v16, v12, v0
953 ; CHECK-NEXT: vadd.vv v8, v8, v12
954 ; CHECK-NEXT: vadd.vv v8, v8, v12
956 %vs = select <vscale x 8 x i1> %mask, <vscale x 8 x i32> %vb, <vscale x 8 x i32> zeroinitializer
957 %vc = add <vscale x 8 x i32> %va, %vs
958 %vd = add <vscale x 8 x i32> %vc, %vs
959 ret <vscale x 8 x i32> %vd