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 <8 x i7> @llvm.vp.ssub.sat.v8i7(<8 x i7>, <8 x i7>, <8 x i1>, i32)
9 define <8 x i7> @vssub_vv_v8i7(<8 x i7> %va, <8 x i7> %b, <8 x i1> %m, i32 zeroext %evl) {
10 ; CHECK-LABEL: vssub_vv_v8i7:
12 ; CHECK-NEXT: vsetivli zero, 8, e8, mf2, ta, ma
13 ; CHECK-NEXT: vadd.vv v9, v9, v9
14 ; CHECK-NEXT: vsra.vi v9, v9, 1
15 ; CHECK-NEXT: vadd.vv v8, v8, v8
16 ; CHECK-NEXT: vsra.vi v8, v8, 1
17 ; CHECK-NEXT: vsetvli zero, a0, e8, mf2, ta, ma
18 ; CHECK-NEXT: vsub.vv v8, v8, v9, v0.t
19 ; CHECK-NEXT: li a0, 63
20 ; CHECK-NEXT: vmin.vx v8, v8, a0, v0.t
21 ; CHECK-NEXT: li a0, 192
22 ; CHECK-NEXT: vmax.vx v8, v8, a0, v0.t
24 %v = call <8 x i7> @llvm.vp.ssub.sat.v8i7(<8 x i7> %va, <8 x i7> %b, <8 x i1> %m, i32 %evl)
28 declare <2 x i8> @llvm.vp.ssub.sat.v2i8(<2 x i8>, <2 x i8>, <2 x i1>, i32)
30 define <2 x i8> @vssub_vv_v2i8(<2 x i8> %va, <2 x i8> %b, <2 x i1> %m, i32 zeroext %evl) {
31 ; CHECK-LABEL: vssub_vv_v2i8:
33 ; CHECK-NEXT: vsetvli zero, a0, e8, mf8, ta, ma
34 ; CHECK-NEXT: vssub.vv v8, v8, v9, v0.t
36 %v = call <2 x i8> @llvm.vp.ssub.sat.v2i8(<2 x i8> %va, <2 x i8> %b, <2 x i1> %m, i32 %evl)
40 define <2 x i8> @vssub_vv_v2i8_unmasked(<2 x i8> %va, <2 x i8> %b, i32 zeroext %evl) {
41 ; CHECK-LABEL: vssub_vv_v2i8_unmasked:
43 ; CHECK-NEXT: vsetvli zero, a0, e8, mf8, ta, ma
44 ; CHECK-NEXT: vssub.vv v8, v8, v9
46 %v = call <2 x i8> @llvm.vp.ssub.sat.v2i8(<2 x i8> %va, <2 x i8> %b, <2 x i1> splat (i1 true), i32 %evl)
50 define <2 x i8> @vssub_vx_v2i8(<2 x i8> %va, i8 %b, <2 x i1> %m, i32 zeroext %evl) {
51 ; CHECK-LABEL: vssub_vx_v2i8:
53 ; CHECK-NEXT: vsetvli zero, a1, e8, mf8, ta, ma
54 ; CHECK-NEXT: vssub.vx v8, v8, a0, v0.t
56 %elt.head = insertelement <2 x i8> poison, i8 %b, i32 0
57 %vb = shufflevector <2 x i8> %elt.head, <2 x i8> poison, <2 x i32> zeroinitializer
58 %v = call <2 x i8> @llvm.vp.ssub.sat.v2i8(<2 x i8> %va, <2 x i8> %vb, <2 x i1> %m, i32 %evl)
62 define <2 x i8> @vssub_vx_v2i8_unmasked(<2 x i8> %va, i8 %b, i32 zeroext %evl) {
63 ; CHECK-LABEL: vssub_vx_v2i8_unmasked:
65 ; CHECK-NEXT: vsetvli zero, a1, e8, mf8, ta, ma
66 ; CHECK-NEXT: vssub.vx v8, v8, a0
68 %elt.head = insertelement <2 x i8> poison, i8 %b, i32 0
69 %vb = shufflevector <2 x i8> %elt.head, <2 x i8> poison, <2 x i32> zeroinitializer
70 %v = call <2 x i8> @llvm.vp.ssub.sat.v2i8(<2 x i8> %va, <2 x i8> %vb, <2 x i1> splat (i1 true), i32 %evl)
74 define <2 x i8> @vssub_vi_v2i8(<2 x i8> %va, <2 x i1> %m, i32 zeroext %evl) {
75 ; CHECK-LABEL: vssub_vi_v2i8:
77 ; CHECK-NEXT: li a1, -1
78 ; CHECK-NEXT: vsetvli zero, a0, e8, mf8, ta, ma
79 ; CHECK-NEXT: vssub.vx v8, v8, a1, v0.t
81 %v = call <2 x i8> @llvm.vp.ssub.sat.v2i8(<2 x i8> %va, <2 x i8> splat (i8 -1), <2 x i1> %m, i32 %evl)
85 define <2 x i8> @vssub_vi_v2i8_unmasked(<2 x i8> %va, i32 zeroext %evl) {
86 ; CHECK-LABEL: vssub_vi_v2i8_unmasked:
88 ; CHECK-NEXT: li a1, -1
89 ; CHECK-NEXT: vsetvli zero, a0, e8, mf8, ta, ma
90 ; CHECK-NEXT: vssub.vx v8, v8, a1
92 %v = call <2 x i8> @llvm.vp.ssub.sat.v2i8(<2 x i8> %va, <2 x i8> splat (i8 -1), <2 x i1> splat (i1 true), i32 %evl)
96 declare <4 x i8> @llvm.vp.ssub.sat.v4i8(<4 x i8>, <4 x i8>, <4 x i1>, i32)
98 define <4 x i8> @vssub_vv_v4i8(<4 x i8> %va, <4 x i8> %b, <4 x i1> %m, i32 zeroext %evl) {
99 ; CHECK-LABEL: vssub_vv_v4i8:
101 ; CHECK-NEXT: vsetvli zero, a0, e8, mf4, ta, ma
102 ; CHECK-NEXT: vssub.vv v8, v8, v9, v0.t
104 %v = call <4 x i8> @llvm.vp.ssub.sat.v4i8(<4 x i8> %va, <4 x i8> %b, <4 x i1> %m, i32 %evl)
108 define <4 x i8> @vssub_vv_v4i8_unmasked(<4 x i8> %va, <4 x i8> %b, i32 zeroext %evl) {
109 ; CHECK-LABEL: vssub_vv_v4i8_unmasked:
111 ; CHECK-NEXT: vsetvli zero, a0, e8, mf4, ta, ma
112 ; CHECK-NEXT: vssub.vv v8, v8, v9
114 %v = call <4 x i8> @llvm.vp.ssub.sat.v4i8(<4 x i8> %va, <4 x i8> %b, <4 x i1> splat (i1 true), i32 %evl)
118 define <4 x i8> @vssub_vx_v4i8(<4 x i8> %va, i8 %b, <4 x i1> %m, i32 zeroext %evl) {
119 ; CHECK-LABEL: vssub_vx_v4i8:
121 ; CHECK-NEXT: vsetvli zero, a1, e8, mf4, ta, ma
122 ; CHECK-NEXT: vssub.vx v8, v8, a0, v0.t
124 %elt.head = insertelement <4 x i8> poison, i8 %b, i32 0
125 %vb = shufflevector <4 x i8> %elt.head, <4 x i8> poison, <4 x i32> zeroinitializer
126 %v = call <4 x i8> @llvm.vp.ssub.sat.v4i8(<4 x i8> %va, <4 x i8> %vb, <4 x i1> %m, i32 %evl)
130 define <4 x i8> @vssub_vx_v4i8_commute(<4 x i8> %va, i8 %b, <4 x i1> %m, i32 zeroext %evl) {
131 ; CHECK-LABEL: vssub_vx_v4i8_commute:
133 ; CHECK-NEXT: vsetivli zero, 4, e8, mf4, ta, ma
134 ; CHECK-NEXT: vmv.v.x v9, a0
135 ; CHECK-NEXT: vsetvli zero, a1, e8, mf4, ta, ma
136 ; CHECK-NEXT: vssub.vv v8, v9, v8, v0.t
138 %elt.head = insertelement <4 x i8> poison, i8 %b, i32 0
139 %vb = shufflevector <4 x i8> %elt.head, <4 x i8> poison, <4 x i32> zeroinitializer
140 %v = call <4 x i8> @llvm.vp.ssub.sat.v4i8(<4 x i8> %vb, <4 x i8> %va, <4 x i1> %m, i32 %evl)
144 define <4 x i8> @vssub_vx_v4i8_unmasked(<4 x i8> %va, i8 %b, i32 zeroext %evl) {
145 ; CHECK-LABEL: vssub_vx_v4i8_unmasked:
147 ; CHECK-NEXT: vsetvli zero, a1, e8, mf4, ta, ma
148 ; CHECK-NEXT: vssub.vx v8, v8, a0
150 %elt.head = insertelement <4 x i8> poison, i8 %b, i32 0
151 %vb = shufflevector <4 x i8> %elt.head, <4 x i8> poison, <4 x i32> zeroinitializer
152 %v = call <4 x i8> @llvm.vp.ssub.sat.v4i8(<4 x i8> %va, <4 x i8> %vb, <4 x i1> splat (i1 true), i32 %evl)
156 define <4 x i8> @vssub_vi_v4i8(<4 x i8> %va, <4 x i1> %m, i32 zeroext %evl) {
157 ; CHECK-LABEL: vssub_vi_v4i8:
159 ; CHECK-NEXT: li a1, -1
160 ; CHECK-NEXT: vsetvli zero, a0, e8, mf4, ta, ma
161 ; CHECK-NEXT: vssub.vx v8, v8, a1, v0.t
163 %v = call <4 x i8> @llvm.vp.ssub.sat.v4i8(<4 x i8> %va, <4 x i8> splat (i8 -1), <4 x i1> %m, i32 %evl)
167 define <4 x i8> @vssub_vi_v4i8_unmasked(<4 x i8> %va, i32 zeroext %evl) {
168 ; CHECK-LABEL: vssub_vi_v4i8_unmasked:
170 ; CHECK-NEXT: li a1, -1
171 ; CHECK-NEXT: vsetvli zero, a0, e8, mf4, ta, ma
172 ; CHECK-NEXT: vssub.vx v8, v8, a1
174 %v = call <4 x i8> @llvm.vp.ssub.sat.v4i8(<4 x i8> %va, <4 x i8> splat (i8 -1), <4 x i1> splat (i1 true), i32 %evl)
178 declare <5 x i8> @llvm.vp.ssub.sat.v5i8(<5 x i8>, <5 x i8>, <5 x i1>, i32)
180 define <5 x i8> @vssub_vv_v5i8(<5 x i8> %va, <5 x i8> %b, <5 x i1> %m, i32 zeroext %evl) {
181 ; CHECK-LABEL: vssub_vv_v5i8:
183 ; CHECK-NEXT: vsetvli zero, a0, e8, mf2, ta, ma
184 ; CHECK-NEXT: vssub.vv v8, v8, v9, v0.t
186 %v = call <5 x i8> @llvm.vp.ssub.sat.v5i8(<5 x i8> %va, <5 x i8> %b, <5 x i1> %m, i32 %evl)
190 define <5 x i8> @vssub_vv_v5i8_unmasked(<5 x i8> %va, <5 x i8> %b, i32 zeroext %evl) {
191 ; CHECK-LABEL: vssub_vv_v5i8_unmasked:
193 ; CHECK-NEXT: vsetvli zero, a0, e8, mf2, ta, ma
194 ; CHECK-NEXT: vssub.vv v8, v8, v9
196 %v = call <5 x i8> @llvm.vp.ssub.sat.v5i8(<5 x i8> %va, <5 x i8> %b, <5 x i1> splat (i1 true), i32 %evl)
200 define <5 x i8> @vssub_vx_v5i8(<5 x i8> %va, i8 %b, <5 x i1> %m, i32 zeroext %evl) {
201 ; CHECK-LABEL: vssub_vx_v5i8:
203 ; CHECK-NEXT: vsetvli zero, a1, e8, mf2, ta, ma
204 ; CHECK-NEXT: vssub.vx v8, v8, a0, v0.t
206 %elt.head = insertelement <5 x i8> poison, i8 %b, i32 0
207 %vb = shufflevector <5 x i8> %elt.head, <5 x i8> poison, <5 x i32> zeroinitializer
208 %v = call <5 x i8> @llvm.vp.ssub.sat.v5i8(<5 x i8> %va, <5 x i8> %vb, <5 x i1> %m, i32 %evl)
212 define <5 x i8> @vssub_vx_v5i8_unmasked(<5 x i8> %va, i8 %b, i32 zeroext %evl) {
213 ; CHECK-LABEL: vssub_vx_v5i8_unmasked:
215 ; CHECK-NEXT: vsetvli zero, a1, e8, mf2, ta, ma
216 ; CHECK-NEXT: vssub.vx v8, v8, a0
218 %elt.head = insertelement <5 x i8> poison, i8 %b, i32 0
219 %vb = shufflevector <5 x i8> %elt.head, <5 x i8> poison, <5 x i32> zeroinitializer
220 %v = call <5 x i8> @llvm.vp.ssub.sat.v5i8(<5 x i8> %va, <5 x i8> %vb, <5 x i1> splat (i1 true), i32 %evl)
224 define <5 x i8> @vssub_vi_v5i8(<5 x i8> %va, <5 x i1> %m, i32 zeroext %evl) {
225 ; CHECK-LABEL: vssub_vi_v5i8:
227 ; CHECK-NEXT: li a1, -1
228 ; CHECK-NEXT: vsetvli zero, a0, e8, mf2, ta, ma
229 ; CHECK-NEXT: vssub.vx v8, v8, a1, v0.t
231 %v = call <5 x i8> @llvm.vp.ssub.sat.v5i8(<5 x i8> %va, <5 x i8> splat (i8 -1), <5 x i1> %m, i32 %evl)
235 define <5 x i8> @vssub_vi_v5i8_unmasked(<5 x i8> %va, i32 zeroext %evl) {
236 ; CHECK-LABEL: vssub_vi_v5i8_unmasked:
238 ; CHECK-NEXT: li a1, -1
239 ; CHECK-NEXT: vsetvli zero, a0, e8, mf2, ta, ma
240 ; CHECK-NEXT: vssub.vx v8, v8, a1
242 %v = call <5 x i8> @llvm.vp.ssub.sat.v5i8(<5 x i8> %va, <5 x i8> splat (i8 -1), <5 x i1> splat (i1 true), i32 %evl)
246 declare <8 x i8> @llvm.vp.ssub.sat.v8i8(<8 x i8>, <8 x i8>, <8 x i1>, i32)
248 define <8 x i8> @vssub_vv_v8i8(<8 x i8> %va, <8 x i8> %b, <8 x i1> %m, i32 zeroext %evl) {
249 ; CHECK-LABEL: vssub_vv_v8i8:
251 ; CHECK-NEXT: vsetvli zero, a0, e8, mf2, ta, ma
252 ; CHECK-NEXT: vssub.vv v8, v8, v9, v0.t
254 %v = call <8 x i8> @llvm.vp.ssub.sat.v8i8(<8 x i8> %va, <8 x i8> %b, <8 x i1> %m, i32 %evl)
258 define <8 x i8> @vssub_vv_v8i8_unmasked(<8 x i8> %va, <8 x i8> %b, i32 zeroext %evl) {
259 ; CHECK-LABEL: vssub_vv_v8i8_unmasked:
261 ; CHECK-NEXT: vsetvli zero, a0, e8, mf2, ta, ma
262 ; CHECK-NEXT: vssub.vv v8, v8, v9
264 %v = call <8 x i8> @llvm.vp.ssub.sat.v8i8(<8 x i8> %va, <8 x i8> %b, <8 x i1> splat (i1 true), i32 %evl)
268 define <8 x i8> @vssub_vx_v8i8(<8 x i8> %va, i8 %b, <8 x i1> %m, i32 zeroext %evl) {
269 ; CHECK-LABEL: vssub_vx_v8i8:
271 ; CHECK-NEXT: vsetvli zero, a1, e8, mf2, ta, ma
272 ; CHECK-NEXT: vssub.vx v8, v8, a0, v0.t
274 %elt.head = insertelement <8 x i8> poison, i8 %b, i32 0
275 %vb = shufflevector <8 x i8> %elt.head, <8 x i8> poison, <8 x i32> zeroinitializer
276 %v = call <8 x i8> @llvm.vp.ssub.sat.v8i8(<8 x i8> %va, <8 x i8> %vb, <8 x i1> %m, i32 %evl)
280 define <8 x i8> @vssub_vx_v8i8_unmasked(<8 x i8> %va, i8 %b, i32 zeroext %evl) {
281 ; CHECK-LABEL: vssub_vx_v8i8_unmasked:
283 ; CHECK-NEXT: vsetvli zero, a1, e8, mf2, ta, ma
284 ; CHECK-NEXT: vssub.vx v8, v8, a0
286 %elt.head = insertelement <8 x i8> poison, i8 %b, i32 0
287 %vb = shufflevector <8 x i8> %elt.head, <8 x i8> poison, <8 x i32> zeroinitializer
288 %v = call <8 x i8> @llvm.vp.ssub.sat.v8i8(<8 x i8> %va, <8 x i8> %vb, <8 x i1> splat (i1 true), i32 %evl)
292 define <8 x i8> @vssub_vi_v8i8(<8 x i8> %va, <8 x i1> %m, i32 zeroext %evl) {
293 ; CHECK-LABEL: vssub_vi_v8i8:
295 ; CHECK-NEXT: li a1, -1
296 ; CHECK-NEXT: vsetvli zero, a0, e8, mf2, ta, ma
297 ; CHECK-NEXT: vssub.vx v8, v8, a1, v0.t
299 %v = call <8 x i8> @llvm.vp.ssub.sat.v8i8(<8 x i8> %va, <8 x i8> splat (i8 -1), <8 x i1> %m, i32 %evl)
303 define <8 x i8> @vssub_vi_v8i8_unmasked(<8 x i8> %va, i32 zeroext %evl) {
304 ; CHECK-LABEL: vssub_vi_v8i8_unmasked:
306 ; CHECK-NEXT: li a1, -1
307 ; CHECK-NEXT: vsetvli zero, a0, e8, mf2, ta, ma
308 ; CHECK-NEXT: vssub.vx v8, v8, a1
310 %v = call <8 x i8> @llvm.vp.ssub.sat.v8i8(<8 x i8> %va, <8 x i8> splat (i8 -1), <8 x i1> splat (i1 true), i32 %evl)
314 declare <16 x i8> @llvm.vp.ssub.sat.v16i8(<16 x i8>, <16 x i8>, <16 x i1>, i32)
316 define <16 x i8> @vssub_vv_v16i8(<16 x i8> %va, <16 x i8> %b, <16 x i1> %m, i32 zeroext %evl) {
317 ; CHECK-LABEL: vssub_vv_v16i8:
319 ; CHECK-NEXT: vsetvli zero, a0, e8, m1, ta, ma
320 ; CHECK-NEXT: vssub.vv v8, v8, v9, v0.t
322 %v = call <16 x i8> @llvm.vp.ssub.sat.v16i8(<16 x i8> %va, <16 x i8> %b, <16 x i1> %m, i32 %evl)
326 define <16 x i8> @vssub_vv_v16i8_unmasked(<16 x i8> %va, <16 x i8> %b, i32 zeroext %evl) {
327 ; CHECK-LABEL: vssub_vv_v16i8_unmasked:
329 ; CHECK-NEXT: vsetvli zero, a0, e8, m1, ta, ma
330 ; CHECK-NEXT: vssub.vv v8, v8, v9
332 %v = call <16 x i8> @llvm.vp.ssub.sat.v16i8(<16 x i8> %va, <16 x i8> %b, <16 x i1> splat (i1 true), i32 %evl)
336 define <16 x i8> @vssub_vx_v16i8(<16 x i8> %va, i8 %b, <16 x i1> %m, i32 zeroext %evl) {
337 ; CHECK-LABEL: vssub_vx_v16i8:
339 ; CHECK-NEXT: vsetvli zero, a1, e8, m1, ta, ma
340 ; CHECK-NEXT: vssub.vx v8, v8, a0, v0.t
342 %elt.head = insertelement <16 x i8> poison, i8 %b, i32 0
343 %vb = shufflevector <16 x i8> %elt.head, <16 x i8> poison, <16 x i32> zeroinitializer
344 %v = call <16 x i8> @llvm.vp.ssub.sat.v16i8(<16 x i8> %va, <16 x i8> %vb, <16 x i1> %m, i32 %evl)
348 define <16 x i8> @vssub_vx_v16i8_unmasked(<16 x i8> %va, i8 %b, i32 zeroext %evl) {
349 ; CHECK-LABEL: vssub_vx_v16i8_unmasked:
351 ; CHECK-NEXT: vsetvli zero, a1, e8, m1, ta, ma
352 ; CHECK-NEXT: vssub.vx v8, v8, a0
354 %elt.head = insertelement <16 x i8> poison, i8 %b, i32 0
355 %vb = shufflevector <16 x i8> %elt.head, <16 x i8> poison, <16 x i32> zeroinitializer
356 %v = call <16 x i8> @llvm.vp.ssub.sat.v16i8(<16 x i8> %va, <16 x i8> %vb, <16 x i1> splat (i1 true), i32 %evl)
360 define <16 x i8> @vssub_vi_v16i8(<16 x i8> %va, <16 x i1> %m, i32 zeroext %evl) {
361 ; CHECK-LABEL: vssub_vi_v16i8:
363 ; CHECK-NEXT: li a1, -1
364 ; CHECK-NEXT: vsetvli zero, a0, e8, m1, ta, ma
365 ; CHECK-NEXT: vssub.vx v8, v8, a1, v0.t
367 %v = call <16 x i8> @llvm.vp.ssub.sat.v16i8(<16 x i8> %va, <16 x i8> splat (i8 -1), <16 x i1> %m, i32 %evl)
371 define <16 x i8> @vssub_vi_v16i8_unmasked(<16 x i8> %va, i32 zeroext %evl) {
372 ; CHECK-LABEL: vssub_vi_v16i8_unmasked:
374 ; CHECK-NEXT: li a1, -1
375 ; CHECK-NEXT: vsetvli zero, a0, e8, m1, ta, ma
376 ; CHECK-NEXT: vssub.vx v8, v8, a1
378 %v = call <16 x i8> @llvm.vp.ssub.sat.v16i8(<16 x i8> %va, <16 x i8> splat (i8 -1), <16 x i1> splat (i1 true), i32 %evl)
382 declare <256 x i8> @llvm.vp.ssub.sat.v258i8(<256 x i8>, <256 x i8>, <256 x i1>, i32)
384 define <256 x i8> @vssub_vi_v258i8(<256 x i8> %va, <256 x i1> %m, i32 zeroext %evl) {
385 ; CHECK-LABEL: vssub_vi_v258i8:
387 ; CHECK-NEXT: vmv1r.v v24, v0
388 ; CHECK-NEXT: li a2, 128
389 ; CHECK-NEXT: vsetvli zero, a2, e8, m8, ta, ma
390 ; CHECK-NEXT: vlm.v v0, (a0)
391 ; CHECK-NEXT: addi a0, a1, -128
392 ; CHECK-NEXT: sltu a3, a1, a0
393 ; CHECK-NEXT: addi a3, a3, -1
394 ; CHECK-NEXT: and a3, a3, a0
395 ; CHECK-NEXT: li a0, -1
396 ; CHECK-NEXT: vsetvli zero, a3, e8, m8, ta, ma
397 ; CHECK-NEXT: vssub.vx v16, v16, a0, v0.t
398 ; CHECK-NEXT: bltu a1, a2, .LBB32_2
399 ; CHECK-NEXT: # %bb.1:
400 ; CHECK-NEXT: li a1, 128
401 ; CHECK-NEXT: .LBB32_2:
402 ; CHECK-NEXT: vmv1r.v v0, v24
403 ; CHECK-NEXT: vsetvli zero, a1, e8, m8, ta, ma
404 ; CHECK-NEXT: vssub.vx v8, v8, a0, v0.t
406 %v = call <256 x i8> @llvm.vp.ssub.sat.v258i8(<256 x i8> %va, <256 x i8> splat (i8 -1), <256 x i1> %m, i32 %evl)
410 define <256 x i8> @vssub_vi_v258i8_unmasked(<256 x i8> %va, i32 zeroext %evl) {
411 ; CHECK-LABEL: vssub_vi_v258i8_unmasked:
413 ; CHECK-NEXT: li a2, 128
414 ; CHECK-NEXT: mv a1, a0
415 ; CHECK-NEXT: bltu a0, a2, .LBB33_2
416 ; CHECK-NEXT: # %bb.1:
417 ; CHECK-NEXT: li a1, 128
418 ; CHECK-NEXT: .LBB33_2:
419 ; CHECK-NEXT: li a2, -1
420 ; CHECK-NEXT: vsetvli zero, a1, e8, m8, ta, ma
421 ; CHECK-NEXT: vssub.vx v8, v8, a2
422 ; CHECK-NEXT: addi a1, a0, -128
423 ; CHECK-NEXT: sltu a0, a0, a1
424 ; CHECK-NEXT: addi a0, a0, -1
425 ; CHECK-NEXT: and a0, a0, a1
426 ; CHECK-NEXT: vsetvli zero, a0, e8, m8, ta, ma
427 ; CHECK-NEXT: vssub.vx v16, v16, a2
429 %v = call <256 x i8> @llvm.vp.ssub.sat.v258i8(<256 x i8> %va, <256 x i8> splat (i8 -1), <256 x i1> splat (i1 true), i32 %evl)
433 ; Test splitting when the %evl is a known constant.
435 define <256 x i8> @vssub_vi_v258i8_evl129(<256 x i8> %va, <256 x i1> %m) {
436 ; CHECK-LABEL: vssub_vi_v258i8_evl129:
438 ; CHECK-NEXT: li a1, 128
439 ; CHECK-NEXT: vsetvli zero, a1, e8, m8, ta, ma
440 ; CHECK-NEXT: vlm.v v24, (a0)
441 ; CHECK-NEXT: li a0, -1
442 ; CHECK-NEXT: vssub.vx v8, v8, a0, v0.t
443 ; CHECK-NEXT: vmv1r.v v0, v24
444 ; CHECK-NEXT: vsetivli zero, 1, e8, m8, ta, ma
445 ; CHECK-NEXT: vssub.vx v16, v16, a0, v0.t
447 %v = call <256 x i8> @llvm.vp.ssub.sat.v258i8(<256 x i8> %va, <256 x i8> splat (i8 -1), <256 x i1> %m, i32 129)
451 ; FIXME: The upper half is doing nothing.
453 define <256 x i8> @vssub_vi_v258i8_evl128(<256 x i8> %va, <256 x i1> %m) {
454 ; CHECK-LABEL: vssub_vi_v258i8_evl128:
456 ; CHECK-NEXT: li a1, 128
457 ; CHECK-NEXT: vsetvli zero, a1, e8, m8, ta, ma
458 ; CHECK-NEXT: vlm.v v24, (a0)
459 ; CHECK-NEXT: li a0, -1
460 ; CHECK-NEXT: vssub.vx v8, v8, a0, v0.t
461 ; CHECK-NEXT: vmv1r.v v0, v24
462 ; CHECK-NEXT: vsetivli zero, 0, e8, m8, ta, ma
463 ; CHECK-NEXT: vssub.vx v16, v16, a0, v0.t
465 %v = call <256 x i8> @llvm.vp.ssub.sat.v258i8(<256 x i8> %va, <256 x i8> splat (i8 -1), <256 x i1> %m, i32 128)
469 declare <2 x i16> @llvm.vp.ssub.sat.v2i16(<2 x i16>, <2 x i16>, <2 x i1>, i32)
471 define <2 x i16> @vssub_vv_v2i16(<2 x i16> %va, <2 x i16> %b, <2 x i1> %m, i32 zeroext %evl) {
472 ; CHECK-LABEL: vssub_vv_v2i16:
474 ; CHECK-NEXT: vsetvli zero, a0, e16, mf4, ta, ma
475 ; CHECK-NEXT: vssub.vv v8, v8, v9, v0.t
477 %v = call <2 x i16> @llvm.vp.ssub.sat.v2i16(<2 x i16> %va, <2 x i16> %b, <2 x i1> %m, i32 %evl)
481 define <2 x i16> @vssub_vv_v2i16_unmasked(<2 x i16> %va, <2 x i16> %b, i32 zeroext %evl) {
482 ; CHECK-LABEL: vssub_vv_v2i16_unmasked:
484 ; CHECK-NEXT: vsetvli zero, a0, e16, mf4, ta, ma
485 ; CHECK-NEXT: vssub.vv v8, v8, v9
487 %v = call <2 x i16> @llvm.vp.ssub.sat.v2i16(<2 x i16> %va, <2 x i16> %b, <2 x i1> splat (i1 true), i32 %evl)
491 define <2 x i16> @vssub_vx_v2i16(<2 x i16> %va, i16 %b, <2 x i1> %m, i32 zeroext %evl) {
492 ; CHECK-LABEL: vssub_vx_v2i16:
494 ; CHECK-NEXT: vsetvli zero, a1, e16, mf4, ta, ma
495 ; CHECK-NEXT: vssub.vx v8, v8, a0, v0.t
497 %elt.head = insertelement <2 x i16> poison, i16 %b, i32 0
498 %vb = shufflevector <2 x i16> %elt.head, <2 x i16> poison, <2 x i32> zeroinitializer
499 %v = call <2 x i16> @llvm.vp.ssub.sat.v2i16(<2 x i16> %va, <2 x i16> %vb, <2 x i1> %m, i32 %evl)
503 define <2 x i16> @vssub_vx_v2i16_unmasked(<2 x i16> %va, i16 %b, i32 zeroext %evl) {
504 ; CHECK-LABEL: vssub_vx_v2i16_unmasked:
506 ; CHECK-NEXT: vsetvli zero, a1, e16, mf4, ta, ma
507 ; CHECK-NEXT: vssub.vx v8, v8, a0
509 %elt.head = insertelement <2 x i16> poison, i16 %b, i32 0
510 %vb = shufflevector <2 x i16> %elt.head, <2 x i16> poison, <2 x i32> zeroinitializer
511 %v = call <2 x i16> @llvm.vp.ssub.sat.v2i16(<2 x i16> %va, <2 x i16> %vb, <2 x i1> splat (i1 true), i32 %evl)
515 define <2 x i16> @vssub_vi_v2i16(<2 x i16> %va, <2 x i1> %m, i32 zeroext %evl) {
516 ; CHECK-LABEL: vssub_vi_v2i16:
518 ; CHECK-NEXT: li a1, -1
519 ; CHECK-NEXT: vsetvli zero, a0, e16, mf4, ta, ma
520 ; CHECK-NEXT: vssub.vx v8, v8, a1, v0.t
522 %v = call <2 x i16> @llvm.vp.ssub.sat.v2i16(<2 x i16> %va, <2 x i16> splat (i16 -1), <2 x i1> %m, i32 %evl)
526 define <2 x i16> @vssub_vi_v2i16_unmasked(<2 x i16> %va, i32 zeroext %evl) {
527 ; CHECK-LABEL: vssub_vi_v2i16_unmasked:
529 ; CHECK-NEXT: li a1, -1
530 ; CHECK-NEXT: vsetvli zero, a0, e16, mf4, ta, ma
531 ; CHECK-NEXT: vssub.vx v8, v8, a1
533 %v = call <2 x i16> @llvm.vp.ssub.sat.v2i16(<2 x i16> %va, <2 x i16> splat (i16 -1), <2 x i1> splat (i1 true), i32 %evl)
537 declare <4 x i16> @llvm.vp.ssub.sat.v4i16(<4 x i16>, <4 x i16>, <4 x i1>, i32)
539 define <4 x i16> @vssub_vv_v4i16(<4 x i16> %va, <4 x i16> %b, <4 x i1> %m, i32 zeroext %evl) {
540 ; CHECK-LABEL: vssub_vv_v4i16:
542 ; CHECK-NEXT: vsetvli zero, a0, e16, mf2, ta, ma
543 ; CHECK-NEXT: vssub.vv v8, v8, v9, v0.t
545 %v = call <4 x i16> @llvm.vp.ssub.sat.v4i16(<4 x i16> %va, <4 x i16> %b, <4 x i1> %m, i32 %evl)
549 define <4 x i16> @vssub_vv_v4i16_unmasked(<4 x i16> %va, <4 x i16> %b, i32 zeroext %evl) {
550 ; CHECK-LABEL: vssub_vv_v4i16_unmasked:
552 ; CHECK-NEXT: vsetvli zero, a0, e16, mf2, ta, ma
553 ; CHECK-NEXT: vssub.vv v8, v8, v9
555 %v = call <4 x i16> @llvm.vp.ssub.sat.v4i16(<4 x i16> %va, <4 x i16> %b, <4 x i1> splat (i1 true), i32 %evl)
559 define <4 x i16> @vssub_vx_v4i16(<4 x i16> %va, i16 %b, <4 x i1> %m, i32 zeroext %evl) {
560 ; CHECK-LABEL: vssub_vx_v4i16:
562 ; CHECK-NEXT: vsetvli zero, a1, e16, mf2, ta, ma
563 ; CHECK-NEXT: vssub.vx v8, v8, a0, v0.t
565 %elt.head = insertelement <4 x i16> poison, i16 %b, i32 0
566 %vb = shufflevector <4 x i16> %elt.head, <4 x i16> poison, <4 x i32> zeroinitializer
567 %v = call <4 x i16> @llvm.vp.ssub.sat.v4i16(<4 x i16> %va, <4 x i16> %vb, <4 x i1> %m, i32 %evl)
571 define <4 x i16> @vssub_vx_v4i16_unmasked(<4 x i16> %va, i16 %b, i32 zeroext %evl) {
572 ; CHECK-LABEL: vssub_vx_v4i16_unmasked:
574 ; CHECK-NEXT: vsetvli zero, a1, e16, mf2, ta, ma
575 ; CHECK-NEXT: vssub.vx v8, v8, a0
577 %elt.head = insertelement <4 x i16> poison, i16 %b, i32 0
578 %vb = shufflevector <4 x i16> %elt.head, <4 x i16> poison, <4 x i32> zeroinitializer
579 %v = call <4 x i16> @llvm.vp.ssub.sat.v4i16(<4 x i16> %va, <4 x i16> %vb, <4 x i1> splat (i1 true), i32 %evl)
583 define <4 x i16> @vssub_vi_v4i16(<4 x i16> %va, <4 x i1> %m, i32 zeroext %evl) {
584 ; CHECK-LABEL: vssub_vi_v4i16:
586 ; CHECK-NEXT: li a1, -1
587 ; CHECK-NEXT: vsetvli zero, a0, e16, mf2, ta, ma
588 ; CHECK-NEXT: vssub.vx v8, v8, a1, v0.t
590 %v = call <4 x i16> @llvm.vp.ssub.sat.v4i16(<4 x i16> %va, <4 x i16> splat (i16 -1), <4 x i1> %m, i32 %evl)
594 define <4 x i16> @vssub_vi_v4i16_unmasked(<4 x i16> %va, i32 zeroext %evl) {
595 ; CHECK-LABEL: vssub_vi_v4i16_unmasked:
597 ; CHECK-NEXT: li a1, -1
598 ; CHECK-NEXT: vsetvli zero, a0, e16, mf2, ta, ma
599 ; CHECK-NEXT: vssub.vx v8, v8, a1
601 %v = call <4 x i16> @llvm.vp.ssub.sat.v4i16(<4 x i16> %va, <4 x i16> splat (i16 -1), <4 x i1> splat (i1 true), i32 %evl)
605 declare <8 x i16> @llvm.vp.ssub.sat.v8i16(<8 x i16>, <8 x i16>, <8 x i1>, i32)
607 define <8 x i16> @vssub_vv_v8i16(<8 x i16> %va, <8 x i16> %b, <8 x i1> %m, i32 zeroext %evl) {
608 ; CHECK-LABEL: vssub_vv_v8i16:
610 ; CHECK-NEXT: vsetvli zero, a0, e16, m1, ta, ma
611 ; CHECK-NEXT: vssub.vv v8, v8, v9, v0.t
613 %v = call <8 x i16> @llvm.vp.ssub.sat.v8i16(<8 x i16> %va, <8 x i16> %b, <8 x i1> %m, i32 %evl)
617 define <8 x i16> @vssub_vv_v8i16_unmasked(<8 x i16> %va, <8 x i16> %b, i32 zeroext %evl) {
618 ; CHECK-LABEL: vssub_vv_v8i16_unmasked:
620 ; CHECK-NEXT: vsetvli zero, a0, e16, m1, ta, ma
621 ; CHECK-NEXT: vssub.vv v8, v8, v9
623 %v = call <8 x i16> @llvm.vp.ssub.sat.v8i16(<8 x i16> %va, <8 x i16> %b, <8 x i1> splat (i1 true), i32 %evl)
627 define <8 x i16> @vssub_vx_v8i16(<8 x i16> %va, i16 %b, <8 x i1> %m, i32 zeroext %evl) {
628 ; CHECK-LABEL: vssub_vx_v8i16:
630 ; CHECK-NEXT: vsetvli zero, a1, e16, m1, ta, ma
631 ; CHECK-NEXT: vssub.vx v8, v8, a0, v0.t
633 %elt.head = insertelement <8 x i16> poison, i16 %b, i32 0
634 %vb = shufflevector <8 x i16> %elt.head, <8 x i16> poison, <8 x i32> zeroinitializer
635 %v = call <8 x i16> @llvm.vp.ssub.sat.v8i16(<8 x i16> %va, <8 x i16> %vb, <8 x i1> %m, i32 %evl)
639 define <8 x i16> @vssub_vx_v8i16_unmasked(<8 x i16> %va, i16 %b, i32 zeroext %evl) {
640 ; CHECK-LABEL: vssub_vx_v8i16_unmasked:
642 ; CHECK-NEXT: vsetvli zero, a1, e16, m1, ta, ma
643 ; CHECK-NEXT: vssub.vx v8, v8, a0
645 %elt.head = insertelement <8 x i16> poison, i16 %b, i32 0
646 %vb = shufflevector <8 x i16> %elt.head, <8 x i16> poison, <8 x i32> zeroinitializer
647 %v = call <8 x i16> @llvm.vp.ssub.sat.v8i16(<8 x i16> %va, <8 x i16> %vb, <8 x i1> splat (i1 true), i32 %evl)
651 define <8 x i16> @vssub_vi_v8i16(<8 x i16> %va, <8 x i1> %m, i32 zeroext %evl) {
652 ; CHECK-LABEL: vssub_vi_v8i16:
654 ; CHECK-NEXT: li a1, -1
655 ; CHECK-NEXT: vsetvli zero, a0, e16, m1, ta, ma
656 ; CHECK-NEXT: vssub.vx v8, v8, a1, v0.t
658 %v = call <8 x i16> @llvm.vp.ssub.sat.v8i16(<8 x i16> %va, <8 x i16> splat (i16 -1), <8 x i1> %m, i32 %evl)
662 define <8 x i16> @vssub_vi_v8i16_unmasked(<8 x i16> %va, i32 zeroext %evl) {
663 ; CHECK-LABEL: vssub_vi_v8i16_unmasked:
665 ; CHECK-NEXT: li a1, -1
666 ; CHECK-NEXT: vsetvli zero, a0, e16, m1, ta, ma
667 ; CHECK-NEXT: vssub.vx v8, v8, a1
669 %v = call <8 x i16> @llvm.vp.ssub.sat.v8i16(<8 x i16> %va, <8 x i16> splat (i16 -1), <8 x i1> splat (i1 true), i32 %evl)
673 declare <16 x i16> @llvm.vp.ssub.sat.v16i16(<16 x i16>, <16 x i16>, <16 x i1>, i32)
675 define <16 x i16> @vssub_vv_v16i16(<16 x i16> %va, <16 x i16> %b, <16 x i1> %m, i32 zeroext %evl) {
676 ; CHECK-LABEL: vssub_vv_v16i16:
678 ; CHECK-NEXT: vsetvli zero, a0, e16, m2, ta, ma
679 ; CHECK-NEXT: vssub.vv v8, v8, v10, v0.t
681 %v = call <16 x i16> @llvm.vp.ssub.sat.v16i16(<16 x i16> %va, <16 x i16> %b, <16 x i1> %m, i32 %evl)
685 define <16 x i16> @vssub_vv_v16i16_unmasked(<16 x i16> %va, <16 x i16> %b, i32 zeroext %evl) {
686 ; CHECK-LABEL: vssub_vv_v16i16_unmasked:
688 ; CHECK-NEXT: vsetvli zero, a0, e16, m2, ta, ma
689 ; CHECK-NEXT: vssub.vv v8, v8, v10
691 %v = call <16 x i16> @llvm.vp.ssub.sat.v16i16(<16 x i16> %va, <16 x i16> %b, <16 x i1> splat (i1 true), i32 %evl)
695 define <16 x i16> @vssub_vx_v16i16(<16 x i16> %va, i16 %b, <16 x i1> %m, i32 zeroext %evl) {
696 ; CHECK-LABEL: vssub_vx_v16i16:
698 ; CHECK-NEXT: vsetvli zero, a1, e16, m2, ta, ma
699 ; CHECK-NEXT: vssub.vx v8, v8, a0, v0.t
701 %elt.head = insertelement <16 x i16> poison, i16 %b, i32 0
702 %vb = shufflevector <16 x i16> %elt.head, <16 x i16> poison, <16 x i32> zeroinitializer
703 %v = call <16 x i16> @llvm.vp.ssub.sat.v16i16(<16 x i16> %va, <16 x i16> %vb, <16 x i1> %m, i32 %evl)
707 define <16 x i16> @vssub_vx_v16i16_unmasked(<16 x i16> %va, i16 %b, i32 zeroext %evl) {
708 ; CHECK-LABEL: vssub_vx_v16i16_unmasked:
710 ; CHECK-NEXT: vsetvli zero, a1, e16, m2, ta, ma
711 ; CHECK-NEXT: vssub.vx v8, v8, a0
713 %elt.head = insertelement <16 x i16> poison, i16 %b, i32 0
714 %vb = shufflevector <16 x i16> %elt.head, <16 x i16> poison, <16 x i32> zeroinitializer
715 %v = call <16 x i16> @llvm.vp.ssub.sat.v16i16(<16 x i16> %va, <16 x i16> %vb, <16 x i1> splat (i1 true), i32 %evl)
719 define <16 x i16> @vssub_vi_v16i16(<16 x i16> %va, <16 x i1> %m, i32 zeroext %evl) {
720 ; CHECK-LABEL: vssub_vi_v16i16:
722 ; CHECK-NEXT: li a1, -1
723 ; CHECK-NEXT: vsetvli zero, a0, e16, m2, ta, ma
724 ; CHECK-NEXT: vssub.vx v8, v8, a1, v0.t
726 %v = call <16 x i16> @llvm.vp.ssub.sat.v16i16(<16 x i16> %va, <16 x i16> splat (i16 -1), <16 x i1> %m, i32 %evl)
730 define <16 x i16> @vssub_vi_v16i16_unmasked(<16 x i16> %va, i32 zeroext %evl) {
731 ; CHECK-LABEL: vssub_vi_v16i16_unmasked:
733 ; CHECK-NEXT: li a1, -1
734 ; CHECK-NEXT: vsetvli zero, a0, e16, m2, ta, ma
735 ; CHECK-NEXT: vssub.vx v8, v8, a1
737 %v = call <16 x i16> @llvm.vp.ssub.sat.v16i16(<16 x i16> %va, <16 x i16> splat (i16 -1), <16 x i1> splat (i1 true), i32 %evl)
741 declare <2 x i32> @llvm.vp.ssub.sat.v2i32(<2 x i32>, <2 x i32>, <2 x i1>, i32)
743 define <2 x i32> @vssub_vv_v2i32(<2 x i32> %va, <2 x i32> %b, <2 x i1> %m, i32 zeroext %evl) {
744 ; CHECK-LABEL: vssub_vv_v2i32:
746 ; CHECK-NEXT: vsetvli zero, a0, e32, mf2, ta, ma
747 ; CHECK-NEXT: vssub.vv v8, v8, v9, v0.t
749 %v = call <2 x i32> @llvm.vp.ssub.sat.v2i32(<2 x i32> %va, <2 x i32> %b, <2 x i1> %m, i32 %evl)
753 define <2 x i32> @vssub_vv_v2i32_unmasked(<2 x i32> %va, <2 x i32> %b, i32 zeroext %evl) {
754 ; CHECK-LABEL: vssub_vv_v2i32_unmasked:
756 ; CHECK-NEXT: vsetvli zero, a0, e32, mf2, ta, ma
757 ; CHECK-NEXT: vssub.vv v8, v8, v9
759 %v = call <2 x i32> @llvm.vp.ssub.sat.v2i32(<2 x i32> %va, <2 x i32> %b, <2 x i1> splat (i1 true), i32 %evl)
763 define <2 x i32> @vssub_vx_v2i32(<2 x i32> %va, i32 %b, <2 x i1> %m, i32 zeroext %evl) {
764 ; CHECK-LABEL: vssub_vx_v2i32:
766 ; CHECK-NEXT: vsetvli zero, a1, e32, mf2, ta, ma
767 ; CHECK-NEXT: vssub.vx v8, v8, a0, v0.t
769 %elt.head = insertelement <2 x i32> poison, i32 %b, i32 0
770 %vb = shufflevector <2 x i32> %elt.head, <2 x i32> poison, <2 x i32> zeroinitializer
771 %v = call <2 x i32> @llvm.vp.ssub.sat.v2i32(<2 x i32> %va, <2 x i32> %vb, <2 x i1> %m, i32 %evl)
775 define <2 x i32> @vssub_vx_v2i32_unmasked(<2 x i32> %va, i32 %b, i32 zeroext %evl) {
776 ; CHECK-LABEL: vssub_vx_v2i32_unmasked:
778 ; CHECK-NEXT: vsetvli zero, a1, e32, mf2, ta, ma
779 ; CHECK-NEXT: vssub.vx v8, v8, a0
781 %elt.head = insertelement <2 x i32> poison, i32 %b, i32 0
782 %vb = shufflevector <2 x i32> %elt.head, <2 x i32> poison, <2 x i32> zeroinitializer
783 %v = call <2 x i32> @llvm.vp.ssub.sat.v2i32(<2 x i32> %va, <2 x i32> %vb, <2 x i1> splat (i1 true), i32 %evl)
787 define <2 x i32> @vssub_vi_v2i32(<2 x i32> %va, <2 x i1> %m, i32 zeroext %evl) {
788 ; CHECK-LABEL: vssub_vi_v2i32:
790 ; CHECK-NEXT: li a1, -1
791 ; CHECK-NEXT: vsetvli zero, a0, e32, mf2, ta, ma
792 ; CHECK-NEXT: vssub.vx v8, v8, a1, v0.t
794 %v = call <2 x i32> @llvm.vp.ssub.sat.v2i32(<2 x i32> %va, <2 x i32> splat (i32 -1), <2 x i1> %m, i32 %evl)
798 define <2 x i32> @vssub_vi_v2i32_unmasked(<2 x i32> %va, i32 zeroext %evl) {
799 ; CHECK-LABEL: vssub_vi_v2i32_unmasked:
801 ; CHECK-NEXT: li a1, -1
802 ; CHECK-NEXT: vsetvli zero, a0, e32, mf2, ta, ma
803 ; CHECK-NEXT: vssub.vx v8, v8, a1
805 %v = call <2 x i32> @llvm.vp.ssub.sat.v2i32(<2 x i32> %va, <2 x i32> splat (i32 -1), <2 x i1> splat (i1 true), i32 %evl)
809 declare <4 x i32> @llvm.vp.ssub.sat.v4i32(<4 x i32>, <4 x i32>, <4 x i1>, i32)
811 define <4 x i32> @vssub_vv_v4i32(<4 x i32> %va, <4 x i32> %b, <4 x i1> %m, i32 zeroext %evl) {
812 ; CHECK-LABEL: vssub_vv_v4i32:
814 ; CHECK-NEXT: vsetvli zero, a0, e32, m1, ta, ma
815 ; CHECK-NEXT: vssub.vv v8, v8, v9, v0.t
817 %v = call <4 x i32> @llvm.vp.ssub.sat.v4i32(<4 x i32> %va, <4 x i32> %b, <4 x i1> %m, i32 %evl)
821 define <4 x i32> @vssub_vv_v4i32_unmasked(<4 x i32> %va, <4 x i32> %b, i32 zeroext %evl) {
822 ; CHECK-LABEL: vssub_vv_v4i32_unmasked:
824 ; CHECK-NEXT: vsetvli zero, a0, e32, m1, ta, ma
825 ; CHECK-NEXT: vssub.vv v8, v8, v9
827 %v = call <4 x i32> @llvm.vp.ssub.sat.v4i32(<4 x i32> %va, <4 x i32> %b, <4 x i1> splat (i1 true), i32 %evl)
831 define <4 x i32> @vssub_vx_v4i32(<4 x i32> %va, i32 %b, <4 x i1> %m, i32 zeroext %evl) {
832 ; CHECK-LABEL: vssub_vx_v4i32:
834 ; CHECK-NEXT: vsetvli zero, a1, e32, m1, ta, ma
835 ; CHECK-NEXT: vssub.vx v8, v8, a0, v0.t
837 %elt.head = insertelement <4 x i32> poison, i32 %b, i32 0
838 %vb = shufflevector <4 x i32> %elt.head, <4 x i32> poison, <4 x i32> zeroinitializer
839 %v = call <4 x i32> @llvm.vp.ssub.sat.v4i32(<4 x i32> %va, <4 x i32> %vb, <4 x i1> %m, i32 %evl)
843 define <4 x i32> @vssub_vx_v4i32_unmasked(<4 x i32> %va, i32 %b, i32 zeroext %evl) {
844 ; CHECK-LABEL: vssub_vx_v4i32_unmasked:
846 ; CHECK-NEXT: vsetvli zero, a1, e32, m1, ta, ma
847 ; CHECK-NEXT: vssub.vx v8, v8, a0
849 %elt.head = insertelement <4 x i32> poison, i32 %b, i32 0
850 %vb = shufflevector <4 x i32> %elt.head, <4 x i32> poison, <4 x i32> zeroinitializer
851 %v = call <4 x i32> @llvm.vp.ssub.sat.v4i32(<4 x i32> %va, <4 x i32> %vb, <4 x i1> splat (i1 true), i32 %evl)
855 define <4 x i32> @vssub_vi_v4i32(<4 x i32> %va, <4 x i1> %m, i32 zeroext %evl) {
856 ; CHECK-LABEL: vssub_vi_v4i32:
858 ; CHECK-NEXT: li a1, -1
859 ; CHECK-NEXT: vsetvli zero, a0, e32, m1, ta, ma
860 ; CHECK-NEXT: vssub.vx v8, v8, a1, v0.t
862 %v = call <4 x i32> @llvm.vp.ssub.sat.v4i32(<4 x i32> %va, <4 x i32> splat (i32 -1), <4 x i1> %m, i32 %evl)
866 define <4 x i32> @vssub_vi_v4i32_unmasked(<4 x i32> %va, i32 zeroext %evl) {
867 ; CHECK-LABEL: vssub_vi_v4i32_unmasked:
869 ; CHECK-NEXT: li a1, -1
870 ; CHECK-NEXT: vsetvli zero, a0, e32, m1, ta, ma
871 ; CHECK-NEXT: vssub.vx v8, v8, a1
873 %v = call <4 x i32> @llvm.vp.ssub.sat.v4i32(<4 x i32> %va, <4 x i32> splat (i32 -1), <4 x i1> splat (i1 true), i32 %evl)
877 declare <8 x i32> @llvm.vp.ssub.sat.v8i32(<8 x i32>, <8 x i32>, <8 x i1>, i32)
879 define <8 x i32> @vssub_vv_v8i32(<8 x i32> %va, <8 x i32> %b, <8 x i1> %m, i32 zeroext %evl) {
880 ; CHECK-LABEL: vssub_vv_v8i32:
882 ; CHECK-NEXT: vsetvli zero, a0, e32, m2, ta, ma
883 ; CHECK-NEXT: vssub.vv v8, v8, v10, v0.t
885 %v = call <8 x i32> @llvm.vp.ssub.sat.v8i32(<8 x i32> %va, <8 x i32> %b, <8 x i1> %m, i32 %evl)
889 define <8 x i32> @vssub_vv_v8i32_unmasked(<8 x i32> %va, <8 x i32> %b, i32 zeroext %evl) {
890 ; CHECK-LABEL: vssub_vv_v8i32_unmasked:
892 ; CHECK-NEXT: vsetvli zero, a0, e32, m2, ta, ma
893 ; CHECK-NEXT: vssub.vv v8, v8, v10
895 %v = call <8 x i32> @llvm.vp.ssub.sat.v8i32(<8 x i32> %va, <8 x i32> %b, <8 x i1> splat (i1 true), i32 %evl)
899 define <8 x i32> @vssub_vx_v8i32(<8 x i32> %va, i32 %b, <8 x i1> %m, i32 zeroext %evl) {
900 ; CHECK-LABEL: vssub_vx_v8i32:
902 ; CHECK-NEXT: vsetvli zero, a1, e32, m2, ta, ma
903 ; CHECK-NEXT: vssub.vx v8, v8, a0, v0.t
905 %elt.head = insertelement <8 x i32> poison, i32 %b, i32 0
906 %vb = shufflevector <8 x i32> %elt.head, <8 x i32> poison, <8 x i32> zeroinitializer
907 %v = call <8 x i32> @llvm.vp.ssub.sat.v8i32(<8 x i32> %va, <8 x i32> %vb, <8 x i1> %m, i32 %evl)
911 define <8 x i32> @vssub_vx_v8i32_unmasked(<8 x i32> %va, i32 %b, i32 zeroext %evl) {
912 ; CHECK-LABEL: vssub_vx_v8i32_unmasked:
914 ; CHECK-NEXT: vsetvli zero, a1, e32, m2, ta, ma
915 ; CHECK-NEXT: vssub.vx v8, v8, a0
917 %elt.head = insertelement <8 x i32> poison, i32 %b, i32 0
918 %vb = shufflevector <8 x i32> %elt.head, <8 x i32> poison, <8 x i32> zeroinitializer
919 %v = call <8 x i32> @llvm.vp.ssub.sat.v8i32(<8 x i32> %va, <8 x i32> %vb, <8 x i1> splat (i1 true), i32 %evl)
923 define <8 x i32> @vssub_vi_v8i32(<8 x i32> %va, <8 x i1> %m, i32 zeroext %evl) {
924 ; CHECK-LABEL: vssub_vi_v8i32:
926 ; CHECK-NEXT: li a1, -1
927 ; CHECK-NEXT: vsetvli zero, a0, e32, m2, ta, ma
928 ; CHECK-NEXT: vssub.vx v8, v8, a1, v0.t
930 %v = call <8 x i32> @llvm.vp.ssub.sat.v8i32(<8 x i32> %va, <8 x i32> splat (i32 -1), <8 x i1> %m, i32 %evl)
934 define <8 x i32> @vssub_vi_v8i32_unmasked(<8 x i32> %va, i32 zeroext %evl) {
935 ; CHECK-LABEL: vssub_vi_v8i32_unmasked:
937 ; CHECK-NEXT: li a1, -1
938 ; CHECK-NEXT: vsetvli zero, a0, e32, m2, ta, ma
939 ; CHECK-NEXT: vssub.vx v8, v8, a1
941 %v = call <8 x i32> @llvm.vp.ssub.sat.v8i32(<8 x i32> %va, <8 x i32> splat (i32 -1), <8 x i1> splat (i1 true), i32 %evl)
945 declare <16 x i32> @llvm.vp.ssub.sat.v16i32(<16 x i32>, <16 x i32>, <16 x i1>, i32)
947 define <16 x i32> @vssub_vv_v16i32(<16 x i32> %va, <16 x i32> %b, <16 x i1> %m, i32 zeroext %evl) {
948 ; CHECK-LABEL: vssub_vv_v16i32:
950 ; CHECK-NEXT: vsetvli zero, a0, e32, m4, ta, ma
951 ; CHECK-NEXT: vssub.vv v8, v8, v12, v0.t
953 %v = call <16 x i32> @llvm.vp.ssub.sat.v16i32(<16 x i32> %va, <16 x i32> %b, <16 x i1> %m, i32 %evl)
957 define <16 x i32> @vssub_vv_v16i32_unmasked(<16 x i32> %va, <16 x i32> %b, i32 zeroext %evl) {
958 ; CHECK-LABEL: vssub_vv_v16i32_unmasked:
960 ; CHECK-NEXT: vsetvli zero, a0, e32, m4, ta, ma
961 ; CHECK-NEXT: vssub.vv v8, v8, v12
963 %v = call <16 x i32> @llvm.vp.ssub.sat.v16i32(<16 x i32> %va, <16 x i32> %b, <16 x i1> splat (i1 true), i32 %evl)
967 define <16 x i32> @vssub_vx_v16i32(<16 x i32> %va, i32 %b, <16 x i1> %m, i32 zeroext %evl) {
968 ; CHECK-LABEL: vssub_vx_v16i32:
970 ; CHECK-NEXT: vsetvli zero, a1, e32, m4, ta, ma
971 ; CHECK-NEXT: vssub.vx v8, v8, a0, v0.t
973 %elt.head = insertelement <16 x i32> poison, i32 %b, i32 0
974 %vb = shufflevector <16 x i32> %elt.head, <16 x i32> poison, <16 x i32> zeroinitializer
975 %v = call <16 x i32> @llvm.vp.ssub.sat.v16i32(<16 x i32> %va, <16 x i32> %vb, <16 x i1> %m, i32 %evl)
979 define <16 x i32> @vssub_vx_v16i32_unmasked(<16 x i32> %va, i32 %b, i32 zeroext %evl) {
980 ; CHECK-LABEL: vssub_vx_v16i32_unmasked:
982 ; CHECK-NEXT: vsetvli zero, a1, e32, m4, ta, ma
983 ; CHECK-NEXT: vssub.vx v8, v8, a0
985 %elt.head = insertelement <16 x i32> poison, i32 %b, i32 0
986 %vb = shufflevector <16 x i32> %elt.head, <16 x i32> poison, <16 x i32> zeroinitializer
987 %v = call <16 x i32> @llvm.vp.ssub.sat.v16i32(<16 x i32> %va, <16 x i32> %vb, <16 x i1> splat (i1 true), i32 %evl)
991 define <16 x i32> @vssub_vi_v16i32(<16 x i32> %va, <16 x i1> %m, i32 zeroext %evl) {
992 ; CHECK-LABEL: vssub_vi_v16i32:
994 ; CHECK-NEXT: li a1, -1
995 ; CHECK-NEXT: vsetvli zero, a0, e32, m4, ta, ma
996 ; CHECK-NEXT: vssub.vx v8, v8, a1, v0.t
998 %v = call <16 x i32> @llvm.vp.ssub.sat.v16i32(<16 x i32> %va, <16 x i32> splat (i32 -1), <16 x i1> %m, i32 %evl)
1002 define <16 x i32> @vssub_vi_v16i32_unmasked(<16 x i32> %va, i32 zeroext %evl) {
1003 ; CHECK-LABEL: vssub_vi_v16i32_unmasked:
1005 ; CHECK-NEXT: li a1, -1
1006 ; CHECK-NEXT: vsetvli zero, a0, e32, m4, ta, ma
1007 ; CHECK-NEXT: vssub.vx v8, v8, a1
1009 %v = call <16 x i32> @llvm.vp.ssub.sat.v16i32(<16 x i32> %va, <16 x i32> splat (i32 -1), <16 x i1> splat (i1 true), i32 %evl)
1013 declare <2 x i64> @llvm.vp.ssub.sat.v2i64(<2 x i64>, <2 x i64>, <2 x i1>, i32)
1015 define <2 x i64> @vssub_vv_v2i64(<2 x i64> %va, <2 x i64> %b, <2 x i1> %m, i32 zeroext %evl) {
1016 ; CHECK-LABEL: vssub_vv_v2i64:
1018 ; CHECK-NEXT: vsetvli zero, a0, e64, m1, ta, ma
1019 ; CHECK-NEXT: vssub.vv v8, v8, v9, v0.t
1021 %v = call <2 x i64> @llvm.vp.ssub.sat.v2i64(<2 x i64> %va, <2 x i64> %b, <2 x i1> %m, i32 %evl)
1025 define <2 x i64> @vssub_vv_v2i64_unmasked(<2 x i64> %va, <2 x i64> %b, i32 zeroext %evl) {
1026 ; CHECK-LABEL: vssub_vv_v2i64_unmasked:
1028 ; CHECK-NEXT: vsetvli zero, a0, e64, m1, ta, ma
1029 ; CHECK-NEXT: vssub.vv v8, v8, v9
1031 %v = call <2 x i64> @llvm.vp.ssub.sat.v2i64(<2 x i64> %va, <2 x i64> %b, <2 x i1> splat (i1 true), i32 %evl)
1035 define <2 x i64> @vssub_vx_v2i64(<2 x i64> %va, i64 %b, <2 x i1> %m, i32 zeroext %evl) {
1036 ; RV32-LABEL: vssub_vx_v2i64:
1038 ; RV32-NEXT: addi sp, sp, -16
1039 ; RV32-NEXT: .cfi_def_cfa_offset 16
1040 ; RV32-NEXT: sw a1, 12(sp)
1041 ; RV32-NEXT: sw a0, 8(sp)
1042 ; RV32-NEXT: addi a0, sp, 8
1043 ; RV32-NEXT: vsetivli zero, 2, e64, m1, ta, ma
1044 ; RV32-NEXT: vlse64.v v9, (a0), zero
1045 ; RV32-NEXT: vsetvli zero, a2, e64, m1, ta, ma
1046 ; RV32-NEXT: vssub.vv v8, v8, v9, v0.t
1047 ; RV32-NEXT: addi sp, sp, 16
1050 ; RV64-LABEL: vssub_vx_v2i64:
1052 ; RV64-NEXT: vsetvli zero, a1, e64, m1, ta, ma
1053 ; RV64-NEXT: vssub.vx v8, v8, a0, v0.t
1055 %elt.head = insertelement <2 x i64> poison, i64 %b, i32 0
1056 %vb = shufflevector <2 x i64> %elt.head, <2 x i64> poison, <2 x i32> zeroinitializer
1057 %v = call <2 x i64> @llvm.vp.ssub.sat.v2i64(<2 x i64> %va, <2 x i64> %vb, <2 x i1> %m, i32 %evl)
1061 define <2 x i64> @vssub_vx_v2i64_unmasked(<2 x i64> %va, i64 %b, i32 zeroext %evl) {
1062 ; RV32-LABEL: vssub_vx_v2i64_unmasked:
1064 ; RV32-NEXT: addi sp, sp, -16
1065 ; RV32-NEXT: .cfi_def_cfa_offset 16
1066 ; RV32-NEXT: sw a1, 12(sp)
1067 ; RV32-NEXT: sw a0, 8(sp)
1068 ; RV32-NEXT: addi a0, sp, 8
1069 ; RV32-NEXT: vsetivli zero, 2, e64, m1, ta, ma
1070 ; RV32-NEXT: vlse64.v v9, (a0), zero
1071 ; RV32-NEXT: vsetvli zero, a2, e64, m1, ta, ma
1072 ; RV32-NEXT: vssub.vv v8, v8, v9
1073 ; RV32-NEXT: addi sp, sp, 16
1076 ; RV64-LABEL: vssub_vx_v2i64_unmasked:
1078 ; RV64-NEXT: vsetvli zero, a1, e64, m1, ta, ma
1079 ; RV64-NEXT: vssub.vx v8, v8, a0
1081 %elt.head = insertelement <2 x i64> poison, i64 %b, i32 0
1082 %vb = shufflevector <2 x i64> %elt.head, <2 x i64> poison, <2 x i32> zeroinitializer
1083 %v = call <2 x i64> @llvm.vp.ssub.sat.v2i64(<2 x i64> %va, <2 x i64> %vb, <2 x i1> splat (i1 true), i32 %evl)
1087 define <2 x i64> @vssub_vi_v2i64(<2 x i64> %va, <2 x i1> %m, i32 zeroext %evl) {
1088 ; CHECK-LABEL: vssub_vi_v2i64:
1090 ; CHECK-NEXT: li a1, -1
1091 ; CHECK-NEXT: vsetvli zero, a0, e64, m1, ta, ma
1092 ; CHECK-NEXT: vssub.vx v8, v8, a1, v0.t
1094 %v = call <2 x i64> @llvm.vp.ssub.sat.v2i64(<2 x i64> %va, <2 x i64> splat (i64 -1), <2 x i1> %m, i32 %evl)
1098 define <2 x i64> @vssub_vi_v2i64_unmasked(<2 x i64> %va, i32 zeroext %evl) {
1099 ; CHECK-LABEL: vssub_vi_v2i64_unmasked:
1101 ; CHECK-NEXT: li a1, -1
1102 ; CHECK-NEXT: vsetvli zero, a0, e64, m1, ta, ma
1103 ; CHECK-NEXT: vssub.vx v8, v8, a1
1105 %v = call <2 x i64> @llvm.vp.ssub.sat.v2i64(<2 x i64> %va, <2 x i64> splat (i64 -1), <2 x i1> splat (i1 true), i32 %evl)
1109 declare <4 x i64> @llvm.vp.ssub.sat.v4i64(<4 x i64>, <4 x i64>, <4 x i1>, i32)
1111 define <4 x i64> @vssub_vv_v4i64(<4 x i64> %va, <4 x i64> %b, <4 x i1> %m, i32 zeroext %evl) {
1112 ; CHECK-LABEL: vssub_vv_v4i64:
1114 ; CHECK-NEXT: vsetvli zero, a0, e64, m2, ta, ma
1115 ; CHECK-NEXT: vssub.vv v8, v8, v10, v0.t
1117 %v = call <4 x i64> @llvm.vp.ssub.sat.v4i64(<4 x i64> %va, <4 x i64> %b, <4 x i1> %m, i32 %evl)
1121 define <4 x i64> @vssub_vv_v4i64_unmasked(<4 x i64> %va, <4 x i64> %b, i32 zeroext %evl) {
1122 ; CHECK-LABEL: vssub_vv_v4i64_unmasked:
1124 ; CHECK-NEXT: vsetvli zero, a0, e64, m2, ta, ma
1125 ; CHECK-NEXT: vssub.vv v8, v8, v10
1127 %v = call <4 x i64> @llvm.vp.ssub.sat.v4i64(<4 x i64> %va, <4 x i64> %b, <4 x i1> splat (i1 true), i32 %evl)
1131 define <4 x i64> @vssub_vx_v4i64(<4 x i64> %va, i64 %b, <4 x i1> %m, i32 zeroext %evl) {
1132 ; RV32-LABEL: vssub_vx_v4i64:
1134 ; RV32-NEXT: addi sp, sp, -16
1135 ; RV32-NEXT: .cfi_def_cfa_offset 16
1136 ; RV32-NEXT: sw a1, 12(sp)
1137 ; RV32-NEXT: sw a0, 8(sp)
1138 ; RV32-NEXT: addi a0, sp, 8
1139 ; RV32-NEXT: vsetivli zero, 4, e64, m2, ta, ma
1140 ; RV32-NEXT: vlse64.v v10, (a0), zero
1141 ; RV32-NEXT: vsetvli zero, a2, e64, m2, ta, ma
1142 ; RV32-NEXT: vssub.vv v8, v8, v10, v0.t
1143 ; RV32-NEXT: addi sp, sp, 16
1146 ; RV64-LABEL: vssub_vx_v4i64:
1148 ; RV64-NEXT: vsetvli zero, a1, e64, m2, ta, ma
1149 ; RV64-NEXT: vssub.vx v8, v8, a0, v0.t
1151 %elt.head = insertelement <4 x i64> poison, i64 %b, i32 0
1152 %vb = shufflevector <4 x i64> %elt.head, <4 x i64> poison, <4 x i32> zeroinitializer
1153 %v = call <4 x i64> @llvm.vp.ssub.sat.v4i64(<4 x i64> %va, <4 x i64> %vb, <4 x i1> %m, i32 %evl)
1157 define <4 x i64> @vssub_vx_v4i64_unmasked(<4 x i64> %va, i64 %b, i32 zeroext %evl) {
1158 ; RV32-LABEL: vssub_vx_v4i64_unmasked:
1160 ; RV32-NEXT: addi sp, sp, -16
1161 ; RV32-NEXT: .cfi_def_cfa_offset 16
1162 ; RV32-NEXT: sw a1, 12(sp)
1163 ; RV32-NEXT: sw a0, 8(sp)
1164 ; RV32-NEXT: addi a0, sp, 8
1165 ; RV32-NEXT: vsetivli zero, 4, e64, m2, ta, ma
1166 ; RV32-NEXT: vlse64.v v10, (a0), zero
1167 ; RV32-NEXT: vsetvli zero, a2, e64, m2, ta, ma
1168 ; RV32-NEXT: vssub.vv v8, v8, v10
1169 ; RV32-NEXT: addi sp, sp, 16
1172 ; RV64-LABEL: vssub_vx_v4i64_unmasked:
1174 ; RV64-NEXT: vsetvli zero, a1, e64, m2, ta, ma
1175 ; RV64-NEXT: vssub.vx v8, v8, a0
1177 %elt.head = insertelement <4 x i64> poison, i64 %b, i32 0
1178 %vb = shufflevector <4 x i64> %elt.head, <4 x i64> poison, <4 x i32> zeroinitializer
1179 %v = call <4 x i64> @llvm.vp.ssub.sat.v4i64(<4 x i64> %va, <4 x i64> %vb, <4 x i1> splat (i1 true), i32 %evl)
1183 define <4 x i64> @vssub_vi_v4i64(<4 x i64> %va, <4 x i1> %m, i32 zeroext %evl) {
1184 ; CHECK-LABEL: vssub_vi_v4i64:
1186 ; CHECK-NEXT: li a1, -1
1187 ; CHECK-NEXT: vsetvli zero, a0, e64, m2, ta, ma
1188 ; CHECK-NEXT: vssub.vx v8, v8, a1, v0.t
1190 %v = call <4 x i64> @llvm.vp.ssub.sat.v4i64(<4 x i64> %va, <4 x i64> splat (i64 -1), <4 x i1> %m, i32 %evl)
1194 define <4 x i64> @vssub_vi_v4i64_unmasked(<4 x i64> %va, i32 zeroext %evl) {
1195 ; CHECK-LABEL: vssub_vi_v4i64_unmasked:
1197 ; CHECK-NEXT: li a1, -1
1198 ; CHECK-NEXT: vsetvli zero, a0, e64, m2, ta, ma
1199 ; CHECK-NEXT: vssub.vx v8, v8, a1
1201 %v = call <4 x i64> @llvm.vp.ssub.sat.v4i64(<4 x i64> %va, <4 x i64> splat (i64 -1), <4 x i1> splat (i1 true), i32 %evl)
1205 declare <8 x i64> @llvm.vp.ssub.sat.v8i64(<8 x i64>, <8 x i64>, <8 x i1>, i32)
1207 define <8 x i64> @vssub_vv_v8i64(<8 x i64> %va, <8 x i64> %b, <8 x i1> %m, i32 zeroext %evl) {
1208 ; CHECK-LABEL: vssub_vv_v8i64:
1210 ; CHECK-NEXT: vsetvli zero, a0, e64, m4, ta, ma
1211 ; CHECK-NEXT: vssub.vv v8, v8, v12, v0.t
1213 %v = call <8 x i64> @llvm.vp.ssub.sat.v8i64(<8 x i64> %va, <8 x i64> %b, <8 x i1> %m, i32 %evl)
1217 define <8 x i64> @vssub_vv_v8i64_unmasked(<8 x i64> %va, <8 x i64> %b, i32 zeroext %evl) {
1218 ; CHECK-LABEL: vssub_vv_v8i64_unmasked:
1220 ; CHECK-NEXT: vsetvli zero, a0, e64, m4, ta, ma
1221 ; CHECK-NEXT: vssub.vv v8, v8, v12
1223 %v = call <8 x i64> @llvm.vp.ssub.sat.v8i64(<8 x i64> %va, <8 x i64> %b, <8 x i1> splat (i1 true), i32 %evl)
1227 define <8 x i64> @vssub_vx_v8i64(<8 x i64> %va, i64 %b, <8 x i1> %m, i32 zeroext %evl) {
1228 ; RV32-LABEL: vssub_vx_v8i64:
1230 ; RV32-NEXT: addi sp, sp, -16
1231 ; RV32-NEXT: .cfi_def_cfa_offset 16
1232 ; RV32-NEXT: sw a1, 12(sp)
1233 ; RV32-NEXT: sw a0, 8(sp)
1234 ; RV32-NEXT: addi a0, sp, 8
1235 ; RV32-NEXT: vsetivli zero, 8, e64, m4, ta, ma
1236 ; RV32-NEXT: vlse64.v v12, (a0), zero
1237 ; RV32-NEXT: vsetvli zero, a2, e64, m4, ta, ma
1238 ; RV32-NEXT: vssub.vv v8, v8, v12, v0.t
1239 ; RV32-NEXT: addi sp, sp, 16
1242 ; RV64-LABEL: vssub_vx_v8i64:
1244 ; RV64-NEXT: vsetvli zero, a1, e64, m4, ta, ma
1245 ; RV64-NEXT: vssub.vx v8, v8, a0, v0.t
1247 %elt.head = insertelement <8 x i64> poison, i64 %b, i32 0
1248 %vb = shufflevector <8 x i64> %elt.head, <8 x i64> poison, <8 x i32> zeroinitializer
1249 %v = call <8 x i64> @llvm.vp.ssub.sat.v8i64(<8 x i64> %va, <8 x i64> %vb, <8 x i1> %m, i32 %evl)
1253 define <8 x i64> @vssub_vx_v8i64_unmasked(<8 x i64> %va, i64 %b, i32 zeroext %evl) {
1254 ; RV32-LABEL: vssub_vx_v8i64_unmasked:
1256 ; RV32-NEXT: addi sp, sp, -16
1257 ; RV32-NEXT: .cfi_def_cfa_offset 16
1258 ; RV32-NEXT: sw a1, 12(sp)
1259 ; RV32-NEXT: sw a0, 8(sp)
1260 ; RV32-NEXT: addi a0, sp, 8
1261 ; RV32-NEXT: vsetivli zero, 8, e64, m4, ta, ma
1262 ; RV32-NEXT: vlse64.v v12, (a0), zero
1263 ; RV32-NEXT: vsetvli zero, a2, e64, m4, ta, ma
1264 ; RV32-NEXT: vssub.vv v8, v8, v12
1265 ; RV32-NEXT: addi sp, sp, 16
1268 ; RV64-LABEL: vssub_vx_v8i64_unmasked:
1270 ; RV64-NEXT: vsetvli zero, a1, e64, m4, ta, ma
1271 ; RV64-NEXT: vssub.vx v8, v8, a0
1273 %elt.head = insertelement <8 x i64> poison, i64 %b, i32 0
1274 %vb = shufflevector <8 x i64> %elt.head, <8 x i64> poison, <8 x i32> zeroinitializer
1275 %v = call <8 x i64> @llvm.vp.ssub.sat.v8i64(<8 x i64> %va, <8 x i64> %vb, <8 x i1> splat (i1 true), i32 %evl)
1279 define <8 x i64> @vssub_vi_v8i64(<8 x i64> %va, <8 x i1> %m, i32 zeroext %evl) {
1280 ; CHECK-LABEL: vssub_vi_v8i64:
1282 ; CHECK-NEXT: li a1, -1
1283 ; CHECK-NEXT: vsetvli zero, a0, e64, m4, ta, ma
1284 ; CHECK-NEXT: vssub.vx v8, v8, a1, v0.t
1286 %v = call <8 x i64> @llvm.vp.ssub.sat.v8i64(<8 x i64> %va, <8 x i64> splat (i64 -1), <8 x i1> %m, i32 %evl)
1290 define <8 x i64> @vssub_vi_v8i64_unmasked(<8 x i64> %va, i32 zeroext %evl) {
1291 ; CHECK-LABEL: vssub_vi_v8i64_unmasked:
1293 ; CHECK-NEXT: li a1, -1
1294 ; CHECK-NEXT: vsetvli zero, a0, e64, m4, ta, ma
1295 ; CHECK-NEXT: vssub.vx v8, v8, a1
1297 %v = call <8 x i64> @llvm.vp.ssub.sat.v8i64(<8 x i64> %va, <8 x i64> splat (i64 -1), <8 x i1> splat (i1 true), i32 %evl)
1301 declare <16 x i64> @llvm.vp.ssub.sat.v16i64(<16 x i64>, <16 x i64>, <16 x i1>, i32)
1303 define <16 x i64> @vssub_vv_v16i64(<16 x i64> %va, <16 x i64> %b, <16 x i1> %m, i32 zeroext %evl) {
1304 ; CHECK-LABEL: vssub_vv_v16i64:
1306 ; CHECK-NEXT: vsetvli zero, a0, e64, m8, ta, ma
1307 ; CHECK-NEXT: vssub.vv v8, v8, v16, v0.t
1309 %v = call <16 x i64> @llvm.vp.ssub.sat.v16i64(<16 x i64> %va, <16 x i64> %b, <16 x i1> %m, i32 %evl)
1313 define <16 x i64> @vssub_vv_v16i64_unmasked(<16 x i64> %va, <16 x i64> %b, i32 zeroext %evl) {
1314 ; CHECK-LABEL: vssub_vv_v16i64_unmasked:
1316 ; CHECK-NEXT: vsetvli zero, a0, e64, m8, ta, ma
1317 ; CHECK-NEXT: vssub.vv v8, v8, v16
1319 %v = call <16 x i64> @llvm.vp.ssub.sat.v16i64(<16 x i64> %va, <16 x i64> %b, <16 x i1> splat (i1 true), i32 %evl)
1323 define <16 x i64> @vssub_vx_v16i64(<16 x i64> %va, i64 %b, <16 x i1> %m, i32 zeroext %evl) {
1324 ; RV32-LABEL: vssub_vx_v16i64:
1326 ; RV32-NEXT: addi sp, sp, -16
1327 ; RV32-NEXT: .cfi_def_cfa_offset 16
1328 ; RV32-NEXT: sw a1, 12(sp)
1329 ; RV32-NEXT: sw a0, 8(sp)
1330 ; RV32-NEXT: addi a0, sp, 8
1331 ; RV32-NEXT: vsetivli zero, 16, e64, m8, ta, ma
1332 ; RV32-NEXT: vlse64.v v16, (a0), zero
1333 ; RV32-NEXT: vsetvli zero, a2, e64, m8, ta, ma
1334 ; RV32-NEXT: vssub.vv v8, v8, v16, v0.t
1335 ; RV32-NEXT: addi sp, sp, 16
1338 ; RV64-LABEL: vssub_vx_v16i64:
1340 ; RV64-NEXT: vsetvli zero, a1, e64, m8, ta, ma
1341 ; RV64-NEXT: vssub.vx v8, v8, a0, v0.t
1343 %elt.head = insertelement <16 x i64> poison, i64 %b, i32 0
1344 %vb = shufflevector <16 x i64> %elt.head, <16 x i64> poison, <16 x i32> zeroinitializer
1345 %v = call <16 x i64> @llvm.vp.ssub.sat.v16i64(<16 x i64> %va, <16 x i64> %vb, <16 x i1> %m, i32 %evl)
1349 define <16 x i64> @vssub_vx_v16i64_unmasked(<16 x i64> %va, i64 %b, i32 zeroext %evl) {
1350 ; RV32-LABEL: vssub_vx_v16i64_unmasked:
1352 ; RV32-NEXT: addi sp, sp, -16
1353 ; RV32-NEXT: .cfi_def_cfa_offset 16
1354 ; RV32-NEXT: sw a1, 12(sp)
1355 ; RV32-NEXT: sw a0, 8(sp)
1356 ; RV32-NEXT: addi a0, sp, 8
1357 ; RV32-NEXT: vsetivli zero, 16, e64, m8, ta, ma
1358 ; RV32-NEXT: vlse64.v v16, (a0), zero
1359 ; RV32-NEXT: vsetvli zero, a2, e64, m8, ta, ma
1360 ; RV32-NEXT: vssub.vv v8, v8, v16
1361 ; RV32-NEXT: addi sp, sp, 16
1364 ; RV64-LABEL: vssub_vx_v16i64_unmasked:
1366 ; RV64-NEXT: vsetvli zero, a1, e64, m8, ta, ma
1367 ; RV64-NEXT: vssub.vx v8, v8, a0
1369 %elt.head = insertelement <16 x i64> poison, i64 %b, i32 0
1370 %vb = shufflevector <16 x i64> %elt.head, <16 x i64> poison, <16 x i32> zeroinitializer
1371 %v = call <16 x i64> @llvm.vp.ssub.sat.v16i64(<16 x i64> %va, <16 x i64> %vb, <16 x i1> splat (i1 true), i32 %evl)
1375 define <16 x i64> @vssub_vi_v16i64(<16 x i64> %va, <16 x i1> %m, i32 zeroext %evl) {
1376 ; CHECK-LABEL: vssub_vi_v16i64:
1378 ; CHECK-NEXT: li a1, -1
1379 ; CHECK-NEXT: vsetvli zero, a0, e64, m8, ta, ma
1380 ; CHECK-NEXT: vssub.vx v8, v8, a1, v0.t
1382 %v = call <16 x i64> @llvm.vp.ssub.sat.v16i64(<16 x i64> %va, <16 x i64> splat (i64 -1), <16 x i1> %m, i32 %evl)
1386 define <16 x i64> @vssub_vi_v16i64_unmasked(<16 x i64> %va, i32 zeroext %evl) {
1387 ; CHECK-LABEL: vssub_vi_v16i64_unmasked:
1389 ; CHECK-NEXT: li a1, -1
1390 ; CHECK-NEXT: vsetvli zero, a0, e64, m8, ta, ma
1391 ; CHECK-NEXT: vssub.vx v8, v8, a1
1393 %v = call <16 x i64> @llvm.vp.ssub.sat.v16i64(<16 x i64> %va, <16 x i64> splat (i64 -1), <16 x i1> splat (i1 true), i32 %evl)
1397 ; Test that split-legalization works as expected.
1399 declare <32 x i64> @llvm.vp.ssub.sat.v32i64(<32 x i64>, <32 x i64>, <32 x i1>, i32)
1401 define <32 x i64> @vssub_vx_v32i64(<32 x i64> %va, <32 x i1> %m, i32 zeroext %evl) {
1402 ; RV32-LABEL: vssub_vx_v32i64:
1404 ; RV32-NEXT: li a2, 16
1405 ; RV32-NEXT: vsetivli zero, 2, e8, mf4, ta, ma
1406 ; RV32-NEXT: vslidedown.vi v7, v0, 2
1407 ; RV32-NEXT: mv a1, a0
1408 ; RV32-NEXT: bltu a0, a2, .LBB108_2
1409 ; RV32-NEXT: # %bb.1:
1410 ; RV32-NEXT: li a1, 16
1411 ; RV32-NEXT: .LBB108_2:
1412 ; RV32-NEXT: li a2, 32
1413 ; RV32-NEXT: vsetvli zero, a2, e32, m8, ta, ma
1414 ; RV32-NEXT: vmv.v.i v24, -1
1415 ; RV32-NEXT: vsetvli zero, a1, e64, m8, ta, ma
1416 ; RV32-NEXT: vssub.vv v8, v8, v24, v0.t
1417 ; RV32-NEXT: addi a1, a0, -16
1418 ; RV32-NEXT: sltu a0, a0, a1
1419 ; RV32-NEXT: addi a0, a0, -1
1420 ; RV32-NEXT: and a0, a0, a1
1421 ; RV32-NEXT: vmv1r.v v0, v7
1422 ; RV32-NEXT: vsetvli zero, a0, e64, m8, ta, ma
1423 ; RV32-NEXT: vssub.vv v16, v16, v24, v0.t
1426 ; RV64-LABEL: vssub_vx_v32i64:
1428 ; RV64-NEXT: li a2, 16
1429 ; RV64-NEXT: vsetivli zero, 2, e8, mf4, ta, ma
1430 ; RV64-NEXT: vslidedown.vi v24, v0, 2
1431 ; RV64-NEXT: mv a1, a0
1432 ; RV64-NEXT: bltu a0, a2, .LBB108_2
1433 ; RV64-NEXT: # %bb.1:
1434 ; RV64-NEXT: li a1, 16
1435 ; RV64-NEXT: .LBB108_2:
1436 ; RV64-NEXT: li a2, -1
1437 ; RV64-NEXT: vsetvli zero, a1, e64, m8, ta, ma
1438 ; RV64-NEXT: vssub.vx v8, v8, a2, v0.t
1439 ; RV64-NEXT: addi a1, a0, -16
1440 ; RV64-NEXT: sltu a0, a0, a1
1441 ; RV64-NEXT: addi a0, a0, -1
1442 ; RV64-NEXT: and a0, a0, a1
1443 ; RV64-NEXT: vmv1r.v v0, v24
1444 ; RV64-NEXT: vsetvli zero, a0, e64, m8, ta, ma
1445 ; RV64-NEXT: vssub.vx v16, v16, a2, v0.t
1447 %v = call <32 x i64> @llvm.vp.ssub.sat.v32i64(<32 x i64> %va, <32 x i64> splat (i64 -1), <32 x i1> %m, i32 %evl)
1451 define <32 x i64> @vssub_vi_v32i64_unmasked(<32 x i64> %va, i32 zeroext %evl) {
1452 ; RV32-LABEL: vssub_vi_v32i64_unmasked:
1454 ; RV32-NEXT: li a2, 16
1455 ; RV32-NEXT: mv a1, a0
1456 ; RV32-NEXT: bltu a0, a2, .LBB109_2
1457 ; RV32-NEXT: # %bb.1:
1458 ; RV32-NEXT: li a1, 16
1459 ; RV32-NEXT: .LBB109_2:
1460 ; RV32-NEXT: li a2, 32
1461 ; RV32-NEXT: vsetvli zero, a2, e32, m8, ta, ma
1462 ; RV32-NEXT: vmv.v.i v24, -1
1463 ; RV32-NEXT: vsetvli zero, a1, e64, m8, ta, ma
1464 ; RV32-NEXT: vssub.vv v8, v8, v24
1465 ; RV32-NEXT: addi a1, a0, -16
1466 ; RV32-NEXT: sltu a0, a0, a1
1467 ; RV32-NEXT: addi a0, a0, -1
1468 ; RV32-NEXT: and a0, a0, a1
1469 ; RV32-NEXT: vsetvli zero, a0, e64, m8, ta, ma
1470 ; RV32-NEXT: vssub.vv v16, v16, v24
1473 ; RV64-LABEL: vssub_vi_v32i64_unmasked:
1475 ; RV64-NEXT: li a2, 16
1476 ; RV64-NEXT: mv a1, a0
1477 ; RV64-NEXT: bltu a0, a2, .LBB109_2
1478 ; RV64-NEXT: # %bb.1:
1479 ; RV64-NEXT: li a1, 16
1480 ; RV64-NEXT: .LBB109_2:
1481 ; RV64-NEXT: li a2, -1
1482 ; RV64-NEXT: vsetvli zero, a1, e64, m8, ta, ma
1483 ; RV64-NEXT: vssub.vx v8, v8, a2
1484 ; RV64-NEXT: addi a1, a0, -16
1485 ; RV64-NEXT: sltu a0, a0, a1
1486 ; RV64-NEXT: addi a0, a0, -1
1487 ; RV64-NEXT: and a0, a0, a1
1488 ; RV64-NEXT: vsetvli zero, a0, e64, m8, ta, ma
1489 ; RV64-NEXT: vssub.vx v16, v16, a2
1491 %v = call <32 x i64> @llvm.vp.ssub.sat.v32i64(<32 x i64> %va, <32 x i64> splat (i64 -1), <32 x i1> splat (i1 true), i32 %evl)
1495 ; FIXME: We don't match vssub.vi on RV32.
1497 define <32 x i64> @vssub_vx_v32i64_evl12(<32 x i64> %va, <32 x i1> %m) {
1498 ; RV32-LABEL: vssub_vx_v32i64_evl12:
1500 ; RV32-NEXT: vsetivli zero, 2, e8, mf4, ta, ma
1501 ; RV32-NEXT: vslidedown.vi v7, v0, 2
1502 ; RV32-NEXT: li a0, 32
1503 ; RV32-NEXT: vsetvli zero, a0, e32, m8, ta, ma
1504 ; RV32-NEXT: vmv.v.i v24, -1
1505 ; RV32-NEXT: vsetivli zero, 12, e64, m8, ta, ma
1506 ; RV32-NEXT: vssub.vv v8, v8, v24, v0.t
1507 ; RV32-NEXT: vmv1r.v v0, v7
1508 ; RV32-NEXT: vsetivli zero, 0, e64, m8, ta, ma
1509 ; RV32-NEXT: vssub.vv v16, v16, v24, v0.t
1512 ; RV64-LABEL: vssub_vx_v32i64_evl12:
1514 ; RV64-NEXT: vsetivli zero, 2, e8, mf4, ta, ma
1515 ; RV64-NEXT: vslidedown.vi v24, v0, 2
1516 ; RV64-NEXT: li a0, -1
1517 ; RV64-NEXT: vsetivli zero, 12, e64, m8, ta, ma
1518 ; RV64-NEXT: vssub.vx v8, v8, a0, v0.t
1519 ; RV64-NEXT: vmv1r.v v0, v24
1520 ; RV64-NEXT: vsetivli zero, 0, e64, m8, ta, ma
1521 ; RV64-NEXT: vssub.vx v16, v16, a0, v0.t
1523 %v = call <32 x i64> @llvm.vp.ssub.sat.v32i64(<32 x i64> %va, <32 x i64> splat (i64 -1), <32 x i1> %m, i32 12)
1527 define <32 x i64> @vssub_vx_v32i64_evl27(<32 x i64> %va, <32 x i1> %m) {
1528 ; RV32-LABEL: vssub_vx_v32i64_evl27:
1530 ; RV32-NEXT: vsetivli zero, 2, e8, mf4, ta, ma
1531 ; RV32-NEXT: vslidedown.vi v7, v0, 2
1532 ; RV32-NEXT: li a0, 32
1533 ; RV32-NEXT: vsetvli zero, a0, e32, m8, ta, ma
1534 ; RV32-NEXT: vmv.v.i v24, -1
1535 ; RV32-NEXT: vsetivli zero, 16, e64, m8, ta, ma
1536 ; RV32-NEXT: vssub.vv v8, v8, v24, v0.t
1537 ; RV32-NEXT: vmv1r.v v0, v7
1538 ; RV32-NEXT: vsetivli zero, 11, e64, m8, ta, ma
1539 ; RV32-NEXT: vssub.vv v16, v16, v24, v0.t
1542 ; RV64-LABEL: vssub_vx_v32i64_evl27:
1544 ; RV64-NEXT: vsetivli zero, 2, e8, mf4, ta, ma
1545 ; RV64-NEXT: vslidedown.vi v24, v0, 2
1546 ; RV64-NEXT: li a0, -1
1547 ; RV64-NEXT: vsetivli zero, 16, e64, m8, ta, ma
1548 ; RV64-NEXT: vssub.vx v8, v8, a0, v0.t
1549 ; RV64-NEXT: vmv1r.v v0, v24
1550 ; RV64-NEXT: vsetivli zero, 11, e64, m8, ta, ma
1551 ; RV64-NEXT: vssub.vx v16, v16, a0, v0.t
1553 %v = call <32 x i64> @llvm.vp.ssub.sat.v32i64(<32 x i64> %va, <32 x i64> splat (i64 -1), <32 x i1> %m, i32 27)