1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 3
2 ; RUN: llc < %s -mtriple=riscv32 -mattr=+v,+zfh,+zvfh -verify-machineinstrs | FileCheck %s -check-prefixes=CHECK,RV32
3 ; RUN: llc < %s -mtriple=riscv64 -mattr=+v,+zfh,+zvfh -verify-machineinstrs | FileCheck %s -check-prefixes=CHECK,RV64
5 define <vscale x 1 x i1> @nxv1i1(i1 %x, i1 %y) {
8 ; CHECK-NEXT: andi a0, a0, 1
9 ; CHECK-NEXT: vsetvli a2, zero, e8, mf8, ta, ma
10 ; CHECK-NEXT: vmv.v.x v8, a0
11 ; CHECK-NEXT: vmsne.vi v8, v8, 0
12 ; CHECK-NEXT: andi a1, a1, 1
13 ; CHECK-NEXT: vmv.v.x v9, a1
14 ; CHECK-NEXT: vmsne.vi v9, v9, 0
15 ; CHECK-NEXT: vmxor.mm v0, v8, v9
17 %head.x = insertelement <vscale x 1 x i1> poison, i1 %x, i32 0
18 %splat.x = shufflevector <vscale x 1 x i1> %head.x, <vscale x 1 x i1> poison, <vscale x 1 x i32> zeroinitializer
19 %head.y = insertelement <vscale x 1 x i1> poison, i1 %y, i32 0
20 %splat.y = shufflevector <vscale x 1 x i1> %head.y, <vscale x 1 x i1> poison, <vscale x 1 x i32> zeroinitializer
21 %v = add <vscale x 1 x i1> %splat.x, %splat.y
22 ret <vscale x 1 x i1> %v
25 define <vscale x 2 x i1> @nxv2i1(i1 %x, i1 %y) {
26 ; CHECK-LABEL: nxv2i1:
28 ; CHECK-NEXT: andi a0, a0, 1
29 ; CHECK-NEXT: vsetvli a2, zero, e8, mf4, ta, ma
30 ; CHECK-NEXT: vmv.v.x v8, a0
31 ; CHECK-NEXT: vmsne.vi v8, v8, 0
32 ; CHECK-NEXT: andi a1, a1, 1
33 ; CHECK-NEXT: vmv.v.x v9, a1
34 ; CHECK-NEXT: vmsne.vi v9, v9, 0
35 ; CHECK-NEXT: vmxor.mm v0, v8, v9
37 %head.x = insertelement <vscale x 2 x i1> poison, i1 %x, i32 0
38 %splat.x = shufflevector <vscale x 2 x i1> %head.x, <vscale x 2 x i1> poison, <vscale x 2 x i32> zeroinitializer
39 %head.y = insertelement <vscale x 2 x i1> poison, i1 %y, i32 0
40 %splat.y = shufflevector <vscale x 2 x i1> %head.y, <vscale x 2 x i1> poison, <vscale x 2 x i32> zeroinitializer
41 %v = add <vscale x 2 x i1> %splat.x, %splat.y
42 ret <vscale x 2 x i1> %v
45 define <vscale x 4 x i1> @nxv4i1(i1 %x, i1 %y) {
46 ; CHECK-LABEL: nxv4i1:
48 ; CHECK-NEXT: andi a0, a0, 1
49 ; CHECK-NEXT: vsetvli a2, zero, e8, mf2, ta, ma
50 ; CHECK-NEXT: vmv.v.x v8, a0
51 ; CHECK-NEXT: vmsne.vi v8, v8, 0
52 ; CHECK-NEXT: andi a1, a1, 1
53 ; CHECK-NEXT: vmv.v.x v9, a1
54 ; CHECK-NEXT: vmsne.vi v9, v9, 0
55 ; CHECK-NEXT: vmxor.mm v0, v8, v9
57 %head.x = insertelement <vscale x 4 x i1> poison, i1 %x, i32 0
58 %splat.x = shufflevector <vscale x 4 x i1> %head.x, <vscale x 4 x i1> poison, <vscale x 4 x i32> zeroinitializer
59 %head.y = insertelement <vscale x 4 x i1> poison, i1 %y, i32 0
60 %splat.y = shufflevector <vscale x 4 x i1> %head.y, <vscale x 4 x i1> poison, <vscale x 4 x i32> zeroinitializer
61 %v = add <vscale x 4 x i1> %splat.x, %splat.y
62 ret <vscale x 4 x i1> %v
65 define <vscale x 8 x i1> @nxv8i1(i1 %x, i1 %y) {
66 ; CHECK-LABEL: nxv8i1:
68 ; CHECK-NEXT: andi a0, a0, 1
69 ; CHECK-NEXT: vsetvli a2, zero, e8, m1, ta, ma
70 ; CHECK-NEXT: vmv.v.x v8, a0
71 ; CHECK-NEXT: vmsne.vi v8, v8, 0
72 ; CHECK-NEXT: andi a1, a1, 1
73 ; CHECK-NEXT: vmv.v.x v9, a1
74 ; CHECK-NEXT: vmsne.vi v9, v9, 0
75 ; CHECK-NEXT: vmxor.mm v0, v8, v9
77 %head.x = insertelement <vscale x 8 x i1> poison, i1 %x, i32 0
78 %splat.x = shufflevector <vscale x 8 x i1> %head.x, <vscale x 8 x i1> poison, <vscale x 8 x i32> zeroinitializer
79 %head.y = insertelement <vscale x 8 x i1> poison, i1 %y, i32 0
80 %splat.y = shufflevector <vscale x 8 x i1> %head.y, <vscale x 8 x i1> poison, <vscale x 8 x i32> zeroinitializer
81 %v = add <vscale x 8 x i1> %splat.x, %splat.y
82 ret <vscale x 8 x i1> %v
85 define <vscale x 16 x i1> @nxv16i1(i1 %x, i1 %y) {
86 ; CHECK-LABEL: nxv16i1:
88 ; CHECK-NEXT: andi a0, a0, 1
89 ; CHECK-NEXT: vsetvli a2, zero, e8, m2, ta, ma
90 ; CHECK-NEXT: vmv.v.x v8, a0
91 ; CHECK-NEXT: vmsne.vi v10, v8, 0
92 ; CHECK-NEXT: andi a1, a1, 1
93 ; CHECK-NEXT: vmv.v.x v8, a1
94 ; CHECK-NEXT: vmsne.vi v11, v8, 0
95 ; CHECK-NEXT: vmxor.mm v0, v10, v11
97 %head.x = insertelement <vscale x 16 x i1> poison, i1 %x, i32 0
98 %splat.x = shufflevector <vscale x 16 x i1> %head.x, <vscale x 16 x i1> poison, <vscale x 16 x i32> zeroinitializer
99 %head.y = insertelement <vscale x 16 x i1> poison, i1 %y, i32 0
100 %splat.y = shufflevector <vscale x 16 x i1> %head.y, <vscale x 16 x i1> poison, <vscale x 16 x i32> zeroinitializer
101 %v = add <vscale x 16 x i1> %splat.x, %splat.y
102 ret <vscale x 16 x i1> %v
105 define <vscale x 32 x i1> @nxv32i1(i1 %x, i1 %y) {
106 ; CHECK-LABEL: nxv32i1:
108 ; CHECK-NEXT: andi a0, a0, 1
109 ; CHECK-NEXT: vsetvli a2, zero, e8, m4, ta, ma
110 ; CHECK-NEXT: vmv.v.x v8, a0
111 ; CHECK-NEXT: vmsne.vi v12, v8, 0
112 ; CHECK-NEXT: andi a1, a1, 1
113 ; CHECK-NEXT: vmv.v.x v8, a1
114 ; CHECK-NEXT: vmsne.vi v13, v8, 0
115 ; CHECK-NEXT: vmxor.mm v0, v12, v13
117 %head.x = insertelement <vscale x 32 x i1> poison, i1 %x, i32 0
118 %splat.x = shufflevector <vscale x 32 x i1> %head.x, <vscale x 32 x i1> poison, <vscale x 32 x i32> zeroinitializer
119 %head.y = insertelement <vscale x 32 x i1> poison, i1 %y, i32 0
120 %splat.y = shufflevector <vscale x 32 x i1> %head.y, <vscale x 32 x i1> poison, <vscale x 32 x i32> zeroinitializer
121 %v = add <vscale x 32 x i1> %splat.x, %splat.y
122 ret <vscale x 32 x i1> %v
125 define <vscale x 64 x i1> @nxv64i1(i1 %x, i1 %y) {
126 ; CHECK-LABEL: nxv64i1:
128 ; CHECK-NEXT: andi a0, a0, 1
129 ; CHECK-NEXT: vsetvli a2, zero, e8, m8, ta, ma
130 ; CHECK-NEXT: vmv.v.x v8, a0
131 ; CHECK-NEXT: vmsne.vi v16, v8, 0
132 ; CHECK-NEXT: andi a1, a1, 1
133 ; CHECK-NEXT: vmv.v.x v8, a1
134 ; CHECK-NEXT: vmsne.vi v17, v8, 0
135 ; CHECK-NEXT: vmxor.mm v0, v16, v17
137 %head.x = insertelement <vscale x 64 x i1> poison, i1 %x, i32 0
138 %splat.x = shufflevector <vscale x 64 x i1> %head.x, <vscale x 64 x i1> poison, <vscale x 64 x i32> zeroinitializer
139 %head.y = insertelement <vscale x 64 x i1> poison, i1 %y, i32 0
140 %splat.y = shufflevector <vscale x 64 x i1> %head.y, <vscale x 64 x i1> poison, <vscale x 64 x i32> zeroinitializer
141 %v = add <vscale x 64 x i1> %splat.x, %splat.y
142 ret <vscale x 64 x i1> %v
145 define <vscale x 1 x i8> @nxv1i8(i8 %x, i8 %y) {
146 ; CHECK-LABEL: nxv1i8:
148 ; CHECK-NEXT: vsetvli a2, zero, e8, mf8, ta, ma
149 ; CHECK-NEXT: vmv.v.x v8, a0
150 ; CHECK-NEXT: vadd.vx v8, v8, a1
152 %head.x = insertelement <vscale x 1 x i8> poison, i8 %x, i32 0
153 %splat.x = shufflevector <vscale x 1 x i8> %head.x, <vscale x 1 x i8> poison, <vscale x 1 x i32> zeroinitializer
154 %head.y = insertelement <vscale x 1 x i8> poison, i8 %y, i32 0
155 %splat.y = shufflevector <vscale x 1 x i8> %head.y, <vscale x 1 x i8> poison, <vscale x 1 x i32> zeroinitializer
156 %v = add <vscale x 1 x i8> %splat.x, %splat.y
157 ret <vscale x 1 x i8> %v
160 define <vscale x 2 x i8> @nxv2i8(i8 %x, i8 %y) {
161 ; CHECK-LABEL: nxv2i8:
163 ; CHECK-NEXT: vsetvli a2, zero, e8, mf4, ta, ma
164 ; CHECK-NEXT: vmv.v.x v8, a0
165 ; CHECK-NEXT: vadd.vx v8, v8, a1
167 %head.x = insertelement <vscale x 2 x i8> poison, i8 %x, i32 0
168 %splat.x = shufflevector <vscale x 2 x i8> %head.x, <vscale x 2 x i8> poison, <vscale x 2 x i32> zeroinitializer
169 %head.y = insertelement <vscale x 2 x i8> poison, i8 %y, i32 0
170 %splat.y = shufflevector <vscale x 2 x i8> %head.y, <vscale x 2 x i8> poison, <vscale x 2 x i32> zeroinitializer
171 %v = add <vscale x 2 x i8> %splat.x, %splat.y
172 ret <vscale x 2 x i8> %v
175 define <vscale x 4 x i8> @nxv4i8(i8 %x, i8 %y) {
176 ; CHECK-LABEL: nxv4i8:
178 ; CHECK-NEXT: vsetvli a2, zero, e8, mf2, ta, ma
179 ; CHECK-NEXT: vmv.v.x v8, a0
180 ; CHECK-NEXT: vadd.vx v8, v8, a1
182 %head.x = insertelement <vscale x 4 x i8> poison, i8 %x, i32 0
183 %splat.x = shufflevector <vscale x 4 x i8> %head.x, <vscale x 4 x i8> poison, <vscale x 4 x i32> zeroinitializer
184 %head.y = insertelement <vscale x 4 x i8> poison, i8 %y, i32 0
185 %splat.y = shufflevector <vscale x 4 x i8> %head.y, <vscale x 4 x i8> poison, <vscale x 4 x i32> zeroinitializer
186 %v = add <vscale x 4 x i8> %splat.x, %splat.y
187 ret <vscale x 4 x i8> %v
190 define <vscale x 8 x i8> @nxv8i8(i8 %x, i8 %y) {
191 ; CHECK-LABEL: nxv8i8:
193 ; CHECK-NEXT: vsetvli a2, zero, e8, m1, ta, ma
194 ; CHECK-NEXT: vmv.v.x v8, a0
195 ; CHECK-NEXT: vadd.vx v8, v8, a1
197 %head.x = insertelement <vscale x 8 x i8> poison, i8 %x, i32 0
198 %splat.x = shufflevector <vscale x 8 x i8> %head.x, <vscale x 8 x i8> poison, <vscale x 8 x i32> zeroinitializer
199 %head.y = insertelement <vscale x 8 x i8> poison, i8 %y, i32 0
200 %splat.y = shufflevector <vscale x 8 x i8> %head.y, <vscale x 8 x i8> poison, <vscale x 8 x i32> zeroinitializer
201 %v = add <vscale x 8 x i8> %splat.x, %splat.y
202 ret <vscale x 8 x i8> %v
205 define <vscale x 16 x i8> @nxv16i8(i8 %x, i8 %y) {
206 ; CHECK-LABEL: nxv16i8:
208 ; CHECK-NEXT: vsetvli a2, zero, e8, m2, ta, ma
209 ; CHECK-NEXT: vmv.v.x v8, a0
210 ; CHECK-NEXT: vadd.vx v8, v8, a1
212 %head.x = insertelement <vscale x 16 x i8> poison, i8 %x, i32 0
213 %splat.x = shufflevector <vscale x 16 x i8> %head.x, <vscale x 16 x i8> poison, <vscale x 16 x i32> zeroinitializer
214 %head.y = insertelement <vscale x 16 x i8> poison, i8 %y, i32 0
215 %splat.y = shufflevector <vscale x 16 x i8> %head.y, <vscale x 16 x i8> poison, <vscale x 16 x i32> zeroinitializer
216 %v = add <vscale x 16 x i8> %splat.x, %splat.y
217 ret <vscale x 16 x i8> %v
220 define <vscale x 32 x i8> @nxv32i8(i8 %x, i8 %y) {
221 ; CHECK-LABEL: nxv32i8:
223 ; CHECK-NEXT: vsetvli a2, zero, e8, m4, ta, ma
224 ; CHECK-NEXT: vmv.v.x v8, a0
225 ; CHECK-NEXT: vadd.vx v8, v8, a1
227 %head.x = insertelement <vscale x 32 x i8> poison, i8 %x, i32 0
228 %splat.x = shufflevector <vscale x 32 x i8> %head.x, <vscale x 32 x i8> poison, <vscale x 32 x i32> zeroinitializer
229 %head.y = insertelement <vscale x 32 x i8> poison, i8 %y, i32 0
230 %splat.y = shufflevector <vscale x 32 x i8> %head.y, <vscale x 32 x i8> poison, <vscale x 32 x i32> zeroinitializer
231 %v = add <vscale x 32 x i8> %splat.x, %splat.y
232 ret <vscale x 32 x i8> %v
235 define <vscale x 64 x i8> @nxv64i8(i8 %x, i8 %y) {
236 ; CHECK-LABEL: nxv64i8:
238 ; CHECK-NEXT: vsetvli a2, zero, e8, m8, ta, ma
239 ; CHECK-NEXT: vmv.v.x v8, a0
240 ; CHECK-NEXT: vadd.vx v8, v8, a1
242 %head.x = insertelement <vscale x 64 x i8> poison, i8 %x, i32 0
243 %splat.x = shufflevector <vscale x 64 x i8> %head.x, <vscale x 64 x i8> poison, <vscale x 64 x i32> zeroinitializer
244 %head.y = insertelement <vscale x 64 x i8> poison, i8 %y, i32 0
245 %splat.y = shufflevector <vscale x 64 x i8> %head.y, <vscale x 64 x i8> poison, <vscale x 64 x i32> zeroinitializer
246 %v = add <vscale x 64 x i8> %splat.x, %splat.y
247 ret <vscale x 64 x i8> %v
250 define <vscale x 1 x i16> @nxv1i16(i16 %x, i16 %y) {
251 ; CHECK-LABEL: nxv1i16:
253 ; CHECK-NEXT: vsetvli a2, zero, e16, mf4, ta, ma
254 ; CHECK-NEXT: vmv.v.x v8, a0
255 ; CHECK-NEXT: vadd.vx v8, v8, a1
257 %head.x = insertelement <vscale x 1 x i16> poison, i16 %x, i32 0
258 %splat.x = shufflevector <vscale x 1 x i16> %head.x, <vscale x 1 x i16> poison, <vscale x 1 x i32> zeroinitializer
259 %head.y = insertelement <vscale x 1 x i16> poison, i16 %y, i32 0
260 %splat.y = shufflevector <vscale x 1 x i16> %head.y, <vscale x 1 x i16> poison, <vscale x 1 x i32> zeroinitializer
261 %v = add <vscale x 1 x i16> %splat.x, %splat.y
262 ret <vscale x 1 x i16> %v
265 define <vscale x 2 x i16> @nxv2i16(i16 %x, i16 %y) {
266 ; CHECK-LABEL: nxv2i16:
268 ; CHECK-NEXT: vsetvli a2, zero, e16, mf2, ta, ma
269 ; CHECK-NEXT: vmv.v.x v8, a0
270 ; CHECK-NEXT: vadd.vx v8, v8, a1
272 %head.x = insertelement <vscale x 2 x i16> poison, i16 %x, i32 0
273 %splat.x = shufflevector <vscale x 2 x i16> %head.x, <vscale x 2 x i16> poison, <vscale x 2 x i32> zeroinitializer
274 %head.y = insertelement <vscale x 2 x i16> poison, i16 %y, i32 0
275 %splat.y = shufflevector <vscale x 2 x i16> %head.y, <vscale x 2 x i16> poison, <vscale x 2 x i32> zeroinitializer
276 %v = add <vscale x 2 x i16> %splat.x, %splat.y
277 ret <vscale x 2 x i16> %v
280 define <vscale x 4 x i16> @nxv4i16(i16 %x, i16 %y) {
281 ; CHECK-LABEL: nxv4i16:
283 ; CHECK-NEXT: vsetvli a2, zero, e16, m1, ta, ma
284 ; CHECK-NEXT: vmv.v.x v8, a0
285 ; CHECK-NEXT: vadd.vx v8, v8, a1
287 %head.x = insertelement <vscale x 4 x i16> poison, i16 %x, i32 0
288 %splat.x = shufflevector <vscale x 4 x i16> %head.x, <vscale x 4 x i16> poison, <vscale x 4 x i32> zeroinitializer
289 %head.y = insertelement <vscale x 4 x i16> poison, i16 %y, i32 0
290 %splat.y = shufflevector <vscale x 4 x i16> %head.y, <vscale x 4 x i16> poison, <vscale x 4 x i32> zeroinitializer
291 %v = add <vscale x 4 x i16> %splat.x, %splat.y
292 ret <vscale x 4 x i16> %v
295 define <vscale x 8 x i16> @nxv8i16(i16 %x, i16 %y) {
296 ; CHECK-LABEL: nxv8i16:
298 ; CHECK-NEXT: vsetvli a2, zero, e16, m2, ta, ma
299 ; CHECK-NEXT: vmv.v.x v8, a0
300 ; CHECK-NEXT: vadd.vx v8, v8, a1
302 %head.x = insertelement <vscale x 8 x i16> poison, i16 %x, i32 0
303 %splat.x = shufflevector <vscale x 8 x i16> %head.x, <vscale x 8 x i16> poison, <vscale x 8 x i32> zeroinitializer
304 %head.y = insertelement <vscale x 8 x i16> poison, i16 %y, i32 0
305 %splat.y = shufflevector <vscale x 8 x i16> %head.y, <vscale x 8 x i16> poison, <vscale x 8 x i32> zeroinitializer
306 %v = add <vscale x 8 x i16> %splat.x, %splat.y
307 ret <vscale x 8 x i16> %v
310 define <vscale x 16 x i16> @nxv16i16(i16 %x, i16 %y) {
311 ; CHECK-LABEL: nxv16i16:
313 ; CHECK-NEXT: vsetvli a2, zero, e16, m4, ta, ma
314 ; CHECK-NEXT: vmv.v.x v8, a0
315 ; CHECK-NEXT: vadd.vx v8, v8, a1
317 %head.x = insertelement <vscale x 16 x i16> poison, i16 %x, i32 0
318 %splat.x = shufflevector <vscale x 16 x i16> %head.x, <vscale x 16 x i16> poison, <vscale x 16 x i32> zeroinitializer
319 %head.y = insertelement <vscale x 16 x i16> poison, i16 %y, i32 0
320 %splat.y = shufflevector <vscale x 16 x i16> %head.y, <vscale x 16 x i16> poison, <vscale x 16 x i32> zeroinitializer
321 %v = add <vscale x 16 x i16> %splat.x, %splat.y
322 ret <vscale x 16 x i16> %v
325 define <vscale x 32 x i16> @nxv32i16(i16 %x, i16 %y) {
326 ; CHECK-LABEL: nxv32i16:
328 ; CHECK-NEXT: vsetvli a2, zero, e16, m8, ta, ma
329 ; CHECK-NEXT: vmv.v.x v8, a0
330 ; CHECK-NEXT: vadd.vx v8, v8, a1
332 %head.x = insertelement <vscale x 32 x i16> poison, i16 %x, i32 0
333 %splat.x = shufflevector <vscale x 32 x i16> %head.x, <vscale x 32 x i16> poison, <vscale x 32 x i32> zeroinitializer
334 %head.y = insertelement <vscale x 32 x i16> poison, i16 %y, i32 0
335 %splat.y = shufflevector <vscale x 32 x i16> %head.y, <vscale x 32 x i16> poison, <vscale x 32 x i32> zeroinitializer
336 %v = add <vscale x 32 x i16> %splat.x, %splat.y
337 ret <vscale x 32 x i16> %v
340 define <vscale x 1 x i32> @nxv1i32(i32 %x, i32 %y) {
341 ; RV32-LABEL: nxv1i32:
343 ; RV32-NEXT: add a0, a0, a1
344 ; RV32-NEXT: vsetvli a1, zero, e32, mf2, ta, ma
345 ; RV32-NEXT: vmv.v.x v8, a0
348 ; RV64-LABEL: nxv1i32:
350 ; RV64-NEXT: vsetvli a2, zero, e32, mf2, ta, ma
351 ; RV64-NEXT: vmv.v.x v8, a0
352 ; RV64-NEXT: vadd.vx v8, v8, a1
354 %head.x = insertelement <vscale x 1 x i32> poison, i32 %x, i32 0
355 %splat.x = shufflevector <vscale x 1 x i32> %head.x, <vscale x 1 x i32> poison, <vscale x 1 x i32> zeroinitializer
356 %head.y = insertelement <vscale x 1 x i32> poison, i32 %y, i32 0
357 %splat.y = shufflevector <vscale x 1 x i32> %head.y, <vscale x 1 x i32> poison, <vscale x 1 x i32> zeroinitializer
358 %v = add <vscale x 1 x i32> %splat.x, %splat.y
359 ret <vscale x 1 x i32> %v
362 define <vscale x 2 x i32> @nxv2i32(i32 %x, i32 %y) {
363 ; RV32-LABEL: nxv2i32:
365 ; RV32-NEXT: add a0, a0, a1
366 ; RV32-NEXT: vsetvli a1, zero, e32, m1, ta, ma
367 ; RV32-NEXT: vmv.v.x v8, a0
370 ; RV64-LABEL: nxv2i32:
372 ; RV64-NEXT: vsetvli a2, zero, e32, m1, ta, ma
373 ; RV64-NEXT: vmv.v.x v8, a0
374 ; RV64-NEXT: vadd.vx v8, v8, a1
376 %head.x = insertelement <vscale x 2 x i32> poison, i32 %x, i32 0
377 %splat.x = shufflevector <vscale x 2 x i32> %head.x, <vscale x 2 x i32> poison, <vscale x 2 x i32> zeroinitializer
378 %head.y = insertelement <vscale x 2 x i32> poison, i32 %y, i32 0
379 %splat.y = shufflevector <vscale x 2 x i32> %head.y, <vscale x 2 x i32> poison, <vscale x 2 x i32> zeroinitializer
380 %v = add <vscale x 2 x i32> %splat.x, %splat.y
381 ret <vscale x 2 x i32> %v
384 define <vscale x 4 x i32> @nxv4i32(i32 %x, i32 %y) {
385 ; RV32-LABEL: nxv4i32:
387 ; RV32-NEXT: add a0, a0, a1
388 ; RV32-NEXT: vsetvli a1, zero, e32, m2, ta, ma
389 ; RV32-NEXT: vmv.v.x v8, a0
392 ; RV64-LABEL: nxv4i32:
394 ; RV64-NEXT: vsetvli a2, zero, e32, m2, ta, ma
395 ; RV64-NEXT: vmv.v.x v8, a0
396 ; RV64-NEXT: vadd.vx v8, v8, a1
398 %head.x = insertelement <vscale x 4 x i32> poison, i32 %x, i32 0
399 %splat.x = shufflevector <vscale x 4 x i32> %head.x, <vscale x 4 x i32> poison, <vscale x 4 x i32> zeroinitializer
400 %head.y = insertelement <vscale x 4 x i32> poison, i32 %y, i32 0
401 %splat.y = shufflevector <vscale x 4 x i32> %head.y, <vscale x 4 x i32> poison, <vscale x 4 x i32> zeroinitializer
402 %v = add <vscale x 4 x i32> %splat.x, %splat.y
403 ret <vscale x 4 x i32> %v
406 define <vscale x 8 x i32> @nxv8i32(i32 %x, i32 %y) {
407 ; RV32-LABEL: nxv8i32:
409 ; RV32-NEXT: add a0, a0, a1
410 ; RV32-NEXT: vsetvli a1, zero, e32, m4, ta, ma
411 ; RV32-NEXT: vmv.v.x v8, a0
414 ; RV64-LABEL: nxv8i32:
416 ; RV64-NEXT: vsetvli a2, zero, e32, m4, ta, ma
417 ; RV64-NEXT: vmv.v.x v8, a0
418 ; RV64-NEXT: vadd.vx v8, v8, a1
420 %head.x = insertelement <vscale x 8 x i32> poison, i32 %x, i32 0
421 %splat.x = shufflevector <vscale x 8 x i32> %head.x, <vscale x 8 x i32> poison, <vscale x 8 x i32> zeroinitializer
422 %head.y = insertelement <vscale x 8 x i32> poison, i32 %y, i32 0
423 %splat.y = shufflevector <vscale x 8 x i32> %head.y, <vscale x 8 x i32> poison, <vscale x 8 x i32> zeroinitializer
424 %v = add <vscale x 8 x i32> %splat.x, %splat.y
425 ret <vscale x 8 x i32> %v
428 define <vscale x 16 x i32> @nxv16i32(i32 %x, i32 %y) {
429 ; RV32-LABEL: nxv16i32:
431 ; RV32-NEXT: add a0, a0, a1
432 ; RV32-NEXT: vsetvli a1, zero, e32, m8, ta, ma
433 ; RV32-NEXT: vmv.v.x v8, a0
436 ; RV64-LABEL: nxv16i32:
438 ; RV64-NEXT: vsetvli a2, zero, e32, m8, ta, ma
439 ; RV64-NEXT: vmv.v.x v8, a0
440 ; RV64-NEXT: vadd.vx v8, v8, a1
442 %head.x = insertelement <vscale x 16 x i32> poison, i32 %x, i32 0
443 %splat.x = shufflevector <vscale x 16 x i32> %head.x, <vscale x 16 x i32> poison, <vscale x 16 x i32> zeroinitializer
444 %head.y = insertelement <vscale x 16 x i32> poison, i32 %y, i32 0
445 %splat.y = shufflevector <vscale x 16 x i32> %head.y, <vscale x 16 x i32> poison, <vscale x 16 x i32> zeroinitializer
446 %v = add <vscale x 16 x i32> %splat.x, %splat.y
447 ret <vscale x 16 x i32> %v
450 define <vscale x 1 x i64> @nxv1i64(i64 %x, i64 %y) {
451 ; RV32-LABEL: nxv1i64:
453 ; RV32-NEXT: addi sp, sp, -16
454 ; RV32-NEXT: .cfi_def_cfa_offset 16
455 ; RV32-NEXT: sw a1, 12(sp)
456 ; RV32-NEXT: sw a0, 8(sp)
457 ; RV32-NEXT: addi a0, sp, 8
458 ; RV32-NEXT: vsetvli a1, zero, e64, m1, ta, ma
459 ; RV32-NEXT: vlse64.v v8, (a0), zero
460 ; RV32-NEXT: sw a3, 4(sp)
461 ; RV32-NEXT: sw a2, 0(sp)
462 ; RV32-NEXT: mv a0, sp
463 ; RV32-NEXT: vlse64.v v9, (a0), zero
464 ; RV32-NEXT: vadd.vv v8, v8, v9
465 ; RV32-NEXT: addi sp, sp, 16
468 ; RV64-LABEL: nxv1i64:
470 ; RV64-NEXT: add a0, a0, a1
471 ; RV64-NEXT: vsetvli a1, zero, e64, m1, ta, ma
472 ; RV64-NEXT: vmv.v.x v8, a0
474 %head.x = insertelement <vscale x 1 x i64> poison, i64 %x, i32 0
475 %splat.x = shufflevector <vscale x 1 x i64> %head.x, <vscale x 1 x i64> poison, <vscale x 1 x i32> zeroinitializer
476 %head.y = insertelement <vscale x 1 x i64> poison, i64 %y, i32 0
477 %splat.y = shufflevector <vscale x 1 x i64> %head.y, <vscale x 1 x i64> poison, <vscale x 1 x i32> zeroinitializer
478 %v = add <vscale x 1 x i64> %splat.x, %splat.y
479 ret <vscale x 1 x i64> %v
482 define <vscale x 2 x i64> @nxv2i64(i64 %x, i64 %y) {
483 ; RV32-LABEL: nxv2i64:
485 ; RV32-NEXT: addi sp, sp, -16
486 ; RV32-NEXT: .cfi_def_cfa_offset 16
487 ; RV32-NEXT: sw a1, 12(sp)
488 ; RV32-NEXT: sw a0, 8(sp)
489 ; RV32-NEXT: addi a0, sp, 8
490 ; RV32-NEXT: vsetvli a1, zero, e64, m2, ta, ma
491 ; RV32-NEXT: vlse64.v v8, (a0), zero
492 ; RV32-NEXT: sw a3, 4(sp)
493 ; RV32-NEXT: sw a2, 0(sp)
494 ; RV32-NEXT: mv a0, sp
495 ; RV32-NEXT: vlse64.v v10, (a0), zero
496 ; RV32-NEXT: vadd.vv v8, v8, v10
497 ; RV32-NEXT: addi sp, sp, 16
500 ; RV64-LABEL: nxv2i64:
502 ; RV64-NEXT: add a0, a0, a1
503 ; RV64-NEXT: vsetvli a1, zero, e64, m2, ta, ma
504 ; RV64-NEXT: vmv.v.x v8, a0
506 %head.x = insertelement <vscale x 2 x i64> poison, i64 %x, i32 0
507 %splat.x = shufflevector <vscale x 2 x i64> %head.x, <vscale x 2 x i64> poison, <vscale x 2 x i32> zeroinitializer
508 %head.y = insertelement <vscale x 2 x i64> poison, i64 %y, i32 0
509 %splat.y = shufflevector <vscale x 2 x i64> %head.y, <vscale x 2 x i64> poison, <vscale x 2 x i32> zeroinitializer
510 %v = add <vscale x 2 x i64> %splat.x, %splat.y
511 ret <vscale x 2 x i64> %v
514 define <vscale x 4 x i64> @nxv4i64(i64 %x, i64 %y) {
515 ; RV32-LABEL: nxv4i64:
517 ; RV32-NEXT: addi sp, sp, -16
518 ; RV32-NEXT: .cfi_def_cfa_offset 16
519 ; RV32-NEXT: sw a1, 12(sp)
520 ; RV32-NEXT: sw a0, 8(sp)
521 ; RV32-NEXT: addi a0, sp, 8
522 ; RV32-NEXT: vsetvli a1, zero, e64, m4, ta, ma
523 ; RV32-NEXT: vlse64.v v8, (a0), zero
524 ; RV32-NEXT: sw a3, 4(sp)
525 ; RV32-NEXT: sw a2, 0(sp)
526 ; RV32-NEXT: mv a0, sp
527 ; RV32-NEXT: vlse64.v v12, (a0), zero
528 ; RV32-NEXT: vadd.vv v8, v8, v12
529 ; RV32-NEXT: addi sp, sp, 16
532 ; RV64-LABEL: nxv4i64:
534 ; RV64-NEXT: add a0, a0, a1
535 ; RV64-NEXT: vsetvli a1, zero, e64, m4, ta, ma
536 ; RV64-NEXT: vmv.v.x v8, a0
538 %head.x = insertelement <vscale x 4 x i64> poison, i64 %x, i32 0
539 %splat.x = shufflevector <vscale x 4 x i64> %head.x, <vscale x 4 x i64> poison, <vscale x 4 x i32> zeroinitializer
540 %head.y = insertelement <vscale x 4 x i64> poison, i64 %y, i32 0
541 %splat.y = shufflevector <vscale x 4 x i64> %head.y, <vscale x 4 x i64> poison, <vscale x 4 x i32> zeroinitializer
542 %v = add <vscale x 4 x i64> %splat.x, %splat.y
543 ret <vscale x 4 x i64> %v
546 define <vscale x 8 x i64> @nxv8i64(i64 %x, i64 %y) {
547 ; RV32-LABEL: nxv8i64:
549 ; RV32-NEXT: addi sp, sp, -16
550 ; RV32-NEXT: .cfi_def_cfa_offset 16
551 ; RV32-NEXT: sw a1, 12(sp)
552 ; RV32-NEXT: sw a0, 8(sp)
553 ; RV32-NEXT: addi a0, sp, 8
554 ; RV32-NEXT: vsetvli a1, zero, e64, m8, ta, ma
555 ; RV32-NEXT: vlse64.v v8, (a0), zero
556 ; RV32-NEXT: sw a3, 4(sp)
557 ; RV32-NEXT: sw a2, 0(sp)
558 ; RV32-NEXT: mv a0, sp
559 ; RV32-NEXT: vlse64.v v16, (a0), zero
560 ; RV32-NEXT: vadd.vv v8, v8, v16
561 ; RV32-NEXT: addi sp, sp, 16
564 ; RV64-LABEL: nxv8i64:
566 ; RV64-NEXT: add a0, a0, a1
567 ; RV64-NEXT: vsetvli a1, zero, e64, m8, ta, ma
568 ; RV64-NEXT: vmv.v.x v8, a0
570 %head.x = insertelement <vscale x 8 x i64> poison, i64 %x, i32 0
571 %splat.x = shufflevector <vscale x 8 x i64> %head.x, <vscale x 8 x i64> poison, <vscale x 8 x i32> zeroinitializer
572 %head.y = insertelement <vscale x 8 x i64> poison, i64 %y, i32 0
573 %splat.y = shufflevector <vscale x 8 x i64> %head.y, <vscale x 8 x i64> poison, <vscale x 8 x i32> zeroinitializer
574 %v = add <vscale x 8 x i64> %splat.x, %splat.y
575 ret <vscale x 8 x i64> %v
578 define <vscale x 4 x half> @nxv4f16(half %x, half %y) {
579 ; CHECK-LABEL: nxv4f16:
581 ; CHECK-NEXT: fadd.h fa5, fa0, fa1
582 ; CHECK-NEXT: vsetvli a0, zero, e16, m1, ta, ma
583 ; CHECK-NEXT: vfmv.v.f v8, fa5
585 %head.x = insertelement <vscale x 4 x half> poison, half %x, i32 0
586 %splat.x = shufflevector <vscale x 4 x half> %head.x, <vscale x 4 x half> poison, <vscale x 4 x i32> zeroinitializer
587 %head.y = insertelement <vscale x 4 x half> poison, half %y, i32 0
588 %splat.y = shufflevector <vscale x 4 x half> %head.y, <vscale x 4 x half> poison, <vscale x 4 x i32> zeroinitializer
589 %v = fadd <vscale x 4 x half> %splat.x, %splat.y
590 ret <vscale x 4 x half> %v
593 define <vscale x 2 x float> @nxv2f32(float %x, float %y) {
594 ; CHECK-LABEL: nxv2f32:
596 ; CHECK-NEXT: fadd.s fa5, fa0, fa1
597 ; CHECK-NEXT: vsetvli a0, zero, e32, m1, ta, ma
598 ; CHECK-NEXT: vfmv.v.f v8, fa5
600 %head.x = insertelement <vscale x 2 x float> poison, float %x, i32 0
601 %splat.x = shufflevector <vscale x 2 x float> %head.x, <vscale x 2 x float> poison, <vscale x 2 x i32> zeroinitializer
602 %head.y = insertelement <vscale x 2 x float> poison, float %y, i32 0
603 %splat.y = shufflevector <vscale x 2 x float> %head.y, <vscale x 2 x float> poison, <vscale x 2 x i32> zeroinitializer
604 %v = fadd <vscale x 2 x float> %splat.x, %splat.y
605 ret <vscale x 2 x float> %v
608 define <vscale x 1 x double> @nxv2f64(double %x, double %y) {
609 ; CHECK-LABEL: nxv2f64:
611 ; CHECK-NEXT: fadd.d fa5, fa0, fa1
612 ; CHECK-NEXT: vsetvli a0, zero, e64, m1, ta, ma
613 ; CHECK-NEXT: vfmv.v.f v8, fa5
615 %head.x = insertelement <vscale x 1 x double> poison, double %x, i32 0
616 %splat.x = shufflevector <vscale x 1 x double> %head.x, <vscale x 1 x double> poison, <vscale x 1 x i32> zeroinitializer
617 %head.y = insertelement <vscale x 1 x double> poison, double %y, i32 0
618 %splat.y = shufflevector <vscale x 1 x double> %head.y, <vscale x 1 x double> poison, <vscale x 1 x i32> zeroinitializer
619 %v = fadd <vscale x 1 x double> %splat.x, %splat.y
620 ret <vscale x 1 x double> %v