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.ssub.sat.v2i8(<2 x i8>, <2 x i8>)
9 define <2 x i8> @ssub_v2i8_vv(<2 x i8> %va, <2 x i8> %b) {
10 ; CHECK-LABEL: ssub_v2i8_vv:
12 ; CHECK-NEXT: vsetivli zero, 2, e8, mf8, ta, ma
13 ; CHECK-NEXT: vssub.vv v8, v8, v9
15 %v = call <2 x i8> @llvm.ssub.sat.v2i8(<2 x i8> %va, <2 x i8> %b)
19 define <2 x i8> @ssub_v2i8_vx(<2 x i8> %va, i8 %b) {
20 ; CHECK-LABEL: ssub_v2i8_vx:
22 ; CHECK-NEXT: vsetivli zero, 2, e8, mf8, ta, ma
23 ; CHECK-NEXT: vssub.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.ssub.sat.v2i8(<2 x i8> %va, <2 x i8> %vb)
31 define <2 x i8> @ssub_v2i8_vi(<2 x i8> %va) {
32 ; CHECK-LABEL: ssub_v2i8_vi:
34 ; CHECK-NEXT: li a0, 1
35 ; CHECK-NEXT: vsetivli zero, 2, e8, mf8, ta, ma
36 ; CHECK-NEXT: vssub.vx v8, v8, a0
38 %elt.head = insertelement <2 x i8> poison, i8 1, i32 0
39 %vb = shufflevector <2 x i8> %elt.head, <2 x i8> poison, <2 x i32> zeroinitializer
40 %v = call <2 x i8> @llvm.ssub.sat.v2i8(<2 x i8> %va, <2 x i8> %vb)
44 declare <4 x i8> @llvm.ssub.sat.v4i8(<4 x i8>, <4 x i8>)
46 define <4 x i8> @ssub_v4i8_vv(<4 x i8> %va, <4 x i8> %b) {
47 ; CHECK-LABEL: ssub_v4i8_vv:
49 ; CHECK-NEXT: vsetivli zero, 4, e8, mf4, ta, ma
50 ; CHECK-NEXT: vssub.vv v8, v8, v9
52 %v = call <4 x i8> @llvm.ssub.sat.v4i8(<4 x i8> %va, <4 x i8> %b)
56 define <4 x i8> @ssub_v4i8_vx(<4 x i8> %va, i8 %b) {
57 ; CHECK-LABEL: ssub_v4i8_vx:
59 ; CHECK-NEXT: vsetivli zero, 4, e8, mf4, ta, ma
60 ; CHECK-NEXT: vssub.vx v8, v8, a0
62 %elt.head = insertelement <4 x i8> poison, i8 %b, i32 0
63 %vb = shufflevector <4 x i8> %elt.head, <4 x i8> poison, <4 x i32> zeroinitializer
64 %v = call <4 x i8> @llvm.ssub.sat.v4i8(<4 x i8> %va, <4 x i8> %vb)
68 define <4 x i8> @ssub_v4i8_vi(<4 x i8> %va) {
69 ; CHECK-LABEL: ssub_v4i8_vi:
71 ; CHECK-NEXT: li a0, 1
72 ; CHECK-NEXT: vsetivli zero, 4, e8, mf4, ta, ma
73 ; CHECK-NEXT: vssub.vx v8, v8, a0
75 %elt.head = insertelement <4 x i8> poison, i8 1, i32 0
76 %vb = shufflevector <4 x i8> %elt.head, <4 x i8> poison, <4 x i32> zeroinitializer
77 %v = call <4 x i8> @llvm.ssub.sat.v4i8(<4 x i8> %va, <4 x i8> %vb)
81 declare <8 x i8> @llvm.ssub.sat.v8i8(<8 x i8>, <8 x i8>)
83 define <8 x i8> @ssub_v8i8_vv(<8 x i8> %va, <8 x i8> %b) {
84 ; CHECK-LABEL: ssub_v8i8_vv:
86 ; CHECK-NEXT: vsetivli zero, 8, e8, mf2, ta, ma
87 ; CHECK-NEXT: vssub.vv v8, v8, v9
89 %v = call <8 x i8> @llvm.ssub.sat.v8i8(<8 x i8> %va, <8 x i8> %b)
93 define <8 x i8> @ssub_v8i8_vx(<8 x i8> %va, i8 %b) {
94 ; CHECK-LABEL: ssub_v8i8_vx:
96 ; CHECK-NEXT: vsetivli zero, 8, e8, mf2, ta, ma
97 ; CHECK-NEXT: vssub.vx v8, v8, a0
99 %elt.head = insertelement <8 x i8> poison, i8 %b, i32 0
100 %vb = shufflevector <8 x i8> %elt.head, <8 x i8> poison, <8 x i32> zeroinitializer
101 %v = call <8 x i8> @llvm.ssub.sat.v8i8(<8 x i8> %va, <8 x i8> %vb)
105 define <8 x i8> @ssub_v8i8_vi(<8 x i8> %va) {
106 ; CHECK-LABEL: ssub_v8i8_vi:
108 ; CHECK-NEXT: li a0, 1
109 ; CHECK-NEXT: vsetivli zero, 8, e8, mf2, ta, ma
110 ; CHECK-NEXT: vssub.vx v8, v8, a0
112 %elt.head = insertelement <8 x i8> poison, i8 1, i32 0
113 %vb = shufflevector <8 x i8> %elt.head, <8 x i8> poison, <8 x i32> zeroinitializer
114 %v = call <8 x i8> @llvm.ssub.sat.v8i8(<8 x i8> %va, <8 x i8> %vb)
118 declare <16 x i8> @llvm.ssub.sat.v16i8(<16 x i8>, <16 x i8>)
120 define <16 x i8> @ssub_v16i8_vv(<16 x i8> %va, <16 x i8> %b) {
121 ; CHECK-LABEL: ssub_v16i8_vv:
123 ; CHECK-NEXT: vsetivli zero, 16, e8, m1, ta, ma
124 ; CHECK-NEXT: vssub.vv v8, v8, v9
126 %v = call <16 x i8> @llvm.ssub.sat.v16i8(<16 x i8> %va, <16 x i8> %b)
130 define <16 x i8> @ssub_v16i8_vx(<16 x i8> %va, i8 %b) {
131 ; CHECK-LABEL: ssub_v16i8_vx:
133 ; CHECK-NEXT: vsetivli zero, 16, e8, m1, ta, ma
134 ; CHECK-NEXT: vssub.vx v8, v8, a0
136 %elt.head = insertelement <16 x i8> poison, i8 %b, i32 0
137 %vb = shufflevector <16 x i8> %elt.head, <16 x i8> poison, <16 x i32> zeroinitializer
138 %v = call <16 x i8> @llvm.ssub.sat.v16i8(<16 x i8> %va, <16 x i8> %vb)
142 define <16 x i8> @ssub_v16i8_vi(<16 x i8> %va) {
143 ; CHECK-LABEL: ssub_v16i8_vi:
145 ; CHECK-NEXT: li a0, 1
146 ; CHECK-NEXT: vsetivli zero, 16, e8, m1, ta, ma
147 ; CHECK-NEXT: vssub.vx v8, v8, a0
149 %elt.head = insertelement <16 x i8> poison, i8 1, i32 0
150 %vb = shufflevector <16 x i8> %elt.head, <16 x i8> poison, <16 x i32> zeroinitializer
151 %v = call <16 x i8> @llvm.ssub.sat.v16i8(<16 x i8> %va, <16 x i8> %vb)
155 declare <2 x i16> @llvm.ssub.sat.v2i16(<2 x i16>, <2 x i16>)
157 define <2 x i16> @ssub_v2i16_vv(<2 x i16> %va, <2 x i16> %b) {
158 ; CHECK-LABEL: ssub_v2i16_vv:
160 ; CHECK-NEXT: vsetivli zero, 2, e16, mf4, ta, ma
161 ; CHECK-NEXT: vssub.vv v8, v8, v9
163 %v = call <2 x i16> @llvm.ssub.sat.v2i16(<2 x i16> %va, <2 x i16> %b)
167 define <2 x i16> @ssub_v2i16_vx(<2 x i16> %va, i16 %b) {
168 ; CHECK-LABEL: ssub_v2i16_vx:
170 ; CHECK-NEXT: vsetivli zero, 2, e16, mf4, ta, ma
171 ; CHECK-NEXT: vssub.vx v8, v8, a0
173 %elt.head = insertelement <2 x i16> poison, i16 %b, i32 0
174 %vb = shufflevector <2 x i16> %elt.head, <2 x i16> poison, <2 x i32> zeroinitializer
175 %v = call <2 x i16> @llvm.ssub.sat.v2i16(<2 x i16> %va, <2 x i16> %vb)
179 define <2 x i16> @ssub_v2i16_vi(<2 x i16> %va) {
180 ; CHECK-LABEL: ssub_v2i16_vi:
182 ; CHECK-NEXT: li a0, 1
183 ; CHECK-NEXT: vsetivli zero, 2, e16, mf4, ta, ma
184 ; CHECK-NEXT: vssub.vx v8, v8, a0
186 %elt.head = insertelement <2 x i16> poison, i16 1, i32 0
187 %vb = shufflevector <2 x i16> %elt.head, <2 x i16> poison, <2 x i32> zeroinitializer
188 %v = call <2 x i16> @llvm.ssub.sat.v2i16(<2 x i16> %va, <2 x i16> %vb)
192 declare <4 x i16> @llvm.ssub.sat.v4i16(<4 x i16>, <4 x i16>)
194 define <4 x i16> @ssub_v4i16_vv(<4 x i16> %va, <4 x i16> %b) {
195 ; CHECK-LABEL: ssub_v4i16_vv:
197 ; CHECK-NEXT: vsetivli zero, 4, e16, mf2, ta, ma
198 ; CHECK-NEXT: vssub.vv v8, v8, v9
200 %v = call <4 x i16> @llvm.ssub.sat.v4i16(<4 x i16> %va, <4 x i16> %b)
204 define <4 x i16> @ssub_v4i16_vx(<4 x i16> %va, i16 %b) {
205 ; CHECK-LABEL: ssub_v4i16_vx:
207 ; CHECK-NEXT: vsetivli zero, 4, e16, mf2, ta, ma
208 ; CHECK-NEXT: vssub.vx v8, v8, a0
210 %elt.head = insertelement <4 x i16> poison, i16 %b, i32 0
211 %vb = shufflevector <4 x i16> %elt.head, <4 x i16> poison, <4 x i32> zeroinitializer
212 %v = call <4 x i16> @llvm.ssub.sat.v4i16(<4 x i16> %va, <4 x i16> %vb)
216 define <4 x i16> @ssub_v4i16_vi(<4 x i16> %va) {
217 ; CHECK-LABEL: ssub_v4i16_vi:
219 ; CHECK-NEXT: li a0, 1
220 ; CHECK-NEXT: vsetivli zero, 4, e16, mf2, ta, ma
221 ; CHECK-NEXT: vssub.vx v8, v8, a0
223 %elt.head = insertelement <4 x i16> poison, i16 1, i32 0
224 %vb = shufflevector <4 x i16> %elt.head, <4 x i16> poison, <4 x i32> zeroinitializer
225 %v = call <4 x i16> @llvm.ssub.sat.v4i16(<4 x i16> %va, <4 x i16> %vb)
229 declare <8 x i16> @llvm.ssub.sat.v8i16(<8 x i16>, <8 x i16>)
231 define <8 x i16> @ssub_v8i16_vv(<8 x i16> %va, <8 x i16> %b) {
232 ; CHECK-LABEL: ssub_v8i16_vv:
234 ; CHECK-NEXT: vsetivli zero, 8, e16, m1, ta, ma
235 ; CHECK-NEXT: vssub.vv v8, v8, v9
237 %v = call <8 x i16> @llvm.ssub.sat.v8i16(<8 x i16> %va, <8 x i16> %b)
241 define <8 x i16> @ssub_v8i16_vx(<8 x i16> %va, i16 %b) {
242 ; CHECK-LABEL: ssub_v8i16_vx:
244 ; CHECK-NEXT: vsetivli zero, 8, e16, m1, ta, ma
245 ; CHECK-NEXT: vssub.vx v8, v8, a0
247 %elt.head = insertelement <8 x i16> poison, i16 %b, i32 0
248 %vb = shufflevector <8 x i16> %elt.head, <8 x i16> poison, <8 x i32> zeroinitializer
249 %v = call <8 x i16> @llvm.ssub.sat.v8i16(<8 x i16> %va, <8 x i16> %vb)
253 define <8 x i16> @ssub_v8i16_vi(<8 x i16> %va) {
254 ; CHECK-LABEL: ssub_v8i16_vi:
256 ; CHECK-NEXT: li a0, 1
257 ; CHECK-NEXT: vsetivli zero, 8, e16, m1, ta, ma
258 ; CHECK-NEXT: vssub.vx v8, v8, a0
260 %elt.head = insertelement <8 x i16> poison, i16 1, i32 0
261 %vb = shufflevector <8 x i16> %elt.head, <8 x i16> poison, <8 x i32> zeroinitializer
262 %v = call <8 x i16> @llvm.ssub.sat.v8i16(<8 x i16> %va, <8 x i16> %vb)
266 declare <16 x i16> @llvm.ssub.sat.v16i16(<16 x i16>, <16 x i16>)
268 define <16 x i16> @ssub_v16i16_vv(<16 x i16> %va, <16 x i16> %b) {
269 ; CHECK-LABEL: ssub_v16i16_vv:
271 ; CHECK-NEXT: vsetivli zero, 16, e16, m2, ta, ma
272 ; CHECK-NEXT: vssub.vv v8, v8, v10
274 %v = call <16 x i16> @llvm.ssub.sat.v16i16(<16 x i16> %va, <16 x i16> %b)
278 define <16 x i16> @ssub_v16i16_vx(<16 x i16> %va, i16 %b) {
279 ; CHECK-LABEL: ssub_v16i16_vx:
281 ; CHECK-NEXT: vsetivli zero, 16, e16, m2, ta, ma
282 ; CHECK-NEXT: vssub.vx v8, v8, a0
284 %elt.head = insertelement <16 x i16> poison, i16 %b, i32 0
285 %vb = shufflevector <16 x i16> %elt.head, <16 x i16> poison, <16 x i32> zeroinitializer
286 %v = call <16 x i16> @llvm.ssub.sat.v16i16(<16 x i16> %va, <16 x i16> %vb)
290 define <16 x i16> @ssub_v16i16_vi(<16 x i16> %va) {
291 ; CHECK-LABEL: ssub_v16i16_vi:
293 ; CHECK-NEXT: li a0, 1
294 ; CHECK-NEXT: vsetivli zero, 16, e16, m2, ta, ma
295 ; CHECK-NEXT: vssub.vx v8, v8, a0
297 %elt.head = insertelement <16 x i16> poison, i16 1, i32 0
298 %vb = shufflevector <16 x i16> %elt.head, <16 x i16> poison, <16 x i32> zeroinitializer
299 %v = call <16 x i16> @llvm.ssub.sat.v16i16(<16 x i16> %va, <16 x i16> %vb)
303 declare <2 x i32> @llvm.ssub.sat.v2i32(<2 x i32>, <2 x i32>)
305 define <2 x i32> @ssub_v2i32_vv(<2 x i32> %va, <2 x i32> %b) {
306 ; CHECK-LABEL: ssub_v2i32_vv:
308 ; CHECK-NEXT: vsetivli zero, 2, e32, mf2, ta, ma
309 ; CHECK-NEXT: vssub.vv v8, v8, v9
311 %v = call <2 x i32> @llvm.ssub.sat.v2i32(<2 x i32> %va, <2 x i32> %b)
315 define <2 x i32> @ssub_v2i32_vx(<2 x i32> %va, i32 %b) {
316 ; CHECK-LABEL: ssub_v2i32_vx:
318 ; CHECK-NEXT: vsetivli zero, 2, e32, mf2, ta, ma
319 ; CHECK-NEXT: vssub.vx v8, v8, a0
321 %elt.head = insertelement <2 x i32> poison, i32 %b, i32 0
322 %vb = shufflevector <2 x i32> %elt.head, <2 x i32> poison, <2 x i32> zeroinitializer
323 %v = call <2 x i32> @llvm.ssub.sat.v2i32(<2 x i32> %va, <2 x i32> %vb)
327 define <2 x i32> @ssub_v2i32_vi(<2 x i32> %va) {
328 ; CHECK-LABEL: ssub_v2i32_vi:
330 ; CHECK-NEXT: li a0, 1
331 ; CHECK-NEXT: vsetivli zero, 2, e32, mf2, ta, ma
332 ; CHECK-NEXT: vssub.vx v8, v8, a0
334 %elt.head = insertelement <2 x i32> poison, i32 1, i32 0
335 %vb = shufflevector <2 x i32> %elt.head, <2 x i32> poison, <2 x i32> zeroinitializer
336 %v = call <2 x i32> @llvm.ssub.sat.v2i32(<2 x i32> %va, <2 x i32> %vb)
340 declare <4 x i32> @llvm.ssub.sat.v4i32(<4 x i32>, <4 x i32>)
342 define <4 x i32> @ssub_v4i32_vv(<4 x i32> %va, <4 x i32> %b) {
343 ; CHECK-LABEL: ssub_v4i32_vv:
345 ; CHECK-NEXT: vsetivli zero, 4, e32, m1, ta, ma
346 ; CHECK-NEXT: vssub.vv v8, v8, v9
348 %v = call <4 x i32> @llvm.ssub.sat.v4i32(<4 x i32> %va, <4 x i32> %b)
352 define <4 x i32> @ssub_v4i32_vx(<4 x i32> %va, i32 %b) {
353 ; CHECK-LABEL: ssub_v4i32_vx:
355 ; CHECK-NEXT: vsetivli zero, 4, e32, m1, ta, ma
356 ; CHECK-NEXT: vssub.vx v8, v8, a0
358 %elt.head = insertelement <4 x i32> poison, i32 %b, i32 0
359 %vb = shufflevector <4 x i32> %elt.head, <4 x i32> poison, <4 x i32> zeroinitializer
360 %v = call <4 x i32> @llvm.ssub.sat.v4i32(<4 x i32> %va, <4 x i32> %vb)
364 define <4 x i32> @ssub_v4i32_vi(<4 x i32> %va) {
365 ; CHECK-LABEL: ssub_v4i32_vi:
367 ; CHECK-NEXT: li a0, 1
368 ; CHECK-NEXT: vsetivli zero, 4, e32, m1, ta, ma
369 ; CHECK-NEXT: vssub.vx v8, v8, a0
371 %elt.head = insertelement <4 x i32> poison, i32 1, i32 0
372 %vb = shufflevector <4 x i32> %elt.head, <4 x i32> poison, <4 x i32> zeroinitializer
373 %v = call <4 x i32> @llvm.ssub.sat.v4i32(<4 x i32> %va, <4 x i32> %vb)
377 declare <8 x i32> @llvm.ssub.sat.v8i32(<8 x i32>, <8 x i32>)
379 define <8 x i32> @ssub_v8i32_vv(<8 x i32> %va, <8 x i32> %b) {
380 ; CHECK-LABEL: ssub_v8i32_vv:
382 ; CHECK-NEXT: vsetivli zero, 8, e32, m2, ta, ma
383 ; CHECK-NEXT: vssub.vv v8, v8, v10
385 %v = call <8 x i32> @llvm.ssub.sat.v8i32(<8 x i32> %va, <8 x i32> %b)
389 define <8 x i32> @ssub_v8i32_vx(<8 x i32> %va, i32 %b) {
390 ; CHECK-LABEL: ssub_v8i32_vx:
392 ; CHECK-NEXT: vsetivli zero, 8, e32, m2, ta, ma
393 ; CHECK-NEXT: vssub.vx v8, v8, a0
395 %elt.head = insertelement <8 x i32> poison, i32 %b, i32 0
396 %vb = shufflevector <8 x i32> %elt.head, <8 x i32> poison, <8 x i32> zeroinitializer
397 %v = call <8 x i32> @llvm.ssub.sat.v8i32(<8 x i32> %va, <8 x i32> %vb)
401 define <8 x i32> @ssub_v8i32_vi(<8 x i32> %va) {
402 ; CHECK-LABEL: ssub_v8i32_vi:
404 ; CHECK-NEXT: li a0, 1
405 ; CHECK-NEXT: vsetivli zero, 8, e32, m2, ta, ma
406 ; CHECK-NEXT: vssub.vx v8, v8, a0
408 %elt.head = insertelement <8 x i32> poison, i32 1, i32 0
409 %vb = shufflevector <8 x i32> %elt.head, <8 x i32> poison, <8 x i32> zeroinitializer
410 %v = call <8 x i32> @llvm.ssub.sat.v8i32(<8 x i32> %va, <8 x i32> %vb)
414 declare <16 x i32> @llvm.ssub.sat.v16i32(<16 x i32>, <16 x i32>)
416 define <16 x i32> @ssub_v16i32_vv(<16 x i32> %va, <16 x i32> %b) {
417 ; CHECK-LABEL: ssub_v16i32_vv:
419 ; CHECK-NEXT: vsetivli zero, 16, e32, m4, ta, ma
420 ; CHECK-NEXT: vssub.vv v8, v8, v12
422 %v = call <16 x i32> @llvm.ssub.sat.v16i32(<16 x i32> %va, <16 x i32> %b)
426 define <16 x i32> @ssub_v16i32_vx(<16 x i32> %va, i32 %b) {
427 ; CHECK-LABEL: ssub_v16i32_vx:
429 ; CHECK-NEXT: vsetivli zero, 16, e32, m4, ta, ma
430 ; CHECK-NEXT: vssub.vx v8, v8, a0
432 %elt.head = insertelement <16 x i32> poison, i32 %b, i32 0
433 %vb = shufflevector <16 x i32> %elt.head, <16 x i32> poison, <16 x i32> zeroinitializer
434 %v = call <16 x i32> @llvm.ssub.sat.v16i32(<16 x i32> %va, <16 x i32> %vb)
438 define <16 x i32> @ssub_v16i32_vi(<16 x i32> %va) {
439 ; CHECK-LABEL: ssub_v16i32_vi:
441 ; CHECK-NEXT: li a0, 1
442 ; CHECK-NEXT: vsetivli zero, 16, e32, m4, ta, ma
443 ; CHECK-NEXT: vssub.vx v8, v8, a0
445 %elt.head = insertelement <16 x i32> poison, i32 1, 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.ssub.sat.v16i32(<16 x i32> %va, <16 x i32> %vb)
451 declare <2 x i64> @llvm.ssub.sat.v2i64(<2 x i64>, <2 x i64>)
453 define <2 x i64> @ssub_v2i64_vv(<2 x i64> %va, <2 x i64> %b) {
454 ; CHECK-LABEL: ssub_v2i64_vv:
456 ; CHECK-NEXT: vsetivli zero, 2, e64, m1, ta, ma
457 ; CHECK-NEXT: vssub.vv v8, v8, v9
459 %v = call <2 x i64> @llvm.ssub.sat.v2i64(<2 x i64> %va, <2 x i64> %b)
463 define <2 x i64> @ssub_v2i64_vx(<2 x i64> %va, i64 %b) {
464 ; RV32-LABEL: ssub_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: vssub.vv v8, v8, v9
474 ; RV32-NEXT: addi sp, sp, 16
477 ; RV64-LABEL: ssub_v2i64_vx:
479 ; RV64-NEXT: vsetivli zero, 2, e64, m1, ta, ma
480 ; RV64-NEXT: vssub.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.ssub.sat.v2i64(<2 x i64> %va, <2 x i64> %vb)
488 define <2 x i64> @ssub_v2i64_vi(<2 x i64> %va) {
489 ; CHECK-LABEL: ssub_v2i64_vi:
491 ; CHECK-NEXT: li a0, 1
492 ; CHECK-NEXT: vsetivli zero, 2, e64, m1, ta, ma
493 ; CHECK-NEXT: vssub.vx v8, v8, a0
495 %elt.head = insertelement <2 x i64> poison, i64 1, i32 0
496 %vb = shufflevector <2 x i64> %elt.head, <2 x i64> poison, <2 x i32> zeroinitializer
497 %v = call <2 x i64> @llvm.ssub.sat.v2i64(<2 x i64> %va, <2 x i64> %vb)
501 declare <4 x i64> @llvm.ssub.sat.v4i64(<4 x i64>, <4 x i64>)
503 define <4 x i64> @ssub_v4i64_vv(<4 x i64> %va, <4 x i64> %b) {
504 ; CHECK-LABEL: ssub_v4i64_vv:
506 ; CHECK-NEXT: vsetivli zero, 4, e64, m2, ta, ma
507 ; CHECK-NEXT: vssub.vv v8, v8, v10
509 %v = call <4 x i64> @llvm.ssub.sat.v4i64(<4 x i64> %va, <4 x i64> %b)
513 define <4 x i64> @ssub_v4i64_vx(<4 x i64> %va, i64 %b) {
514 ; RV32-LABEL: ssub_v4i64_vx:
516 ; RV32-NEXT: addi sp, sp, -16
517 ; RV32-NEXT: .cfi_def_cfa_offset 16
518 ; RV32-NEXT: sw a1, 12(sp)
519 ; RV32-NEXT: sw a0, 8(sp)
520 ; RV32-NEXT: addi a0, sp, 8
521 ; RV32-NEXT: vsetivli zero, 4, e64, m2, ta, ma
522 ; RV32-NEXT: vlse64.v v10, (a0), zero
523 ; RV32-NEXT: vssub.vv v8, v8, v10
524 ; RV32-NEXT: addi sp, sp, 16
527 ; RV64-LABEL: ssub_v4i64_vx:
529 ; RV64-NEXT: vsetivli zero, 4, e64, m2, ta, ma
530 ; RV64-NEXT: vssub.vx v8, v8, a0
532 %elt.head = insertelement <4 x i64> poison, i64 %b, i32 0
533 %vb = shufflevector <4 x i64> %elt.head, <4 x i64> poison, <4 x i32> zeroinitializer
534 %v = call <4 x i64> @llvm.ssub.sat.v4i64(<4 x i64> %va, <4 x i64> %vb)
538 define <4 x i64> @ssub_v4i64_vi(<4 x i64> %va) {
539 ; CHECK-LABEL: ssub_v4i64_vi:
541 ; CHECK-NEXT: li a0, 1
542 ; CHECK-NEXT: vsetivli zero, 4, e64, m2, ta, ma
543 ; CHECK-NEXT: vssub.vx v8, v8, a0
545 %elt.head = insertelement <4 x i64> poison, i64 1, i32 0
546 %vb = shufflevector <4 x i64> %elt.head, <4 x i64> poison, <4 x i32> zeroinitializer
547 %v = call <4 x i64> @llvm.ssub.sat.v4i64(<4 x i64> %va, <4 x i64> %vb)
551 declare <8 x i64> @llvm.ssub.sat.v8i64(<8 x i64>, <8 x i64>)
553 define <8 x i64> @ssub_v8i64_vv(<8 x i64> %va, <8 x i64> %b) {
554 ; CHECK-LABEL: ssub_v8i64_vv:
556 ; CHECK-NEXT: vsetivli zero, 8, e64, m4, ta, ma
557 ; CHECK-NEXT: vssub.vv v8, v8, v12
559 %v = call <8 x i64> @llvm.ssub.sat.v8i64(<8 x i64> %va, <8 x i64> %b)
563 define <8 x i64> @ssub_v8i64_vx(<8 x i64> %va, i64 %b) {
564 ; RV32-LABEL: ssub_v8i64_vx:
566 ; RV32-NEXT: addi sp, sp, -16
567 ; RV32-NEXT: .cfi_def_cfa_offset 16
568 ; RV32-NEXT: sw a1, 12(sp)
569 ; RV32-NEXT: sw a0, 8(sp)
570 ; RV32-NEXT: addi a0, sp, 8
571 ; RV32-NEXT: vsetivli zero, 8, e64, m4, ta, ma
572 ; RV32-NEXT: vlse64.v v12, (a0), zero
573 ; RV32-NEXT: vssub.vv v8, v8, v12
574 ; RV32-NEXT: addi sp, sp, 16
577 ; RV64-LABEL: ssub_v8i64_vx:
579 ; RV64-NEXT: vsetivli zero, 8, e64, m4, ta, ma
580 ; RV64-NEXT: vssub.vx v8, v8, a0
582 %elt.head = insertelement <8 x i64> poison, i64 %b, i32 0
583 %vb = shufflevector <8 x i64> %elt.head, <8 x i64> poison, <8 x i32> zeroinitializer
584 %v = call <8 x i64> @llvm.ssub.sat.v8i64(<8 x i64> %va, <8 x i64> %vb)
588 define <8 x i64> @ssub_v8i64_vi(<8 x i64> %va) {
589 ; CHECK-LABEL: ssub_v8i64_vi:
591 ; CHECK-NEXT: li a0, 1
592 ; CHECK-NEXT: vsetivli zero, 8, e64, m4, ta, ma
593 ; CHECK-NEXT: vssub.vx v8, v8, a0
595 %elt.head = insertelement <8 x i64> poison, i64 1, i32 0
596 %vb = shufflevector <8 x i64> %elt.head, <8 x i64> poison, <8 x i32> zeroinitializer
597 %v = call <8 x i64> @llvm.ssub.sat.v8i64(<8 x i64> %va, <8 x i64> %vb)
601 declare <16 x i64> @llvm.ssub.sat.v16i64(<16 x i64>, <16 x i64>)
603 define <16 x i64> @ssub_v16i64_vv(<16 x i64> %va, <16 x i64> %b) {
604 ; CHECK-LABEL: ssub_v16i64_vv:
606 ; CHECK-NEXT: vsetivli zero, 16, e64, m8, ta, ma
607 ; CHECK-NEXT: vssub.vv v8, v8, v16
609 %v = call <16 x i64> @llvm.ssub.sat.v16i64(<16 x i64> %va, <16 x i64> %b)
613 define <16 x i64> @ssub_v16i64_vx(<16 x i64> %va, i64 %b) {
614 ; RV32-LABEL: ssub_v16i64_vx:
616 ; RV32-NEXT: addi sp, sp, -16
617 ; RV32-NEXT: .cfi_def_cfa_offset 16
618 ; RV32-NEXT: sw a1, 12(sp)
619 ; RV32-NEXT: sw a0, 8(sp)
620 ; RV32-NEXT: addi a0, sp, 8
621 ; RV32-NEXT: vsetivli zero, 16, e64, m8, ta, ma
622 ; RV32-NEXT: vlse64.v v16, (a0), zero
623 ; RV32-NEXT: vssub.vv v8, v8, v16
624 ; RV32-NEXT: addi sp, sp, 16
627 ; RV64-LABEL: ssub_v16i64_vx:
629 ; RV64-NEXT: vsetivli zero, 16, e64, m8, ta, ma
630 ; RV64-NEXT: vssub.vx v8, v8, a0
632 %elt.head = insertelement <16 x i64> poison, i64 %b, i32 0
633 %vb = shufflevector <16 x i64> %elt.head, <16 x i64> poison, <16 x i32> zeroinitializer
634 %v = call <16 x i64> @llvm.ssub.sat.v16i64(<16 x i64> %va, <16 x i64> %vb)
638 define <16 x i64> @ssub_v16i64_vi(<16 x i64> %va) {
639 ; CHECK-LABEL: ssub_v16i64_vi:
641 ; CHECK-NEXT: li a0, 1
642 ; CHECK-NEXT: vsetivli zero, 16, e64, m8, ta, ma
643 ; CHECK-NEXT: vssub.vx v8, v8, a0
645 %elt.head = insertelement <16 x i64> poison, i64 1, i32 0
646 %vb = shufflevector <16 x i64> %elt.head, <16 x i64> poison, <16 x i32> zeroinitializer
647 %v = call <16 x i64> @llvm.ssub.sat.v16i64(<16 x i64> %va, <16 x i64> %vb)