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 <1 x i1> @v1i1(i1 %x, i1 %y) {
8 ; CHECK-NEXT: andi a0, a0, 1
9 ; CHECK-NEXT: vsetivli zero, 1, e8, mf8, ta, ma
10 ; CHECK-NEXT: vmv.s.x v8, a0
11 ; CHECK-NEXT: vmsne.vi v8, v8, 0
12 ; CHECK-NEXT: andi a1, a1, 1
13 ; CHECK-NEXT: vmv.s.x v9, a1
14 ; CHECK-NEXT: vmsne.vi v9, v9, 0
15 ; CHECK-NEXT: vmxor.mm v0, v8, v9
17 %head.x = insertelement <1 x i1> poison, i1 %x, i32 0
18 %splat.x = shufflevector <1 x i1> %head.x, <1 x i1> poison, <1 x i32> zeroinitializer
19 %head.y = insertelement <1 x i1> poison, i1 %y, i32 0
20 %splat.y = shufflevector <1 x i1> %head.y, <1 x i1> poison, <1 x i32> zeroinitializer
21 %v = add <1 x i1> %splat.x, %splat.y
25 define <2 x i1> @v2i1(i1 %x, i1 %y) {
28 ; CHECK-NEXT: andi a0, a0, 1
29 ; CHECK-NEXT: vsetivli zero, 2, e8, mf8, 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
36 ; CHECK-NEXT: vmv.v.i v8, 0
37 ; CHECK-NEXT: vmerge.vim v8, v8, 1, v0
38 ; CHECK-NEXT: vrgather.vi v9, v8, 0
39 ; CHECK-NEXT: vmsne.vi v0, v9, 0
41 %head.x = insertelement <2 x i1> poison, i1 %x, i32 0
42 %splat.x = shufflevector <2 x i1> %head.x, <2 x i1> poison, <2 x i32> zeroinitializer
43 %head.y = insertelement <2 x i1> poison, i1 %y, i32 0
44 %splat.y = shufflevector <2 x i1> %head.y, <2 x i1> poison, <2 x i32> zeroinitializer
45 %v = add <2 x i1> %splat.x, %splat.y
49 define <4 x i1> @v4i1(i1 %x, i1 %y) {
52 ; CHECK-NEXT: andi a0, a0, 1
53 ; CHECK-NEXT: vsetivli zero, 4, e8, mf4, ta, ma
54 ; CHECK-NEXT: vmv.v.x v8, a0
55 ; CHECK-NEXT: vmsne.vi v8, v8, 0
56 ; CHECK-NEXT: andi a1, a1, 1
57 ; CHECK-NEXT: vmv.v.x v9, a1
58 ; CHECK-NEXT: vmsne.vi v9, v9, 0
59 ; CHECK-NEXT: vmxor.mm v0, v8, v9
60 ; CHECK-NEXT: vmv.v.i v8, 0
61 ; CHECK-NEXT: vmerge.vim v8, v8, 1, v0
62 ; CHECK-NEXT: vrgather.vi v9, v8, 0
63 ; CHECK-NEXT: vmsne.vi v0, v9, 0
65 %head.x = insertelement <4 x i1> poison, i1 %x, i32 0
66 %splat.x = shufflevector <4 x i1> %head.x, <4 x i1> poison, <4 x i32> zeroinitializer
67 %head.y = insertelement <4 x i1> poison, i1 %y, i32 0
68 %splat.y = shufflevector <4 x i1> %head.y, <4 x i1> poison, <4 x i32> zeroinitializer
69 %v = add <4 x i1> %splat.x, %splat.y
73 define <8 x i1> @v8i1(i1 %x, i1 %y) {
76 ; CHECK-NEXT: andi a0, a0, 1
77 ; CHECK-NEXT: vsetivli zero, 8, e8, mf2, ta, ma
78 ; CHECK-NEXT: vmv.v.x v8, a0
79 ; CHECK-NEXT: vmsne.vi v8, v8, 0
80 ; CHECK-NEXT: andi a1, a1, 1
81 ; CHECK-NEXT: vmv.v.x v9, a1
82 ; CHECK-NEXT: vmsne.vi v9, v9, 0
83 ; CHECK-NEXT: vmxor.mm v0, v8, v9
84 ; CHECK-NEXT: vmv.v.i v8, 0
85 ; CHECK-NEXT: vmerge.vim v8, v8, 1, v0
86 ; CHECK-NEXT: vrgather.vi v9, v8, 0
87 ; CHECK-NEXT: vmsne.vi v0, v9, 0
89 %head.x = insertelement <8 x i1> poison, i1 %x, i32 0
90 %splat.x = shufflevector <8 x i1> %head.x, <8 x i1> poison, <8 x i32> zeroinitializer
91 %head.y = insertelement <8 x i1> poison, i1 %y, i32 0
92 %splat.y = shufflevector <8 x i1> %head.y, <8 x i1> poison, <8 x i32> zeroinitializer
93 %v = add <8 x i1> %splat.x, %splat.y
97 define <16 x i1> @v16i1(i1 %x, i1 %y) {
100 ; CHECK-NEXT: andi a0, a0, 1
101 ; CHECK-NEXT: vsetivli zero, 16, e8, m1, ta, ma
102 ; CHECK-NEXT: vmv.v.x v8, a0
103 ; CHECK-NEXT: vmsne.vi v8, v8, 0
104 ; CHECK-NEXT: andi a1, a1, 1
105 ; CHECK-NEXT: vmv.v.x v9, a1
106 ; CHECK-NEXT: vmsne.vi v9, v9, 0
107 ; CHECK-NEXT: vmxor.mm v0, v8, v9
108 ; CHECK-NEXT: vmv.v.i v8, 0
109 ; CHECK-NEXT: vmerge.vim v8, v8, 1, v0
110 ; CHECK-NEXT: vrgather.vi v9, v8, 0
111 ; CHECK-NEXT: vmsne.vi v0, v9, 0
113 %head.x = insertelement <16 x i1> poison, i1 %x, i32 0
114 %splat.x = shufflevector <16 x i1> %head.x, <16 x i1> poison, <16 x i32> zeroinitializer
115 %head.y = insertelement <16 x i1> poison, i1 %y, i32 0
116 %splat.y = shufflevector <16 x i1> %head.y, <16 x i1> poison, <16 x i32> zeroinitializer
117 %v = add <16 x i1> %splat.x, %splat.y
121 define <32 x i1> @v32i1(i1 %x, i1 %y) {
122 ; CHECK-LABEL: v32i1:
124 ; CHECK-NEXT: andi a0, a0, 1
125 ; CHECK-NEXT: li a2, 32
126 ; CHECK-NEXT: vsetvli zero, a2, e8, m2, ta, ma
127 ; CHECK-NEXT: vmv.v.x v8, a0
128 ; CHECK-NEXT: vmsne.vi v10, v8, 0
129 ; CHECK-NEXT: andi a1, a1, 1
130 ; CHECK-NEXT: vmv.v.x v8, a1
131 ; CHECK-NEXT: vmsne.vi v11, v8, 0
132 ; CHECK-NEXT: vmxor.mm v0, v10, v11
133 ; CHECK-NEXT: vmv.v.i v8, 0
134 ; CHECK-NEXT: vmerge.vim v8, v8, 1, v0
135 ; CHECK-NEXT: vrgather.vi v10, v8, 0
136 ; CHECK-NEXT: vmsne.vi v0, v10, 0
138 %head.x = insertelement <32 x i1> poison, i1 %x, i32 0
139 %splat.x = shufflevector <32 x i1> %head.x, <32 x i1> poison, <32 x i32> zeroinitializer
140 %head.y = insertelement <32 x i1> poison, i1 %y, i32 0
141 %splat.y = shufflevector <32 x i1> %head.y, <32 x i1> poison, <32 x i32> zeroinitializer
142 %v = add <32 x i1> %splat.x, %splat.y
146 define <64 x i1> @v64i1(i1 %x, i1 %y) {
147 ; CHECK-LABEL: v64i1:
149 ; CHECK-NEXT: andi a0, a0, 1
150 ; CHECK-NEXT: li a2, 64
151 ; CHECK-NEXT: vsetvli zero, a2, e8, m4, ta, ma
152 ; CHECK-NEXT: vmv.v.x v8, a0
153 ; CHECK-NEXT: vmsne.vi v12, v8, 0
154 ; CHECK-NEXT: andi a1, a1, 1
155 ; CHECK-NEXT: vmv.v.x v8, a1
156 ; CHECK-NEXT: vmsne.vi v13, v8, 0
157 ; CHECK-NEXT: vmxor.mm v0, v12, v13
158 ; CHECK-NEXT: vmv.v.i v8, 0
159 ; CHECK-NEXT: vmerge.vim v8, v8, 1, v0
160 ; CHECK-NEXT: vrgather.vi v12, v8, 0
161 ; CHECK-NEXT: vmsne.vi v0, v12, 0
163 %head.x = insertelement <64 x i1> poison, i1 %x, i32 0
164 %splat.x = shufflevector <64 x i1> %head.x, <64 x i1> poison, <64 x i32> zeroinitializer
165 %head.y = insertelement <64 x i1> poison, i1 %y, i32 0
166 %splat.y = shufflevector <64 x i1> %head.y, <64 x i1> poison, <64 x i32> zeroinitializer
167 %v = add <64 x i1> %splat.x, %splat.y
171 define <1 x i8> @v1i8(i8 %x, i8 %y) {
174 ; CHECK-NEXT: vsetivli zero, 1, e8, mf8, ta, ma
175 ; CHECK-NEXT: vmv.s.x v8, a0
176 ; CHECK-NEXT: vadd.vx v8, v8, a1
178 %head.x = insertelement <1 x i8> poison, i8 %x, i32 0
179 %splat.x = shufflevector <1 x i8> %head.x, <1 x i8> poison, <1 x i32> zeroinitializer
180 %head.y = insertelement <1 x i8> poison, i8 %y, i32 0
181 %splat.y = shufflevector <1 x i8> %head.y, <1 x i8> poison, <1 x i32> zeroinitializer
182 %v = add <1 x i8> %splat.x, %splat.y
186 define <2 x i8> @v2i8(i8 %x, i8 %y) {
189 ; CHECK-NEXT: vsetivli zero, 2, e8, mf8, ta, ma
190 ; CHECK-NEXT: vmv.v.x v8, a0
191 ; CHECK-NEXT: vadd.vx v9, v8, a1
192 ; CHECK-NEXT: vrgather.vi v8, v9, 0
194 %head.x = insertelement <2 x i8> poison, i8 %x, i32 0
195 %splat.x = shufflevector <2 x i8> %head.x, <2 x i8> poison, <2 x i32> zeroinitializer
196 %head.y = insertelement <2 x i8> poison, i8 %y, i32 0
197 %splat.y = shufflevector <2 x i8> %head.y, <2 x i8> poison, <2 x i32> zeroinitializer
198 %v = add <2 x i8> %splat.x, %splat.y
202 define <4 x i8> @v4i8(i8 %x, i8 %y) {
205 ; CHECK-NEXT: vsetivli zero, 4, e8, mf4, ta, ma
206 ; CHECK-NEXT: vmv.v.x v8, a0
207 ; CHECK-NEXT: vadd.vx v9, v8, a1
208 ; CHECK-NEXT: vrgather.vi v8, v9, 0
210 %head.x = insertelement <4 x i8> poison, i8 %x, i32 0
211 %splat.x = shufflevector <4 x i8> %head.x, <4 x i8> poison, <4 x i32> zeroinitializer
212 %head.y = insertelement <4 x i8> poison, i8 %y, i32 0
213 %splat.y = shufflevector <4 x i8> %head.y, <4 x i8> poison, <4 x i32> zeroinitializer
214 %v = add <4 x i8> %splat.x, %splat.y
218 define <8 x i8> @v8i8(i8 %x, i8 %y) {
221 ; CHECK-NEXT: vsetivli zero, 8, e8, mf2, ta, ma
222 ; CHECK-NEXT: vmv.v.x v8, a0
223 ; CHECK-NEXT: vadd.vx v9, v8, a1
224 ; CHECK-NEXT: vrgather.vi v8, v9, 0
226 %head.x = insertelement <8 x i8> poison, i8 %x, i32 0
227 %splat.x = shufflevector <8 x i8> %head.x, <8 x i8> poison, <8 x i32> zeroinitializer
228 %head.y = insertelement <8 x i8> poison, i8 %y, i32 0
229 %splat.y = shufflevector <8 x i8> %head.y, <8 x i8> poison, <8 x i32> zeroinitializer
230 %v = add <8 x i8> %splat.x, %splat.y
234 define <16 x i8> @v16i8(i8 %x, i8 %y) {
235 ; CHECK-LABEL: v16i8:
237 ; CHECK-NEXT: vsetivli zero, 16, e8, m1, ta, ma
238 ; CHECK-NEXT: vmv.v.x v8, a0
239 ; CHECK-NEXT: vadd.vx v9, v8, a1
240 ; CHECK-NEXT: vrgather.vi v8, v9, 0
242 %head.x = insertelement <16 x i8> poison, i8 %x, i32 0
243 %splat.x = shufflevector <16 x i8> %head.x, <16 x i8> poison, <16 x i32> zeroinitializer
244 %head.y = insertelement <16 x i8> poison, i8 %y, i32 0
245 %splat.y = shufflevector <16 x i8> %head.y, <16 x i8> poison, <16 x i32> zeroinitializer
246 %v = add <16 x i8> %splat.x, %splat.y
250 define <32 x i8> @v32i8(i8 %x, i8 %y) {
251 ; CHECK-LABEL: v32i8:
253 ; CHECK-NEXT: li a2, 32
254 ; CHECK-NEXT: vsetvli zero, a2, e8, m2, ta, ma
255 ; CHECK-NEXT: vmv.v.x v8, a0
256 ; CHECK-NEXT: vadd.vx v10, v8, a1
257 ; CHECK-NEXT: vrgather.vi v8, v10, 0
259 %head.x = insertelement <32 x i8> poison, i8 %x, i32 0
260 %splat.x = shufflevector <32 x i8> %head.x, <32 x i8> poison, <32 x i32> zeroinitializer
261 %head.y = insertelement <32 x i8> poison, i8 %y, i32 0
262 %splat.y = shufflevector <32 x i8> %head.y, <32 x i8> poison, <32 x i32> zeroinitializer
263 %v = add <32 x i8> %splat.x, %splat.y
267 define <64 x i8> @v64i8(i8 %x, i8 %y) {
268 ; CHECK-LABEL: v64i8:
270 ; CHECK-NEXT: li a2, 64
271 ; CHECK-NEXT: vsetvli zero, a2, e8, m4, ta, ma
272 ; CHECK-NEXT: vmv.v.x v8, a0
273 ; CHECK-NEXT: vadd.vx v12, v8, a1
274 ; CHECK-NEXT: vrgather.vi v8, v12, 0
276 %head.x = insertelement <64 x i8> poison, i8 %x, i32 0
277 %splat.x = shufflevector <64 x i8> %head.x, <64 x i8> poison, <64 x i32> zeroinitializer
278 %head.y = insertelement <64 x i8> poison, i8 %y, i32 0
279 %splat.y = shufflevector <64 x i8> %head.y, <64 x i8> poison, <64 x i32> zeroinitializer
280 %v = add <64 x i8> %splat.x, %splat.y
284 define <1 x i16> @v1i16(i16 %x, i16 %y) {
285 ; CHECK-LABEL: v1i16:
287 ; CHECK-NEXT: vsetivli zero, 1, e16, mf4, ta, ma
288 ; CHECK-NEXT: vmv.s.x v8, a0
289 ; CHECK-NEXT: vadd.vx v8, v8, a1
291 %head.x = insertelement <1 x i16> poison, i16 %x, i32 0
292 %splat.x = shufflevector <1 x i16> %head.x, <1 x i16> poison, <1 x i32> zeroinitializer
293 %head.y = insertelement <1 x i16> poison, i16 %y, i32 0
294 %splat.y = shufflevector <1 x i16> %head.y, <1 x i16> poison, <1 x i32> zeroinitializer
295 %v = add <1 x i16> %splat.x, %splat.y
299 define <2 x i16> @v2i16(i16 %x, i16 %y) {
300 ; CHECK-LABEL: v2i16:
302 ; CHECK-NEXT: vsetivli zero, 2, e16, mf4, ta, ma
303 ; CHECK-NEXT: vmv.v.x v8, a0
304 ; CHECK-NEXT: vadd.vx v9, v8, a1
305 ; CHECK-NEXT: vrgather.vi v8, v9, 0
307 %head.x = insertelement <2 x i16> poison, i16 %x, i32 0
308 %splat.x = shufflevector <2 x i16> %head.x, <2 x i16> poison, <2 x i32> zeroinitializer
309 %head.y = insertelement <2 x i16> poison, i16 %y, i32 0
310 %splat.y = shufflevector <2 x i16> %head.y, <2 x i16> poison, <2 x i32> zeroinitializer
311 %v = add <2 x i16> %splat.x, %splat.y
315 define <4 x i16> @v4i16(i16 %x, i16 %y) {
316 ; CHECK-LABEL: v4i16:
318 ; CHECK-NEXT: vsetivli zero, 4, e16, mf2, ta, ma
319 ; CHECK-NEXT: vmv.v.x v8, a0
320 ; CHECK-NEXT: vadd.vx v9, v8, a1
321 ; CHECK-NEXT: vrgather.vi v8, v9, 0
323 %head.x = insertelement <4 x i16> poison, i16 %x, i32 0
324 %splat.x = shufflevector <4 x i16> %head.x, <4 x i16> poison, <4 x i32> zeroinitializer
325 %head.y = insertelement <4 x i16> poison, i16 %y, i32 0
326 %splat.y = shufflevector <4 x i16> %head.y, <4 x i16> poison, <4 x i32> zeroinitializer
327 %v = add <4 x i16> %splat.x, %splat.y
331 define <8 x i16> @v8i16(i16 %x, i16 %y) {
332 ; CHECK-LABEL: v8i16:
334 ; CHECK-NEXT: vsetivli zero, 8, e16, m1, ta, ma
335 ; CHECK-NEXT: vmv.v.x v8, a0
336 ; CHECK-NEXT: vadd.vx v9, v8, a1
337 ; CHECK-NEXT: vrgather.vi v8, v9, 0
339 %head.x = insertelement <8 x i16> poison, i16 %x, i32 0
340 %splat.x = shufflevector <8 x i16> %head.x, <8 x i16> poison, <8 x i32> zeroinitializer
341 %head.y = insertelement <8 x i16> poison, i16 %y, i32 0
342 %splat.y = shufflevector <8 x i16> %head.y, <8 x i16> poison, <8 x i32> zeroinitializer
343 %v = add <8 x i16> %splat.x, %splat.y
347 define <16 x i16> @v16i16(i16 %x, i16 %y) {
348 ; CHECK-LABEL: v16i16:
350 ; CHECK-NEXT: vsetivli zero, 16, e16, m2, ta, ma
351 ; CHECK-NEXT: vmv.v.x v8, a0
352 ; CHECK-NEXT: vadd.vx v10, v8, a1
353 ; CHECK-NEXT: vrgather.vi v8, v10, 0
355 %head.x = insertelement <16 x i16> poison, i16 %x, i32 0
356 %splat.x = shufflevector <16 x i16> %head.x, <16 x i16> poison, <16 x i32> zeroinitializer
357 %head.y = insertelement <16 x i16> poison, i16 %y, i32 0
358 %splat.y = shufflevector <16 x i16> %head.y, <16 x i16> poison, <16 x i32> zeroinitializer
359 %v = add <16 x i16> %splat.x, %splat.y
363 define <32 x i16> @v32i16(i16 %x, i16 %y) {
364 ; CHECK-LABEL: v32i16:
366 ; CHECK-NEXT: li a2, 32
367 ; CHECK-NEXT: vsetvli zero, a2, e16, m4, ta, ma
368 ; CHECK-NEXT: vmv.v.x v8, a0
369 ; CHECK-NEXT: vadd.vx v12, v8, a1
370 ; CHECK-NEXT: vrgather.vi v8, v12, 0
372 %head.x = insertelement <32 x i16> poison, i16 %x, i32 0
373 %splat.x = shufflevector <32 x i16> %head.x, <32 x i16> poison, <32 x i32> zeroinitializer
374 %head.y = insertelement <32 x i16> poison, i16 %y, i32 0
375 %splat.y = shufflevector <32 x i16> %head.y, <32 x i16> poison, <32 x i32> zeroinitializer
376 %v = add <32 x i16> %splat.x, %splat.y
380 define <1 x i32> @v1i32(i32 %x, i32 %y) {
381 ; CHECK-LABEL: v1i32:
383 ; CHECK-NEXT: vsetivli zero, 1, e32, mf2, ta, ma
384 ; CHECK-NEXT: vmv.s.x v8, a0
385 ; CHECK-NEXT: vadd.vx v8, v8, a1
387 %head.x = insertelement <1 x i32> poison, i32 %x, i32 0
388 %splat.x = shufflevector <1 x i32> %head.x, <1 x i32> poison, <1 x i32> zeroinitializer
389 %head.y = insertelement <1 x i32> poison, i32 %y, i32 0
390 %splat.y = shufflevector <1 x i32> %head.y, <1 x i32> poison, <1 x i32> zeroinitializer
391 %v = add <1 x i32> %splat.x, %splat.y
395 define <2 x i32> @v2i32(i32 %x, i32 %y) {
396 ; CHECK-LABEL: v2i32:
398 ; CHECK-NEXT: vsetivli zero, 2, e32, mf2, ta, ma
399 ; CHECK-NEXT: vmv.v.x v8, a0
400 ; CHECK-NEXT: vadd.vx v9, v8, a1
401 ; CHECK-NEXT: vrgather.vi v8, v9, 0
403 %head.x = insertelement <2 x i32> poison, i32 %x, i32 0
404 %splat.x = shufflevector <2 x i32> %head.x, <2 x i32> poison, <2 x i32> zeroinitializer
405 %head.y = insertelement <2 x i32> poison, i32 %y, i32 0
406 %splat.y = shufflevector <2 x i32> %head.y, <2 x i32> poison, <2 x i32> zeroinitializer
407 %v = add <2 x i32> %splat.x, %splat.y
411 define <4 x i32> @v4i32(i32 %x, i32 %y) {
412 ; CHECK-LABEL: v4i32:
414 ; CHECK-NEXT: vsetivli zero, 4, e32, m1, ta, ma
415 ; CHECK-NEXT: vmv.v.x v8, a0
416 ; CHECK-NEXT: vadd.vx v9, v8, a1
417 ; CHECK-NEXT: vrgather.vi v8, v9, 0
419 %head.x = insertelement <4 x i32> poison, i32 %x, i32 0
420 %splat.x = shufflevector <4 x i32> %head.x, <4 x i32> poison, <4 x i32> zeroinitializer
421 %head.y = insertelement <4 x i32> poison, i32 %y, i32 0
422 %splat.y = shufflevector <4 x i32> %head.y, <4 x i32> poison, <4 x i32> zeroinitializer
423 %v = add <4 x i32> %splat.x, %splat.y
427 define <8 x i32> @v8i32(i32 %x, i32 %y) {
428 ; CHECK-LABEL: v8i32:
430 ; CHECK-NEXT: vsetivli zero, 8, e32, m2, ta, ma
431 ; CHECK-NEXT: vmv.v.x v8, a0
432 ; CHECK-NEXT: vadd.vx v10, v8, a1
433 ; CHECK-NEXT: vrgather.vi v8, v10, 0
435 %head.x = insertelement <8 x i32> poison, i32 %x, i32 0
436 %splat.x = shufflevector <8 x i32> %head.x, <8 x i32> poison, <8 x i32> zeroinitializer
437 %head.y = insertelement <8 x i32> poison, i32 %y, i32 0
438 %splat.y = shufflevector <8 x i32> %head.y, <8 x i32> poison, <8 x i32> zeroinitializer
439 %v = add <8 x i32> %splat.x, %splat.y
443 define <16 x i32> @v16i32(i32 %x, i32 %y) {
444 ; CHECK-LABEL: v16i32:
446 ; CHECK-NEXT: vsetivli zero, 16, e32, m4, ta, ma
447 ; CHECK-NEXT: vmv.v.x v8, a0
448 ; CHECK-NEXT: vadd.vx v12, v8, a1
449 ; CHECK-NEXT: vrgather.vi v8, v12, 0
451 %head.x = insertelement <16 x i32> poison, i32 %x, i32 0
452 %splat.x = shufflevector <16 x i32> %head.x, <16 x i32> poison, <16 x i32> zeroinitializer
453 %head.y = insertelement <16 x i32> poison, i32 %y, i32 0
454 %splat.y = shufflevector <16 x i32> %head.y, <16 x i32> poison, <16 x i32> zeroinitializer
455 %v = add <16 x i32> %splat.x, %splat.y
459 define <1 x i64> @v1i64(i64 %x, i64 %y) {
462 ; RV32-NEXT: addi sp, sp, -16
463 ; RV32-NEXT: .cfi_def_cfa_offset 16
464 ; RV32-NEXT: sw a1, 12(sp)
465 ; RV32-NEXT: sw a0, 8(sp)
466 ; RV32-NEXT: addi a0, sp, 8
467 ; RV32-NEXT: vsetivli zero, 1, e64, m1, ta, ma
468 ; RV32-NEXT: vlse64.v v8, (a0), zero
469 ; RV32-NEXT: sw a3, 4(sp)
470 ; RV32-NEXT: sw a2, 0(sp)
471 ; RV32-NEXT: mv a0, sp
472 ; RV32-NEXT: vlse64.v v9, (a0), zero
473 ; RV32-NEXT: vadd.vv v8, v8, v9
474 ; RV32-NEXT: addi sp, sp, 16
479 ; RV64-NEXT: vsetivli zero, 1, e64, m1, ta, ma
480 ; RV64-NEXT: vmv.s.x v8, a0
481 ; RV64-NEXT: vadd.vx v8, v8, a1
483 %head.x = insertelement <1 x i64> poison, i64 %x, i32 0
484 %splat.x = shufflevector <1 x i64> %head.x, <1 x i64> poison, <1 x i32> zeroinitializer
485 %head.y = insertelement <1 x i64> poison, i64 %y, i32 0
486 %splat.y = shufflevector <1 x i64> %head.y, <1 x i64> poison, <1 x i32> zeroinitializer
487 %v = add <1 x i64> %splat.x, %splat.y
491 define <2 x i64> @v2i64(i64 %x, i64 %y) {
494 ; RV32-NEXT: addi sp, sp, -16
495 ; RV32-NEXT: .cfi_def_cfa_offset 16
496 ; RV32-NEXT: sw a1, 12(sp)
497 ; RV32-NEXT: sw a0, 8(sp)
498 ; RV32-NEXT: addi a0, sp, 8
499 ; RV32-NEXT: vsetivli zero, 2, e64, m1, ta, ma
500 ; RV32-NEXT: vlse64.v v8, (a0), zero
501 ; RV32-NEXT: sw a3, 4(sp)
502 ; RV32-NEXT: sw a2, 0(sp)
503 ; RV32-NEXT: mv a0, sp
504 ; RV32-NEXT: vlse64.v v9, (a0), zero
505 ; RV32-NEXT: vadd.vv v9, v8, v9
506 ; RV32-NEXT: vrgather.vi v8, v9, 0
507 ; RV32-NEXT: addi sp, sp, 16
512 ; RV64-NEXT: vsetivli zero, 2, e64, m1, ta, ma
513 ; RV64-NEXT: vmv.v.x v8, a0
514 ; RV64-NEXT: vadd.vx v9, v8, a1
515 ; RV64-NEXT: vrgather.vi v8, v9, 0
517 %head.x = insertelement <2 x i64> poison, i64 %x, i32 0
518 %splat.x = shufflevector <2 x i64> %head.x, <2 x i64> poison, <2 x i32> zeroinitializer
519 %head.y = insertelement <2 x i64> poison, i64 %y, i32 0
520 %splat.y = shufflevector <2 x i64> %head.y, <2 x i64> poison, <2 x i32> zeroinitializer
521 %v = add <2 x i64> %splat.x, %splat.y
525 define <4 x i64> @v4i64(i64 %x, i64 %y) {
528 ; RV32-NEXT: addi sp, sp, -16
529 ; RV32-NEXT: .cfi_def_cfa_offset 16
530 ; RV32-NEXT: sw a1, 12(sp)
531 ; RV32-NEXT: sw a0, 8(sp)
532 ; RV32-NEXT: addi a0, sp, 8
533 ; RV32-NEXT: vsetivli zero, 4, e64, m2, ta, ma
534 ; RV32-NEXT: vlse64.v v8, (a0), zero
535 ; RV32-NEXT: sw a3, 4(sp)
536 ; RV32-NEXT: sw a2, 0(sp)
537 ; RV32-NEXT: mv a0, sp
538 ; RV32-NEXT: vlse64.v v10, (a0), zero
539 ; RV32-NEXT: vadd.vv v10, v8, v10
540 ; RV32-NEXT: vrgather.vi v8, v10, 0
541 ; RV32-NEXT: addi sp, sp, 16
546 ; RV64-NEXT: vsetivli zero, 4, e64, m2, ta, ma
547 ; RV64-NEXT: vmv.v.x v8, a0
548 ; RV64-NEXT: vadd.vx v10, v8, a1
549 ; RV64-NEXT: vrgather.vi v8, v10, 0
551 %head.x = insertelement <4 x i64> poison, i64 %x, i32 0
552 %splat.x = shufflevector <4 x i64> %head.x, <4 x i64> poison, <4 x i32> zeroinitializer
553 %head.y = insertelement <4 x i64> poison, i64 %y, i32 0
554 %splat.y = shufflevector <4 x i64> %head.y, <4 x i64> poison, <4 x i32> zeroinitializer
555 %v = add <4 x i64> %splat.x, %splat.y
559 define <8 x i64> @v8i64(i64 %x, i64 %y) {
562 ; RV32-NEXT: addi sp, sp, -16
563 ; RV32-NEXT: .cfi_def_cfa_offset 16
564 ; RV32-NEXT: sw a1, 12(sp)
565 ; RV32-NEXT: sw a0, 8(sp)
566 ; RV32-NEXT: addi a0, sp, 8
567 ; RV32-NEXT: vsetivli zero, 8, e64, m4, ta, ma
568 ; RV32-NEXT: vlse64.v v8, (a0), zero
569 ; RV32-NEXT: sw a3, 4(sp)
570 ; RV32-NEXT: sw a2, 0(sp)
571 ; RV32-NEXT: mv a0, sp
572 ; RV32-NEXT: vlse64.v v12, (a0), zero
573 ; RV32-NEXT: vadd.vv v12, v8, v12
574 ; RV32-NEXT: vrgather.vi v8, v12, 0
575 ; RV32-NEXT: addi sp, sp, 16
580 ; RV64-NEXT: vsetivli zero, 8, e64, m4, ta, ma
581 ; RV64-NEXT: vmv.v.x v8, a0
582 ; RV64-NEXT: vadd.vx v12, v8, a1
583 ; RV64-NEXT: vrgather.vi v8, v12, 0
585 %head.x = insertelement <8 x i64> poison, i64 %x, i32 0
586 %splat.x = shufflevector <8 x i64> %head.x, <8 x i64> poison, <8 x i32> zeroinitializer
587 %head.y = insertelement <8 x i64> poison, i64 %y, i32 0
588 %splat.y = shufflevector <8 x i64> %head.y, <8 x i64> poison, <8 x i32> zeroinitializer
589 %v = add <8 x i64> %splat.x, %splat.y
593 define <4 x half> @v4f16(half %x, half %y) {
594 ; CHECK-LABEL: v4f16:
596 ; CHECK-NEXT: vsetivli zero, 4, e16, mf2, ta, ma
597 ; CHECK-NEXT: vfmv.v.f v8, fa0
598 ; CHECK-NEXT: vfadd.vf v9, v8, fa1
599 ; CHECK-NEXT: vrgather.vi v8, v9, 0
601 %head.x = insertelement <4 x half> poison, half %x, i32 0
602 %splat.x = shufflevector <4 x half> %head.x, <4 x half> poison, <4 x i32> zeroinitializer
603 %head.y = insertelement <4 x half> poison, half %y, i32 0
604 %splat.y = shufflevector <4 x half> %head.y, <4 x half> poison, <4 x i32> zeroinitializer
605 %v = fadd <4 x half> %splat.x, %splat.y
609 define <2 x float> @v2f32(float %x, float %y) {
610 ; CHECK-LABEL: v2f32:
612 ; CHECK-NEXT: vsetivli zero, 2, e32, mf2, ta, ma
613 ; CHECK-NEXT: vfmv.v.f v8, fa0
614 ; CHECK-NEXT: vfadd.vf v9, v8, fa1
615 ; CHECK-NEXT: vrgather.vi v8, v9, 0
617 %head.x = insertelement <2 x float> poison, float %x, i32 0
618 %splat.x = shufflevector <2 x float> %head.x, <2 x float> poison, <2 x i32> zeroinitializer
619 %head.y = insertelement <2 x float> poison, float %y, i32 0
620 %splat.y = shufflevector <2 x float> %head.y, <2 x float> poison, <2 x i32> zeroinitializer
621 %v = fadd <2 x float> %splat.x, %splat.y
625 define <1 x double> @v2f64(double %x, double %y) {
626 ; CHECK-LABEL: v2f64:
628 ; CHECK-NEXT: vsetivli zero, 1, e64, m1, ta, ma
629 ; CHECK-NEXT: vfmv.s.f v8, fa0
630 ; CHECK-NEXT: vfadd.vf v8, v8, fa1
632 %head.x = insertelement <1 x double> poison, double %x, i32 0
633 %splat.x = shufflevector <1 x double> %head.x, <1 x double> poison, <1 x i32> zeroinitializer
634 %head.y = insertelement <1 x double> poison, double %y, i32 0
635 %splat.y = shufflevector <1 x double> %head.y, <1 x double> poison, <1 x i32> zeroinitializer
636 %v = fadd <1 x double> %splat.x, %splat.y