1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=riscv32 -mattr=+v -verify-machineinstrs < %s \
3 ; RUN: | FileCheck %s --check-prefixes=CHECK,RV32
4 ; RUN: llc -mtriple=riscv64 -mattr=+v -verify-machineinstrs < %s \
5 ; RUN: | FileCheck %s --check-prefixes=CHECK,RV64
7 declare <2 x i8> @llvm.sadd.sat.v2i8(<2 x i8>, <2 x i8>)
9 define <2 x i8> @sadd_v2i8_vv(<2 x i8> %va, <2 x i8> %b) {
10 ; CHECK-LABEL: sadd_v2i8_vv:
12 ; CHECK-NEXT: vsetivli zero, 2, e8, mf8, ta, ma
13 ; CHECK-NEXT: vsadd.vv v8, v8, v9
15 %v = call <2 x i8> @llvm.sadd.sat.v2i8(<2 x i8> %va, <2 x i8> %b)
19 define <2 x i8> @sadd_v2i8_vx(<2 x i8> %va, i8 %b) {
20 ; CHECK-LABEL: sadd_v2i8_vx:
22 ; CHECK-NEXT: vsetivli zero, 2, e8, mf8, ta, ma
23 ; CHECK-NEXT: vsadd.vx v8, v8, a0
25 %elt.head = insertelement <2 x i8> poison, i8 %b, i32 0
26 %vb = shufflevector <2 x i8> %elt.head, <2 x i8> poison, <2 x i32> zeroinitializer
27 %v = call <2 x i8> @llvm.sadd.sat.v2i8(<2 x i8> %va, <2 x i8> %vb)
31 define <2 x i8> @sadd_v2i8_vi(<2 x i8> %va) {
32 ; CHECK-LABEL: sadd_v2i8_vi:
34 ; CHECK-NEXT: vsetivli zero, 2, e8, mf8, ta, ma
35 ; CHECK-NEXT: vsadd.vi v8, v8, 5
37 %v = call <2 x i8> @llvm.sadd.sat.v2i8(<2 x i8> %va, <2 x i8> splat (i8 5))
41 declare <4 x i8> @llvm.sadd.sat.v4i8(<4 x i8>, <4 x i8>)
43 define <4 x i8> @sadd_v4i8_vv(<4 x i8> %va, <4 x i8> %b) {
44 ; CHECK-LABEL: sadd_v4i8_vv:
46 ; CHECK-NEXT: vsetivli zero, 4, e8, mf4, ta, ma
47 ; CHECK-NEXT: vsadd.vv v8, v8, v9
49 %v = call <4 x i8> @llvm.sadd.sat.v4i8(<4 x i8> %va, <4 x i8> %b)
53 define <4 x i8> @sadd_v4i8_vx(<4 x i8> %va, i8 %b) {
54 ; CHECK-LABEL: sadd_v4i8_vx:
56 ; CHECK-NEXT: vsetivli zero, 4, e8, mf4, ta, ma
57 ; CHECK-NEXT: vsadd.vx v8, v8, a0
59 %elt.head = insertelement <4 x i8> poison, i8 %b, i32 0
60 %vb = shufflevector <4 x i8> %elt.head, <4 x i8> poison, <4 x i32> zeroinitializer
61 %v = call <4 x i8> @llvm.sadd.sat.v4i8(<4 x i8> %va, <4 x i8> %vb)
65 define <4 x i8> @sadd_v4i8_vi(<4 x i8> %va) {
66 ; CHECK-LABEL: sadd_v4i8_vi:
68 ; CHECK-NEXT: vsetivli zero, 4, e8, mf4, ta, ma
69 ; CHECK-NEXT: vsadd.vi v8, v8, 5
71 %v = call <4 x i8> @llvm.sadd.sat.v4i8(<4 x i8> %va, <4 x i8> splat (i8 5))
75 declare <8 x i8> @llvm.sadd.sat.v8i8(<8 x i8>, <8 x i8>)
77 define <8 x i8> @sadd_v8i8_vv(<8 x i8> %va, <8 x i8> %b) {
78 ; CHECK-LABEL: sadd_v8i8_vv:
80 ; CHECK-NEXT: vsetivli zero, 8, e8, mf2, ta, ma
81 ; CHECK-NEXT: vsadd.vv v8, v8, v9
83 %v = call <8 x i8> @llvm.sadd.sat.v8i8(<8 x i8> %va, <8 x i8> %b)
87 define <8 x i8> @sadd_v8i8_vx(<8 x i8> %va, i8 %b) {
88 ; CHECK-LABEL: sadd_v8i8_vx:
90 ; CHECK-NEXT: vsetivli zero, 8, e8, mf2, ta, ma
91 ; CHECK-NEXT: vsadd.vx v8, v8, a0
93 %elt.head = insertelement <8 x i8> poison, i8 %b, i32 0
94 %vb = shufflevector <8 x i8> %elt.head, <8 x i8> poison, <8 x i32> zeroinitializer
95 %v = call <8 x i8> @llvm.sadd.sat.v8i8(<8 x i8> %va, <8 x i8> %vb)
99 define <8 x i8> @sadd_v8i8_vi(<8 x i8> %va) {
100 ; CHECK-LABEL: sadd_v8i8_vi:
102 ; CHECK-NEXT: vsetivli zero, 8, e8, mf2, ta, ma
103 ; CHECK-NEXT: vsadd.vi v8, v8, 5
105 %v = call <8 x i8> @llvm.sadd.sat.v8i8(<8 x i8> %va, <8 x i8> splat (i8 5))
109 declare <16 x i8> @llvm.sadd.sat.v16i8(<16 x i8>, <16 x i8>)
111 define <16 x i8> @sadd_v16i8_vv(<16 x i8> %va, <16 x i8> %b) {
112 ; CHECK-LABEL: sadd_v16i8_vv:
114 ; CHECK-NEXT: vsetivli zero, 16, e8, m1, ta, ma
115 ; CHECK-NEXT: vsadd.vv v8, v8, v9
117 %v = call <16 x i8> @llvm.sadd.sat.v16i8(<16 x i8> %va, <16 x i8> %b)
121 define <16 x i8> @sadd_v16i8_vx(<16 x i8> %va, i8 %b) {
122 ; CHECK-LABEL: sadd_v16i8_vx:
124 ; CHECK-NEXT: vsetivli zero, 16, e8, m1, ta, ma
125 ; CHECK-NEXT: vsadd.vx v8, v8, a0
127 %elt.head = insertelement <16 x i8> poison, i8 %b, i32 0
128 %vb = shufflevector <16 x i8> %elt.head, <16 x i8> poison, <16 x i32> zeroinitializer
129 %v = call <16 x i8> @llvm.sadd.sat.v16i8(<16 x i8> %va, <16 x i8> %vb)
133 define <16 x i8> @sadd_v16i8_vi(<16 x i8> %va) {
134 ; CHECK-LABEL: sadd_v16i8_vi:
136 ; CHECK-NEXT: vsetivli zero, 16, e8, m1, ta, ma
137 ; CHECK-NEXT: vsadd.vi v8, v8, 5
139 %v = call <16 x i8> @llvm.sadd.sat.v16i8(<16 x i8> %va, <16 x i8> splat (i8 5))
143 declare <2 x i16> @llvm.sadd.sat.v2i16(<2 x i16>, <2 x i16>)
145 define <2 x i16> @sadd_v2i16_vv(<2 x i16> %va, <2 x i16> %b) {
146 ; CHECK-LABEL: sadd_v2i16_vv:
148 ; CHECK-NEXT: vsetivli zero, 2, e16, mf4, ta, ma
149 ; CHECK-NEXT: vsadd.vv v8, v8, v9
151 %v = call <2 x i16> @llvm.sadd.sat.v2i16(<2 x i16> %va, <2 x i16> %b)
155 define <2 x i16> @sadd_v2i16_vx(<2 x i16> %va, i16 %b) {
156 ; CHECK-LABEL: sadd_v2i16_vx:
158 ; CHECK-NEXT: vsetivli zero, 2, e16, mf4, ta, ma
159 ; CHECK-NEXT: vsadd.vx v8, v8, a0
161 %elt.head = insertelement <2 x i16> poison, i16 %b, i32 0
162 %vb = shufflevector <2 x i16> %elt.head, <2 x i16> poison, <2 x i32> zeroinitializer
163 %v = call <2 x i16> @llvm.sadd.sat.v2i16(<2 x i16> %va, <2 x i16> %vb)
167 define <2 x i16> @sadd_v2i16_vi(<2 x i16> %va) {
168 ; CHECK-LABEL: sadd_v2i16_vi:
170 ; CHECK-NEXT: vsetivli zero, 2, e16, mf4, ta, ma
171 ; CHECK-NEXT: vsadd.vi v8, v8, 5
173 %v = call <2 x i16> @llvm.sadd.sat.v2i16(<2 x i16> %va, <2 x i16> splat (i16 5))
177 declare <4 x i16> @llvm.sadd.sat.v4i16(<4 x i16>, <4 x i16>)
179 define <4 x i16> @sadd_v4i16_vv(<4 x i16> %va, <4 x i16> %b) {
180 ; CHECK-LABEL: sadd_v4i16_vv:
182 ; CHECK-NEXT: vsetivli zero, 4, e16, mf2, ta, ma
183 ; CHECK-NEXT: vsadd.vv v8, v8, v9
185 %v = call <4 x i16> @llvm.sadd.sat.v4i16(<4 x i16> %va, <4 x i16> %b)
189 define <4 x i16> @sadd_v4i16_vx(<4 x i16> %va, i16 %b) {
190 ; CHECK-LABEL: sadd_v4i16_vx:
192 ; CHECK-NEXT: vsetivli zero, 4, e16, mf2, ta, ma
193 ; CHECK-NEXT: vsadd.vx v8, v8, a0
195 %elt.head = insertelement <4 x i16> poison, i16 %b, i32 0
196 %vb = shufflevector <4 x i16> %elt.head, <4 x i16> poison, <4 x i32> zeroinitializer
197 %v = call <4 x i16> @llvm.sadd.sat.v4i16(<4 x i16> %va, <4 x i16> %vb)
201 define <4 x i16> @sadd_v4i16_vi(<4 x i16> %va) {
202 ; CHECK-LABEL: sadd_v4i16_vi:
204 ; CHECK-NEXT: vsetivli zero, 4, e16, mf2, ta, ma
205 ; CHECK-NEXT: vsadd.vi v8, v8, 5
207 %v = call <4 x i16> @llvm.sadd.sat.v4i16(<4 x i16> %va, <4 x i16> splat (i16 5))
211 declare <8 x i16> @llvm.sadd.sat.v8i16(<8 x i16>, <8 x i16>)
213 define <8 x i16> @sadd_v8i16_vv(<8 x i16> %va, <8 x i16> %b) {
214 ; CHECK-LABEL: sadd_v8i16_vv:
216 ; CHECK-NEXT: vsetivli zero, 8, e16, m1, ta, ma
217 ; CHECK-NEXT: vsadd.vv v8, v8, v9
219 %v = call <8 x i16> @llvm.sadd.sat.v8i16(<8 x i16> %va, <8 x i16> %b)
223 define <8 x i16> @sadd_v8i16_vx(<8 x i16> %va, i16 %b) {
224 ; CHECK-LABEL: sadd_v8i16_vx:
226 ; CHECK-NEXT: vsetivli zero, 8, e16, m1, ta, ma
227 ; CHECK-NEXT: vsadd.vx v8, v8, a0
229 %elt.head = insertelement <8 x i16> poison, i16 %b, i32 0
230 %vb = shufflevector <8 x i16> %elt.head, <8 x i16> poison, <8 x i32> zeroinitializer
231 %v = call <8 x i16> @llvm.sadd.sat.v8i16(<8 x i16> %va, <8 x i16> %vb)
235 define <8 x i16> @sadd_v8i16_vi(<8 x i16> %va) {
236 ; CHECK-LABEL: sadd_v8i16_vi:
238 ; CHECK-NEXT: vsetivli zero, 8, e16, m1, ta, ma
239 ; CHECK-NEXT: vsadd.vi v8, v8, 5
241 %v = call <8 x i16> @llvm.sadd.sat.v8i16(<8 x i16> %va, <8 x i16> splat (i16 5))
245 declare <16 x i16> @llvm.sadd.sat.v16i16(<16 x i16>, <16 x i16>)
247 define <16 x i16> @sadd_v16i16_vv(<16 x i16> %va, <16 x i16> %b) {
248 ; CHECK-LABEL: sadd_v16i16_vv:
250 ; CHECK-NEXT: vsetivli zero, 16, e16, m2, ta, ma
251 ; CHECK-NEXT: vsadd.vv v8, v8, v10
253 %v = call <16 x i16> @llvm.sadd.sat.v16i16(<16 x i16> %va, <16 x i16> %b)
257 define <16 x i16> @sadd_v16i16_vx(<16 x i16> %va, i16 %b) {
258 ; CHECK-LABEL: sadd_v16i16_vx:
260 ; CHECK-NEXT: vsetivli zero, 16, e16, m2, ta, ma
261 ; CHECK-NEXT: vsadd.vx v8, v8, a0
263 %elt.head = insertelement <16 x i16> poison, i16 %b, i32 0
264 %vb = shufflevector <16 x i16> %elt.head, <16 x i16> poison, <16 x i32> zeroinitializer
265 %v = call <16 x i16> @llvm.sadd.sat.v16i16(<16 x i16> %va, <16 x i16> %vb)
269 define <16 x i16> @sadd_v16i16_vi(<16 x i16> %va) {
270 ; CHECK-LABEL: sadd_v16i16_vi:
272 ; CHECK-NEXT: vsetivli zero, 16, e16, m2, ta, ma
273 ; CHECK-NEXT: vsadd.vi v8, v8, 5
275 %v = call <16 x i16> @llvm.sadd.sat.v16i16(<16 x i16> %va, <16 x i16> splat (i16 5))
279 declare <2 x i32> @llvm.sadd.sat.v2i32(<2 x i32>, <2 x i32>)
281 define <2 x i32> @sadd_v2i32_vv(<2 x i32> %va, <2 x i32> %b) {
282 ; CHECK-LABEL: sadd_v2i32_vv:
284 ; CHECK-NEXT: vsetivli zero, 2, e32, mf2, ta, ma
285 ; CHECK-NEXT: vsadd.vv v8, v8, v9
287 %v = call <2 x i32> @llvm.sadd.sat.v2i32(<2 x i32> %va, <2 x i32> %b)
291 define <2 x i32> @sadd_v2i32_vx(<2 x i32> %va, i32 %b) {
292 ; CHECK-LABEL: sadd_v2i32_vx:
294 ; CHECK-NEXT: vsetivli zero, 2, e32, mf2, ta, ma
295 ; CHECK-NEXT: vsadd.vx v8, v8, a0
297 %elt.head = insertelement <2 x i32> poison, i32 %b, i32 0
298 %vb = shufflevector <2 x i32> %elt.head, <2 x i32> poison, <2 x i32> zeroinitializer
299 %v = call <2 x i32> @llvm.sadd.sat.v2i32(<2 x i32> %va, <2 x i32> %vb)
303 define <2 x i32> @sadd_v2i32_vx_commute(<2 x i32> %va, i32 %b) {
304 ; CHECK-LABEL: sadd_v2i32_vx_commute:
306 ; CHECK-NEXT: vsetivli zero, 2, e32, mf2, ta, ma
307 ; CHECK-NEXT: vsadd.vx v8, v8, a0
309 %elt.head = insertelement <2 x i32> poison, i32 %b, i32 0
310 %vb = shufflevector <2 x i32> %elt.head, <2 x i32> poison, <2 x i32> zeroinitializer
311 %v = call <2 x i32> @llvm.sadd.sat.v2i32(<2 x i32> %vb, <2 x i32> %va)
315 define <2 x i32> @sadd_v2i32_vi(<2 x i32> %va) {
316 ; CHECK-LABEL: sadd_v2i32_vi:
318 ; CHECK-NEXT: vsetivli zero, 2, e32, mf2, ta, ma
319 ; CHECK-NEXT: vsadd.vi v8, v8, 5
321 %v = call <2 x i32> @llvm.sadd.sat.v2i32(<2 x i32> %va, <2 x i32> splat (i32 5))
325 declare <4 x i32> @llvm.sadd.sat.v4i32(<4 x i32>, <4 x i32>)
327 define <4 x i32> @sadd_v4i32_vv(<4 x i32> %va, <4 x i32> %b) {
328 ; CHECK-LABEL: sadd_v4i32_vv:
330 ; CHECK-NEXT: vsetivli zero, 4, e32, m1, ta, ma
331 ; CHECK-NEXT: vsadd.vv v8, v8, v9
333 %v = call <4 x i32> @llvm.sadd.sat.v4i32(<4 x i32> %va, <4 x i32> %b)
337 define <4 x i32> @sadd_v4i32_vx(<4 x i32> %va, i32 %b) {
338 ; CHECK-LABEL: sadd_v4i32_vx:
340 ; CHECK-NEXT: vsetivli zero, 4, e32, m1, ta, ma
341 ; CHECK-NEXT: vsadd.vx v8, v8, a0
343 %elt.head = insertelement <4 x i32> poison, i32 %b, i32 0
344 %vb = shufflevector <4 x i32> %elt.head, <4 x i32> poison, <4 x i32> zeroinitializer
345 %v = call <4 x i32> @llvm.sadd.sat.v4i32(<4 x i32> %va, <4 x i32> %vb)
349 define <4 x i32> @sadd_v4i32_vi(<4 x i32> %va) {
350 ; CHECK-LABEL: sadd_v4i32_vi:
352 ; CHECK-NEXT: vsetivli zero, 4, e32, m1, ta, ma
353 ; CHECK-NEXT: vsadd.vi v8, v8, 5
355 %v = call <4 x i32> @llvm.sadd.sat.v4i32(<4 x i32> %va, <4 x i32> splat (i32 5))
359 declare <8 x i32> @llvm.sadd.sat.v8i32(<8 x i32>, <8 x i32>)
361 define <8 x i32> @sadd_v8i32_vv(<8 x i32> %va, <8 x i32> %b) {
362 ; CHECK-LABEL: sadd_v8i32_vv:
364 ; CHECK-NEXT: vsetivli zero, 8, e32, m2, ta, ma
365 ; CHECK-NEXT: vsadd.vv v8, v8, v10
367 %v = call <8 x i32> @llvm.sadd.sat.v8i32(<8 x i32> %va, <8 x i32> %b)
371 define <8 x i32> @sadd_v8i32_vx(<8 x i32> %va, i32 %b) {
372 ; CHECK-LABEL: sadd_v8i32_vx:
374 ; CHECK-NEXT: vsetivli zero, 8, e32, m2, ta, ma
375 ; CHECK-NEXT: vsadd.vx v8, v8, a0
377 %elt.head = insertelement <8 x i32> poison, i32 %b, i32 0
378 %vb = shufflevector <8 x i32> %elt.head, <8 x i32> poison, <8 x i32> zeroinitializer
379 %v = call <8 x i32> @llvm.sadd.sat.v8i32(<8 x i32> %va, <8 x i32> %vb)
383 define <8 x i32> @sadd_v8i32_vi(<8 x i32> %va) {
384 ; CHECK-LABEL: sadd_v8i32_vi:
386 ; CHECK-NEXT: vsetivli zero, 8, e32, m2, ta, ma
387 ; CHECK-NEXT: vsadd.vi v8, v8, 5
389 %v = call <8 x i32> @llvm.sadd.sat.v8i32(<8 x i32> %va, <8 x i32> splat (i32 5))
393 declare <16 x i32> @llvm.sadd.sat.v16i32(<16 x i32>, <16 x i32>)
395 define <16 x i32> @sadd_v16i32_vv(<16 x i32> %va, <16 x i32> %b) {
396 ; CHECK-LABEL: sadd_v16i32_vv:
398 ; CHECK-NEXT: vsetivli zero, 16, e32, m4, ta, ma
399 ; CHECK-NEXT: vsadd.vv v8, v8, v12
401 %v = call <16 x i32> @llvm.sadd.sat.v16i32(<16 x i32> %va, <16 x i32> %b)
405 define <16 x i32> @sadd_v16i32_vx(<16 x i32> %va, i32 %b) {
406 ; CHECK-LABEL: sadd_v16i32_vx:
408 ; CHECK-NEXT: vsetivli zero, 16, e32, m4, ta, ma
409 ; CHECK-NEXT: vsadd.vx v8, v8, a0
411 %elt.head = insertelement <16 x i32> poison, i32 %b, i32 0
412 %vb = shufflevector <16 x i32> %elt.head, <16 x i32> poison, <16 x i32> zeroinitializer
413 %v = call <16 x i32> @llvm.sadd.sat.v16i32(<16 x i32> %va, <16 x i32> %vb)
417 define <16 x i32> @sadd_v16i32_vi(<16 x i32> %va) {
418 ; CHECK-LABEL: sadd_v16i32_vi:
420 ; CHECK-NEXT: vsetivli zero, 16, e32, m4, ta, ma
421 ; CHECK-NEXT: vsadd.vi v8, v8, 5
423 %v = call <16 x i32> @llvm.sadd.sat.v16i32(<16 x i32> %va, <16 x i32> splat (i32 5))
427 declare <2 x i64> @llvm.sadd.sat.v2i64(<2 x i64>, <2 x i64>)
429 define <2 x i64> @sadd_v2i64_vv(<2 x i64> %va, <2 x i64> %b) {
430 ; CHECK-LABEL: sadd_v2i64_vv:
432 ; CHECK-NEXT: vsetivli zero, 2, e64, m1, ta, ma
433 ; CHECK-NEXT: vsadd.vv v8, v8, v9
435 %v = call <2 x i64> @llvm.sadd.sat.v2i64(<2 x i64> %va, <2 x i64> %b)
439 define <2 x i64> @sadd_v2i64_vx(<2 x i64> %va, i64 %b) {
440 ; RV32-LABEL: sadd_v2i64_vx:
442 ; RV32-NEXT: addi sp, sp, -16
443 ; RV32-NEXT: .cfi_def_cfa_offset 16
444 ; RV32-NEXT: sw a1, 12(sp)
445 ; RV32-NEXT: sw a0, 8(sp)
446 ; RV32-NEXT: addi a0, sp, 8
447 ; RV32-NEXT: vsetivli zero, 2, e64, m1, ta, ma
448 ; RV32-NEXT: vlse64.v v9, (a0), zero
449 ; RV32-NEXT: vsadd.vv v8, v8, v9
450 ; RV32-NEXT: addi sp, sp, 16
453 ; RV64-LABEL: sadd_v2i64_vx:
455 ; RV64-NEXT: vsetivli zero, 2, e64, m1, ta, ma
456 ; RV64-NEXT: vsadd.vx v8, v8, a0
458 %elt.head = insertelement <2 x i64> poison, i64 %b, i32 0
459 %vb = shufflevector <2 x i64> %elt.head, <2 x i64> poison, <2 x i32> zeroinitializer
460 %v = call <2 x i64> @llvm.sadd.sat.v2i64(<2 x i64> %va, <2 x i64> %vb)
464 define <2 x i64> @sadd_v2i64_vi(<2 x i64> %va) {
465 ; CHECK-LABEL: sadd_v2i64_vi:
467 ; CHECK-NEXT: vsetivli zero, 2, e64, m1, ta, ma
468 ; CHECK-NEXT: vsadd.vi v8, v8, 5
470 %v = call <2 x i64> @llvm.sadd.sat.v2i64(<2 x i64> %va, <2 x i64> splat (i64 5))
474 declare <4 x i64> @llvm.sadd.sat.v4i64(<4 x i64>, <4 x i64>)
476 define <4 x i64> @sadd_v4i64_vv(<4 x i64> %va, <4 x i64> %b) {
477 ; CHECK-LABEL: sadd_v4i64_vv:
479 ; CHECK-NEXT: vsetivli zero, 4, e64, m2, ta, ma
480 ; CHECK-NEXT: vsadd.vv v8, v8, v10
482 %v = call <4 x i64> @llvm.sadd.sat.v4i64(<4 x i64> %va, <4 x i64> %b)
486 define <4 x i64> @sadd_v4i64_vx(<4 x i64> %va, i64 %b) {
487 ; RV32-LABEL: sadd_v4i64_vx:
489 ; RV32-NEXT: addi sp, sp, -16
490 ; RV32-NEXT: .cfi_def_cfa_offset 16
491 ; RV32-NEXT: sw a1, 12(sp)
492 ; RV32-NEXT: sw a0, 8(sp)
493 ; RV32-NEXT: addi a0, sp, 8
494 ; RV32-NEXT: vsetivli zero, 4, e64, m2, ta, ma
495 ; RV32-NEXT: vlse64.v v10, (a0), zero
496 ; RV32-NEXT: vsadd.vv v8, v8, v10
497 ; RV32-NEXT: addi sp, sp, 16
500 ; RV64-LABEL: sadd_v4i64_vx:
502 ; RV64-NEXT: vsetivli zero, 4, e64, m2, ta, ma
503 ; RV64-NEXT: vsadd.vx v8, v8, a0
505 %elt.head = insertelement <4 x i64> poison, i64 %b, i32 0
506 %vb = shufflevector <4 x i64> %elt.head, <4 x i64> poison, <4 x i32> zeroinitializer
507 %v = call <4 x i64> @llvm.sadd.sat.v4i64(<4 x i64> %va, <4 x i64> %vb)
511 define <4 x i64> @sadd_v4i64_vi(<4 x i64> %va) {
512 ; CHECK-LABEL: sadd_v4i64_vi:
514 ; CHECK-NEXT: vsetivli zero, 4, e64, m2, ta, ma
515 ; CHECK-NEXT: vsadd.vi v8, v8, 5
517 %v = call <4 x i64> @llvm.sadd.sat.v4i64(<4 x i64> %va, <4 x i64> splat (i64 5))
521 declare <8 x i64> @llvm.sadd.sat.v8i64(<8 x i64>, <8 x i64>)
523 define <8 x i64> @sadd_v8i64_vv(<8 x i64> %va, <8 x i64> %b) {
524 ; CHECK-LABEL: sadd_v8i64_vv:
526 ; CHECK-NEXT: vsetivli zero, 8, e64, m4, ta, ma
527 ; CHECK-NEXT: vsadd.vv v8, v8, v12
529 %v = call <8 x i64> @llvm.sadd.sat.v8i64(<8 x i64> %va, <8 x i64> %b)
533 define <8 x i64> @sadd_v8i64_vx(<8 x i64> %va, i64 %b) {
534 ; RV32-LABEL: sadd_v8i64_vx:
536 ; RV32-NEXT: addi sp, sp, -16
537 ; RV32-NEXT: .cfi_def_cfa_offset 16
538 ; RV32-NEXT: sw a1, 12(sp)
539 ; RV32-NEXT: sw a0, 8(sp)
540 ; RV32-NEXT: addi a0, sp, 8
541 ; RV32-NEXT: vsetivli zero, 8, e64, m4, ta, ma
542 ; RV32-NEXT: vlse64.v v12, (a0), zero
543 ; RV32-NEXT: vsadd.vv v8, v8, v12
544 ; RV32-NEXT: addi sp, sp, 16
547 ; RV64-LABEL: sadd_v8i64_vx:
549 ; RV64-NEXT: vsetivli zero, 8, e64, m4, ta, ma
550 ; RV64-NEXT: vsadd.vx v8, v8, a0
552 %elt.head = insertelement <8 x i64> poison, i64 %b, i32 0
553 %vb = shufflevector <8 x i64> %elt.head, <8 x i64> poison, <8 x i32> zeroinitializer
554 %v = call <8 x i64> @llvm.sadd.sat.v8i64(<8 x i64> %va, <8 x i64> %vb)
558 define <8 x i64> @sadd_v8i64_vi(<8 x i64> %va) {
559 ; CHECK-LABEL: sadd_v8i64_vi:
561 ; CHECK-NEXT: vsetivli zero, 8, e64, m4, ta, ma
562 ; CHECK-NEXT: vsadd.vi v8, v8, 5
564 %v = call <8 x i64> @llvm.sadd.sat.v8i64(<8 x i64> %va, <8 x i64> splat (i64 5))
568 declare <16 x i64> @llvm.sadd.sat.v16i64(<16 x i64>, <16 x i64>)
570 define <16 x i64> @sadd_v16i64_vv(<16 x i64> %va, <16 x i64> %b) {
571 ; CHECK-LABEL: sadd_v16i64_vv:
573 ; CHECK-NEXT: vsetivli zero, 16, e64, m8, ta, ma
574 ; CHECK-NEXT: vsadd.vv v8, v8, v16
576 %v = call <16 x i64> @llvm.sadd.sat.v16i64(<16 x i64> %va, <16 x i64> %b)
580 define <16 x i64> @sadd_v16i64_vx(<16 x i64> %va, i64 %b) {
581 ; RV32-LABEL: sadd_v16i64_vx:
583 ; RV32-NEXT: addi sp, sp, -16
584 ; RV32-NEXT: .cfi_def_cfa_offset 16
585 ; RV32-NEXT: sw a1, 12(sp)
586 ; RV32-NEXT: sw a0, 8(sp)
587 ; RV32-NEXT: addi a0, sp, 8
588 ; RV32-NEXT: vsetivli zero, 16, e64, m8, ta, ma
589 ; RV32-NEXT: vlse64.v v16, (a0), zero
590 ; RV32-NEXT: vsadd.vv v8, v8, v16
591 ; RV32-NEXT: addi sp, sp, 16
594 ; RV64-LABEL: sadd_v16i64_vx:
596 ; RV64-NEXT: vsetivli zero, 16, e64, m8, ta, ma
597 ; RV64-NEXT: vsadd.vx v8, v8, a0
599 %elt.head = insertelement <16 x i64> poison, i64 %b, i32 0
600 %vb = shufflevector <16 x i64> %elt.head, <16 x i64> poison, <16 x i32> zeroinitializer
601 %v = call <16 x i64> @llvm.sadd.sat.v16i64(<16 x i64> %va, <16 x i64> %vb)
605 define <16 x i64> @sadd_v16i64_vi(<16 x i64> %va) {
606 ; CHECK-LABEL: sadd_v16i64_vi:
608 ; CHECK-NEXT: vsetivli zero, 16, e64, m8, ta, ma
609 ; CHECK-NEXT: vsadd.vi v8, v8, 5
611 %v = call <16 x i64> @llvm.sadd.sat.v16i64(<16 x i64> %va, <16 x i64> splat (i64 5))