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 %elt.head = insertelement <2 x i8> poison, i8 5, i32 0
38 %vb = shufflevector <2 x i8> %elt.head, <2 x i8> poison, <2 x i32> zeroinitializer
39 %v = call <2 x i8> @llvm.sadd.sat.v2i8(<2 x i8> %va, <2 x i8> %vb)
43 declare <4 x i8> @llvm.sadd.sat.v4i8(<4 x i8>, <4 x i8>)
45 define <4 x i8> @sadd_v4i8_vv(<4 x i8> %va, <4 x i8> %b) {
46 ; CHECK-LABEL: sadd_v4i8_vv:
48 ; CHECK-NEXT: vsetivli zero, 4, e8, mf4, ta, ma
49 ; CHECK-NEXT: vsadd.vv v8, v8, v9
51 %v = call <4 x i8> @llvm.sadd.sat.v4i8(<4 x i8> %va, <4 x i8> %b)
55 define <4 x i8> @sadd_v4i8_vx(<4 x i8> %va, i8 %b) {
56 ; CHECK-LABEL: sadd_v4i8_vx:
58 ; CHECK-NEXT: vsetivli zero, 4, e8, mf4, ta, ma
59 ; CHECK-NEXT: vsadd.vx v8, v8, a0
61 %elt.head = insertelement <4 x i8> poison, i8 %b, i32 0
62 %vb = shufflevector <4 x i8> %elt.head, <4 x i8> poison, <4 x i32> zeroinitializer
63 %v = call <4 x i8> @llvm.sadd.sat.v4i8(<4 x i8> %va, <4 x i8> %vb)
67 define <4 x i8> @sadd_v4i8_vi(<4 x i8> %va) {
68 ; CHECK-LABEL: sadd_v4i8_vi:
70 ; CHECK-NEXT: vsetivli zero, 4, e8, mf4, ta, ma
71 ; CHECK-NEXT: vsadd.vi v8, v8, 5
73 %elt.head = insertelement <4 x i8> poison, i8 5, i32 0
74 %vb = shufflevector <4 x i8> %elt.head, <4 x i8> poison, <4 x i32> zeroinitializer
75 %v = call <4 x i8> @llvm.sadd.sat.v4i8(<4 x i8> %va, <4 x i8> %vb)
79 declare <8 x i8> @llvm.sadd.sat.v8i8(<8 x i8>, <8 x i8>)
81 define <8 x i8> @sadd_v8i8_vv(<8 x i8> %va, <8 x i8> %b) {
82 ; CHECK-LABEL: sadd_v8i8_vv:
84 ; CHECK-NEXT: vsetivli zero, 8, e8, mf2, ta, ma
85 ; CHECK-NEXT: vsadd.vv v8, v8, v9
87 %v = call <8 x i8> @llvm.sadd.sat.v8i8(<8 x i8> %va, <8 x i8> %b)
91 define <8 x i8> @sadd_v8i8_vx(<8 x i8> %va, i8 %b) {
92 ; CHECK-LABEL: sadd_v8i8_vx:
94 ; CHECK-NEXT: vsetivli zero, 8, e8, mf2, ta, ma
95 ; CHECK-NEXT: vsadd.vx v8, v8, a0
97 %elt.head = insertelement <8 x i8> poison, i8 %b, i32 0
98 %vb = shufflevector <8 x i8> %elt.head, <8 x i8> poison, <8 x i32> zeroinitializer
99 %v = call <8 x i8> @llvm.sadd.sat.v8i8(<8 x i8> %va, <8 x i8> %vb)
103 define <8 x i8> @sadd_v8i8_vi(<8 x i8> %va) {
104 ; CHECK-LABEL: sadd_v8i8_vi:
106 ; CHECK-NEXT: vsetivli zero, 8, e8, mf2, ta, ma
107 ; CHECK-NEXT: vsadd.vi v8, v8, 5
109 %elt.head = insertelement <8 x i8> poison, i8 5, i32 0
110 %vb = shufflevector <8 x i8> %elt.head, <8 x i8> poison, <8 x i32> zeroinitializer
111 %v = call <8 x i8> @llvm.sadd.sat.v8i8(<8 x i8> %va, <8 x i8> %vb)
115 declare <16 x i8> @llvm.sadd.sat.v16i8(<16 x i8>, <16 x i8>)
117 define <16 x i8> @sadd_v16i8_vv(<16 x i8> %va, <16 x i8> %b) {
118 ; CHECK-LABEL: sadd_v16i8_vv:
120 ; CHECK-NEXT: vsetivli zero, 16, e8, m1, ta, ma
121 ; CHECK-NEXT: vsadd.vv v8, v8, v9
123 %v = call <16 x i8> @llvm.sadd.sat.v16i8(<16 x i8> %va, <16 x i8> %b)
127 define <16 x i8> @sadd_v16i8_vx(<16 x i8> %va, i8 %b) {
128 ; CHECK-LABEL: sadd_v16i8_vx:
130 ; CHECK-NEXT: vsetivli zero, 16, e8, m1, ta, ma
131 ; CHECK-NEXT: vsadd.vx v8, v8, a0
133 %elt.head = insertelement <16 x i8> poison, i8 %b, i32 0
134 %vb = shufflevector <16 x i8> %elt.head, <16 x i8> poison, <16 x i32> zeroinitializer
135 %v = call <16 x i8> @llvm.sadd.sat.v16i8(<16 x i8> %va, <16 x i8> %vb)
139 define <16 x i8> @sadd_v16i8_vi(<16 x i8> %va) {
140 ; CHECK-LABEL: sadd_v16i8_vi:
142 ; CHECK-NEXT: vsetivli zero, 16, e8, m1, ta, ma
143 ; CHECK-NEXT: vsadd.vi v8, v8, 5
145 %elt.head = insertelement <16 x i8> poison, i8 5, i32 0
146 %vb = shufflevector <16 x i8> %elt.head, <16 x i8> poison, <16 x i32> zeroinitializer
147 %v = call <16 x i8> @llvm.sadd.sat.v16i8(<16 x i8> %va, <16 x i8> %vb)
151 declare <2 x i16> @llvm.sadd.sat.v2i16(<2 x i16>, <2 x i16>)
153 define <2 x i16> @sadd_v2i16_vv(<2 x i16> %va, <2 x i16> %b) {
154 ; CHECK-LABEL: sadd_v2i16_vv:
156 ; CHECK-NEXT: vsetivli zero, 2, e16, mf4, ta, ma
157 ; CHECK-NEXT: vsadd.vv v8, v8, v9
159 %v = call <2 x i16> @llvm.sadd.sat.v2i16(<2 x i16> %va, <2 x i16> %b)
163 define <2 x i16> @sadd_v2i16_vx(<2 x i16> %va, i16 %b) {
164 ; CHECK-LABEL: sadd_v2i16_vx:
166 ; CHECK-NEXT: vsetivli zero, 2, e16, mf4, ta, ma
167 ; CHECK-NEXT: vsadd.vx v8, v8, a0
169 %elt.head = insertelement <2 x i16> poison, i16 %b, i32 0
170 %vb = shufflevector <2 x i16> %elt.head, <2 x i16> poison, <2 x i32> zeroinitializer
171 %v = call <2 x i16> @llvm.sadd.sat.v2i16(<2 x i16> %va, <2 x i16> %vb)
175 define <2 x i16> @sadd_v2i16_vi(<2 x i16> %va) {
176 ; CHECK-LABEL: sadd_v2i16_vi:
178 ; CHECK-NEXT: vsetivli zero, 2, e16, mf4, ta, ma
179 ; CHECK-NEXT: vsadd.vi v8, v8, 5
181 %elt.head = insertelement <2 x i16> poison, i16 5, i32 0
182 %vb = shufflevector <2 x i16> %elt.head, <2 x i16> poison, <2 x i32> zeroinitializer
183 %v = call <2 x i16> @llvm.sadd.sat.v2i16(<2 x i16> %va, <2 x i16> %vb)
187 declare <4 x i16> @llvm.sadd.sat.v4i16(<4 x i16>, <4 x i16>)
189 define <4 x i16> @sadd_v4i16_vv(<4 x i16> %va, <4 x i16> %b) {
190 ; CHECK-LABEL: sadd_v4i16_vv:
192 ; CHECK-NEXT: vsetivli zero, 4, e16, mf2, ta, ma
193 ; CHECK-NEXT: vsadd.vv v8, v8, v9
195 %v = call <4 x i16> @llvm.sadd.sat.v4i16(<4 x i16> %va, <4 x i16> %b)
199 define <4 x i16> @sadd_v4i16_vx(<4 x i16> %va, i16 %b) {
200 ; CHECK-LABEL: sadd_v4i16_vx:
202 ; CHECK-NEXT: vsetivli zero, 4, e16, mf2, ta, ma
203 ; CHECK-NEXT: vsadd.vx v8, v8, a0
205 %elt.head = insertelement <4 x i16> poison, i16 %b, i32 0
206 %vb = shufflevector <4 x i16> %elt.head, <4 x i16> poison, <4 x i32> zeroinitializer
207 %v = call <4 x i16> @llvm.sadd.sat.v4i16(<4 x i16> %va, <4 x i16> %vb)
211 define <4 x i16> @sadd_v4i16_vi(<4 x i16> %va) {
212 ; CHECK-LABEL: sadd_v4i16_vi:
214 ; CHECK-NEXT: vsetivli zero, 4, e16, mf2, ta, ma
215 ; CHECK-NEXT: vsadd.vi v8, v8, 5
217 %elt.head = insertelement <4 x i16> poison, i16 5, i32 0
218 %vb = shufflevector <4 x i16> %elt.head, <4 x i16> poison, <4 x i32> zeroinitializer
219 %v = call <4 x i16> @llvm.sadd.sat.v4i16(<4 x i16> %va, <4 x i16> %vb)
223 declare <8 x i16> @llvm.sadd.sat.v8i16(<8 x i16>, <8 x i16>)
225 define <8 x i16> @sadd_v8i16_vv(<8 x i16> %va, <8 x i16> %b) {
226 ; CHECK-LABEL: sadd_v8i16_vv:
228 ; CHECK-NEXT: vsetivli zero, 8, e16, m1, ta, ma
229 ; CHECK-NEXT: vsadd.vv v8, v8, v9
231 %v = call <8 x i16> @llvm.sadd.sat.v8i16(<8 x i16> %va, <8 x i16> %b)
235 define <8 x i16> @sadd_v8i16_vx(<8 x i16> %va, i16 %b) {
236 ; CHECK-LABEL: sadd_v8i16_vx:
238 ; CHECK-NEXT: vsetivli zero, 8, e16, m1, ta, ma
239 ; CHECK-NEXT: vsadd.vx v8, v8, a0
241 %elt.head = insertelement <8 x i16> poison, i16 %b, i32 0
242 %vb = shufflevector <8 x i16> %elt.head, <8 x i16> poison, <8 x i32> zeroinitializer
243 %v = call <8 x i16> @llvm.sadd.sat.v8i16(<8 x i16> %va, <8 x i16> %vb)
247 define <8 x i16> @sadd_v8i16_vi(<8 x i16> %va) {
248 ; CHECK-LABEL: sadd_v8i16_vi:
250 ; CHECK-NEXT: vsetivli zero, 8, e16, m1, ta, ma
251 ; CHECK-NEXT: vsadd.vi v8, v8, 5
253 %elt.head = insertelement <8 x i16> poison, i16 5, i32 0
254 %vb = shufflevector <8 x i16> %elt.head, <8 x i16> poison, <8 x i32> zeroinitializer
255 %v = call <8 x i16> @llvm.sadd.sat.v8i16(<8 x i16> %va, <8 x i16> %vb)
259 declare <16 x i16> @llvm.sadd.sat.v16i16(<16 x i16>, <16 x i16>)
261 define <16 x i16> @sadd_v16i16_vv(<16 x i16> %va, <16 x i16> %b) {
262 ; CHECK-LABEL: sadd_v16i16_vv:
264 ; CHECK-NEXT: vsetivli zero, 16, e16, m2, ta, ma
265 ; CHECK-NEXT: vsadd.vv v8, v8, v10
267 %v = call <16 x i16> @llvm.sadd.sat.v16i16(<16 x i16> %va, <16 x i16> %b)
271 define <16 x i16> @sadd_v16i16_vx(<16 x i16> %va, i16 %b) {
272 ; CHECK-LABEL: sadd_v16i16_vx:
274 ; CHECK-NEXT: vsetivli zero, 16, e16, m2, ta, ma
275 ; CHECK-NEXT: vsadd.vx v8, v8, a0
277 %elt.head = insertelement <16 x i16> poison, i16 %b, i32 0
278 %vb = shufflevector <16 x i16> %elt.head, <16 x i16> poison, <16 x i32> zeroinitializer
279 %v = call <16 x i16> @llvm.sadd.sat.v16i16(<16 x i16> %va, <16 x i16> %vb)
283 define <16 x i16> @sadd_v16i16_vi(<16 x i16> %va) {
284 ; CHECK-LABEL: sadd_v16i16_vi:
286 ; CHECK-NEXT: vsetivli zero, 16, e16, m2, ta, ma
287 ; CHECK-NEXT: vsadd.vi v8, v8, 5
289 %elt.head = insertelement <16 x i16> poison, i16 5, i32 0
290 %vb = shufflevector <16 x i16> %elt.head, <16 x i16> poison, <16 x i32> zeroinitializer
291 %v = call <16 x i16> @llvm.sadd.sat.v16i16(<16 x i16> %va, <16 x i16> %vb)
295 declare <2 x i32> @llvm.sadd.sat.v2i32(<2 x i32>, <2 x i32>)
297 define <2 x i32> @sadd_v2i32_vv(<2 x i32> %va, <2 x i32> %b) {
298 ; CHECK-LABEL: sadd_v2i32_vv:
300 ; CHECK-NEXT: vsetivli zero, 2, e32, mf2, ta, ma
301 ; CHECK-NEXT: vsadd.vv v8, v8, v9
303 %v = call <2 x i32> @llvm.sadd.sat.v2i32(<2 x i32> %va, <2 x i32> %b)
307 define <2 x i32> @sadd_v2i32_vx(<2 x i32> %va, i32 %b) {
308 ; CHECK-LABEL: sadd_v2i32_vx:
310 ; CHECK-NEXT: vsetivli zero, 2, e32, mf2, ta, ma
311 ; CHECK-NEXT: vsadd.vx v8, v8, a0
313 %elt.head = insertelement <2 x i32> poison, i32 %b, i32 0
314 %vb = shufflevector <2 x i32> %elt.head, <2 x i32> poison, <2 x i32> zeroinitializer
315 %v = call <2 x i32> @llvm.sadd.sat.v2i32(<2 x i32> %va, <2 x i32> %vb)
319 define <2 x i32> @sadd_v2i32_vx_commute(<2 x i32> %va, i32 %b) {
320 ; CHECK-LABEL: sadd_v2i32_vx_commute:
322 ; CHECK-NEXT: vsetivli zero, 2, e32, mf2, ta, ma
323 ; CHECK-NEXT: vsadd.vx v8, v8, a0
325 %elt.head = insertelement <2 x i32> poison, i32 %b, i32 0
326 %vb = shufflevector <2 x i32> %elt.head, <2 x i32> poison, <2 x i32> zeroinitializer
327 %v = call <2 x i32> @llvm.sadd.sat.v2i32(<2 x i32> %vb, <2 x i32> %va)
331 define <2 x i32> @sadd_v2i32_vi(<2 x i32> %va) {
332 ; CHECK-LABEL: sadd_v2i32_vi:
334 ; CHECK-NEXT: vsetivli zero, 2, e32, mf2, ta, ma
335 ; CHECK-NEXT: vsadd.vi v8, v8, 5
337 %elt.head = insertelement <2 x i32> poison, i32 5, i32 0
338 %vb = shufflevector <2 x i32> %elt.head, <2 x i32> poison, <2 x i32> zeroinitializer
339 %v = call <2 x i32> @llvm.sadd.sat.v2i32(<2 x i32> %va, <2 x i32> %vb)
343 declare <4 x i32> @llvm.sadd.sat.v4i32(<4 x i32>, <4 x i32>)
345 define <4 x i32> @sadd_v4i32_vv(<4 x i32> %va, <4 x i32> %b) {
346 ; CHECK-LABEL: sadd_v4i32_vv:
348 ; CHECK-NEXT: vsetivli zero, 4, e32, m1, ta, ma
349 ; CHECK-NEXT: vsadd.vv v8, v8, v9
351 %v = call <4 x i32> @llvm.sadd.sat.v4i32(<4 x i32> %va, <4 x i32> %b)
355 define <4 x i32> @sadd_v4i32_vx(<4 x i32> %va, i32 %b) {
356 ; CHECK-LABEL: sadd_v4i32_vx:
358 ; CHECK-NEXT: vsetivli zero, 4, e32, m1, ta, ma
359 ; CHECK-NEXT: vsadd.vx v8, v8, a0
361 %elt.head = insertelement <4 x i32> poison, i32 %b, i32 0
362 %vb = shufflevector <4 x i32> %elt.head, <4 x i32> poison, <4 x i32> zeroinitializer
363 %v = call <4 x i32> @llvm.sadd.sat.v4i32(<4 x i32> %va, <4 x i32> %vb)
367 define <4 x i32> @sadd_v4i32_vi(<4 x i32> %va) {
368 ; CHECK-LABEL: sadd_v4i32_vi:
370 ; CHECK-NEXT: vsetivli zero, 4, e32, m1, ta, ma
371 ; CHECK-NEXT: vsadd.vi v8, v8, 5
373 %elt.head = insertelement <4 x i32> poison, i32 5, i32 0
374 %vb = shufflevector <4 x i32> %elt.head, <4 x i32> poison, <4 x i32> zeroinitializer
375 %v = call <4 x i32> @llvm.sadd.sat.v4i32(<4 x i32> %va, <4 x i32> %vb)
379 declare <8 x i32> @llvm.sadd.sat.v8i32(<8 x i32>, <8 x i32>)
381 define <8 x i32> @sadd_v8i32_vv(<8 x i32> %va, <8 x i32> %b) {
382 ; CHECK-LABEL: sadd_v8i32_vv:
384 ; CHECK-NEXT: vsetivli zero, 8, e32, m2, ta, ma
385 ; CHECK-NEXT: vsadd.vv v8, v8, v10
387 %v = call <8 x i32> @llvm.sadd.sat.v8i32(<8 x i32> %va, <8 x i32> %b)
391 define <8 x i32> @sadd_v8i32_vx(<8 x i32> %va, i32 %b) {
392 ; CHECK-LABEL: sadd_v8i32_vx:
394 ; CHECK-NEXT: vsetivli zero, 8, e32, m2, ta, ma
395 ; CHECK-NEXT: vsadd.vx v8, v8, a0
397 %elt.head = insertelement <8 x i32> poison, i32 %b, i32 0
398 %vb = shufflevector <8 x i32> %elt.head, <8 x i32> poison, <8 x i32> zeroinitializer
399 %v = call <8 x i32> @llvm.sadd.sat.v8i32(<8 x i32> %va, <8 x i32> %vb)
403 define <8 x i32> @sadd_v8i32_vi(<8 x i32> %va) {
404 ; CHECK-LABEL: sadd_v8i32_vi:
406 ; CHECK-NEXT: vsetivli zero, 8, e32, m2, ta, ma
407 ; CHECK-NEXT: vsadd.vi v8, v8, 5
409 %elt.head = insertelement <8 x i32> poison, i32 5, i32 0
410 %vb = shufflevector <8 x i32> %elt.head, <8 x i32> poison, <8 x i32> zeroinitializer
411 %v = call <8 x i32> @llvm.sadd.sat.v8i32(<8 x i32> %va, <8 x i32> %vb)
415 declare <16 x i32> @llvm.sadd.sat.v16i32(<16 x i32>, <16 x i32>)
417 define <16 x i32> @sadd_v16i32_vv(<16 x i32> %va, <16 x i32> %b) {
418 ; CHECK-LABEL: sadd_v16i32_vv:
420 ; CHECK-NEXT: vsetivli zero, 16, e32, m4, ta, ma
421 ; CHECK-NEXT: vsadd.vv v8, v8, v12
423 %v = call <16 x i32> @llvm.sadd.sat.v16i32(<16 x i32> %va, <16 x i32> %b)
427 define <16 x i32> @sadd_v16i32_vx(<16 x i32> %va, i32 %b) {
428 ; CHECK-LABEL: sadd_v16i32_vx:
430 ; CHECK-NEXT: vsetivli zero, 16, e32, m4, ta, ma
431 ; CHECK-NEXT: vsadd.vx v8, v8, a0
433 %elt.head = insertelement <16 x i32> poison, i32 %b, i32 0
434 %vb = shufflevector <16 x i32> %elt.head, <16 x i32> poison, <16 x i32> zeroinitializer
435 %v = call <16 x i32> @llvm.sadd.sat.v16i32(<16 x i32> %va, <16 x i32> %vb)
439 define <16 x i32> @sadd_v16i32_vi(<16 x i32> %va) {
440 ; CHECK-LABEL: sadd_v16i32_vi:
442 ; CHECK-NEXT: vsetivli zero, 16, e32, m4, ta, ma
443 ; CHECK-NEXT: vsadd.vi v8, v8, 5
445 %elt.head = insertelement <16 x i32> poison, i32 5, i32 0
446 %vb = shufflevector <16 x i32> %elt.head, <16 x i32> poison, <16 x i32> zeroinitializer
447 %v = call <16 x i32> @llvm.sadd.sat.v16i32(<16 x i32> %va, <16 x i32> %vb)
451 declare <2 x i64> @llvm.sadd.sat.v2i64(<2 x i64>, <2 x i64>)
453 define <2 x i64> @sadd_v2i64_vv(<2 x i64> %va, <2 x i64> %b) {
454 ; CHECK-LABEL: sadd_v2i64_vv:
456 ; CHECK-NEXT: vsetivli zero, 2, e64, m1, ta, ma
457 ; CHECK-NEXT: vsadd.vv v8, v8, v9
459 %v = call <2 x i64> @llvm.sadd.sat.v2i64(<2 x i64> %va, <2 x i64> %b)
463 define <2 x i64> @sadd_v2i64_vx(<2 x i64> %va, i64 %b) {
464 ; RV32-LABEL: sadd_v2i64_vx:
466 ; RV32-NEXT: addi sp, sp, -16
467 ; RV32-NEXT: .cfi_def_cfa_offset 16
468 ; RV32-NEXT: sw a1, 12(sp)
469 ; RV32-NEXT: sw a0, 8(sp)
470 ; RV32-NEXT: addi a0, sp, 8
471 ; RV32-NEXT: vsetivli zero, 2, e64, m1, ta, ma
472 ; RV32-NEXT: vlse64.v v9, (a0), zero
473 ; RV32-NEXT: vsadd.vv v8, v8, v9
474 ; RV32-NEXT: addi sp, sp, 16
477 ; RV64-LABEL: sadd_v2i64_vx:
479 ; RV64-NEXT: vsetivli zero, 2, e64, m1, ta, ma
480 ; RV64-NEXT: vsadd.vx v8, v8, a0
482 %elt.head = insertelement <2 x i64> poison, i64 %b, i32 0
483 %vb = shufflevector <2 x i64> %elt.head, <2 x i64> poison, <2 x i32> zeroinitializer
484 %v = call <2 x i64> @llvm.sadd.sat.v2i64(<2 x i64> %va, <2 x i64> %vb)
488 define <2 x i64> @sadd_v2i64_vi(<2 x i64> %va) {
489 ; CHECK-LABEL: sadd_v2i64_vi:
491 ; CHECK-NEXT: vsetivli zero, 2, e64, m1, ta, ma
492 ; CHECK-NEXT: vsadd.vi v8, v8, 5
494 %elt.head = insertelement <2 x i64> poison, i64 5, i32 0
495 %vb = shufflevector <2 x i64> %elt.head, <2 x i64> poison, <2 x i32> zeroinitializer
496 %v = call <2 x i64> @llvm.sadd.sat.v2i64(<2 x i64> %va, <2 x i64> %vb)
500 declare <4 x i64> @llvm.sadd.sat.v4i64(<4 x i64>, <4 x i64>)
502 define <4 x i64> @sadd_v4i64_vv(<4 x i64> %va, <4 x i64> %b) {
503 ; CHECK-LABEL: sadd_v4i64_vv:
505 ; CHECK-NEXT: vsetivli zero, 4, e64, m2, ta, ma
506 ; CHECK-NEXT: vsadd.vv v8, v8, v10
508 %v = call <4 x i64> @llvm.sadd.sat.v4i64(<4 x i64> %va, <4 x i64> %b)
512 define <4 x i64> @sadd_v4i64_vx(<4 x i64> %va, i64 %b) {
513 ; RV32-LABEL: sadd_v4i64_vx:
515 ; RV32-NEXT: addi sp, sp, -16
516 ; RV32-NEXT: .cfi_def_cfa_offset 16
517 ; RV32-NEXT: sw a1, 12(sp)
518 ; RV32-NEXT: sw a0, 8(sp)
519 ; RV32-NEXT: addi a0, sp, 8
520 ; RV32-NEXT: vsetivli zero, 4, e64, m2, ta, ma
521 ; RV32-NEXT: vlse64.v v10, (a0), zero
522 ; RV32-NEXT: vsadd.vv v8, v8, v10
523 ; RV32-NEXT: addi sp, sp, 16
526 ; RV64-LABEL: sadd_v4i64_vx:
528 ; RV64-NEXT: vsetivli zero, 4, e64, m2, ta, ma
529 ; RV64-NEXT: vsadd.vx v8, v8, a0
531 %elt.head = insertelement <4 x i64> poison, i64 %b, i32 0
532 %vb = shufflevector <4 x i64> %elt.head, <4 x i64> poison, <4 x i32> zeroinitializer
533 %v = call <4 x i64> @llvm.sadd.sat.v4i64(<4 x i64> %va, <4 x i64> %vb)
537 define <4 x i64> @sadd_v4i64_vi(<4 x i64> %va) {
538 ; CHECK-LABEL: sadd_v4i64_vi:
540 ; CHECK-NEXT: vsetivli zero, 4, e64, m2, ta, ma
541 ; CHECK-NEXT: vsadd.vi v8, v8, 5
543 %elt.head = insertelement <4 x i64> poison, i64 5, i32 0
544 %vb = shufflevector <4 x i64> %elt.head, <4 x i64> poison, <4 x i32> zeroinitializer
545 %v = call <4 x i64> @llvm.sadd.sat.v4i64(<4 x i64> %va, <4 x i64> %vb)
549 declare <8 x i64> @llvm.sadd.sat.v8i64(<8 x i64>, <8 x i64>)
551 define <8 x i64> @sadd_v8i64_vv(<8 x i64> %va, <8 x i64> %b) {
552 ; CHECK-LABEL: sadd_v8i64_vv:
554 ; CHECK-NEXT: vsetivli zero, 8, e64, m4, ta, ma
555 ; CHECK-NEXT: vsadd.vv v8, v8, v12
557 %v = call <8 x i64> @llvm.sadd.sat.v8i64(<8 x i64> %va, <8 x i64> %b)
561 define <8 x i64> @sadd_v8i64_vx(<8 x i64> %va, i64 %b) {
562 ; RV32-LABEL: sadd_v8i64_vx:
564 ; RV32-NEXT: addi sp, sp, -16
565 ; RV32-NEXT: .cfi_def_cfa_offset 16
566 ; RV32-NEXT: sw a1, 12(sp)
567 ; RV32-NEXT: sw a0, 8(sp)
568 ; RV32-NEXT: addi a0, sp, 8
569 ; RV32-NEXT: vsetivli zero, 8, e64, m4, ta, ma
570 ; RV32-NEXT: vlse64.v v12, (a0), zero
571 ; RV32-NEXT: vsadd.vv v8, v8, v12
572 ; RV32-NEXT: addi sp, sp, 16
575 ; RV64-LABEL: sadd_v8i64_vx:
577 ; RV64-NEXT: vsetivli zero, 8, e64, m4, ta, ma
578 ; RV64-NEXT: vsadd.vx v8, v8, a0
580 %elt.head = insertelement <8 x i64> poison, i64 %b, i32 0
581 %vb = shufflevector <8 x i64> %elt.head, <8 x i64> poison, <8 x i32> zeroinitializer
582 %v = call <8 x i64> @llvm.sadd.sat.v8i64(<8 x i64> %va, <8 x i64> %vb)
586 define <8 x i64> @sadd_v8i64_vi(<8 x i64> %va) {
587 ; CHECK-LABEL: sadd_v8i64_vi:
589 ; CHECK-NEXT: vsetivli zero, 8, e64, m4, ta, ma
590 ; CHECK-NEXT: vsadd.vi v8, v8, 5
592 %elt.head = insertelement <8 x i64> poison, i64 5, i32 0
593 %vb = shufflevector <8 x i64> %elt.head, <8 x i64> poison, <8 x i32> zeroinitializer
594 %v = call <8 x i64> @llvm.sadd.sat.v8i64(<8 x i64> %va, <8 x i64> %vb)
598 declare <16 x i64> @llvm.sadd.sat.v16i64(<16 x i64>, <16 x i64>)
600 define <16 x i64> @sadd_v16i64_vv(<16 x i64> %va, <16 x i64> %b) {
601 ; CHECK-LABEL: sadd_v16i64_vv:
603 ; CHECK-NEXT: vsetivli zero, 16, e64, m8, ta, ma
604 ; CHECK-NEXT: vsadd.vv v8, v8, v16
606 %v = call <16 x i64> @llvm.sadd.sat.v16i64(<16 x i64> %va, <16 x i64> %b)
610 define <16 x i64> @sadd_v16i64_vx(<16 x i64> %va, i64 %b) {
611 ; RV32-LABEL: sadd_v16i64_vx:
613 ; RV32-NEXT: addi sp, sp, -16
614 ; RV32-NEXT: .cfi_def_cfa_offset 16
615 ; RV32-NEXT: sw a1, 12(sp)
616 ; RV32-NEXT: sw a0, 8(sp)
617 ; RV32-NEXT: addi a0, sp, 8
618 ; RV32-NEXT: vsetivli zero, 16, e64, m8, ta, ma
619 ; RV32-NEXT: vlse64.v v16, (a0), zero
620 ; RV32-NEXT: vsadd.vv v8, v8, v16
621 ; RV32-NEXT: addi sp, sp, 16
624 ; RV64-LABEL: sadd_v16i64_vx:
626 ; RV64-NEXT: vsetivli zero, 16, e64, m8, ta, ma
627 ; RV64-NEXT: vsadd.vx v8, v8, a0
629 %elt.head = insertelement <16 x i64> poison, i64 %b, i32 0
630 %vb = shufflevector <16 x i64> %elt.head, <16 x i64> poison, <16 x i32> zeroinitializer
631 %v = call <16 x i64> @llvm.sadd.sat.v16i64(<16 x i64> %va, <16 x i64> %vb)
635 define <16 x i64> @sadd_v16i64_vi(<16 x i64> %va) {
636 ; CHECK-LABEL: sadd_v16i64_vi:
638 ; CHECK-NEXT: vsetivli zero, 16, e64, m8, ta, ma
639 ; CHECK-NEXT: vsadd.vi v8, v8, 5
641 %elt.head = insertelement <16 x i64> poison, i64 5, i32 0
642 %vb = shufflevector <16 x i64> %elt.head, <16 x i64> poison, <16 x i32> zeroinitializer
643 %v = call <16 x i64> @llvm.sadd.sat.v16i64(<16 x i64> %va, <16 x i64> %vb)