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.usub.sat.v8i7(<8 x i7>, <8 x i7>, <8 x i1>, i32)
9 define <8 x i7> @vssubu_vv_v8i7(<8 x i7> %va, <8 x i7> %b, <8 x i1> %m, i32 zeroext %evl) {
10 ; CHECK-LABEL: vssubu_vv_v8i7:
12 ; CHECK-NEXT: li a1, 127
13 ; CHECK-NEXT: vsetivli zero, 8, e8, mf2, ta, ma
14 ; CHECK-NEXT: vand.vx v9, v9, a1
15 ; CHECK-NEXT: vand.vx v8, v8, a1
16 ; CHECK-NEXT: vsetvli zero, a0, e8, mf2, ta, ma
17 ; CHECK-NEXT: vssubu.vv v8, v8, v9, v0.t
19 %v = call <8 x i7> @llvm.vp.usub.sat.v8i7(<8 x i7> %va, <8 x i7> %b, <8 x i1> %m, i32 %evl)
23 declare <2 x i8> @llvm.vp.usub.sat.v2i8(<2 x i8>, <2 x i8>, <2 x i1>, i32)
25 define <2 x i8> @vssubu_vv_v2i8(<2 x i8> %va, <2 x i8> %b, <2 x i1> %m, i32 zeroext %evl) {
26 ; CHECK-LABEL: vssubu_vv_v2i8:
28 ; CHECK-NEXT: vsetvli zero, a0, e8, mf8, ta, ma
29 ; CHECK-NEXT: vssubu.vv v8, v8, v9, v0.t
31 %v = call <2 x i8> @llvm.vp.usub.sat.v2i8(<2 x i8> %va, <2 x i8> %b, <2 x i1> %m, i32 %evl)
35 define <2 x i8> @vssubu_vv_v2i8_unmasked(<2 x i8> %va, <2 x i8> %b, i32 zeroext %evl) {
36 ; CHECK-LABEL: vssubu_vv_v2i8_unmasked:
38 ; CHECK-NEXT: vsetvli zero, a0, e8, mf8, ta, ma
39 ; CHECK-NEXT: vssubu.vv v8, v8, v9
41 %v = call <2 x i8> @llvm.vp.usub.sat.v2i8(<2 x i8> %va, <2 x i8> %b, <2 x i1> splat (i1 true), i32 %evl)
45 define <2 x i8> @vssubu_vx_v2i8(<2 x i8> %va, i8 %b, <2 x i1> %m, i32 zeroext %evl) {
46 ; CHECK-LABEL: vssubu_vx_v2i8:
48 ; CHECK-NEXT: vsetvli zero, a1, e8, mf8, ta, ma
49 ; CHECK-NEXT: vssubu.vx v8, v8, a0, v0.t
51 %elt.head = insertelement <2 x i8> poison, i8 %b, i32 0
52 %vb = shufflevector <2 x i8> %elt.head, <2 x i8> poison, <2 x i32> zeroinitializer
53 %v = call <2 x i8> @llvm.vp.usub.sat.v2i8(<2 x i8> %va, <2 x i8> %vb, <2 x i1> %m, i32 %evl)
57 define <2 x i8> @vssubu_vx_v2i8_unmasked(<2 x i8> %va, i8 %b, i32 zeroext %evl) {
58 ; CHECK-LABEL: vssubu_vx_v2i8_unmasked:
60 ; CHECK-NEXT: vsetvli zero, a1, e8, mf8, ta, ma
61 ; CHECK-NEXT: vssubu.vx v8, v8, a0
63 %elt.head = insertelement <2 x i8> poison, i8 %b, i32 0
64 %vb = shufflevector <2 x i8> %elt.head, <2 x i8> poison, <2 x i32> zeroinitializer
65 %v = call <2 x i8> @llvm.vp.usub.sat.v2i8(<2 x i8> %va, <2 x i8> %vb, <2 x i1> splat (i1 true), i32 %evl)
69 define <2 x i8> @vssubu_vi_v2i8(<2 x i8> %va, <2 x i1> %m, i32 zeroext %evl) {
70 ; CHECK-LABEL: vssubu_vi_v2i8:
72 ; CHECK-NEXT: li a1, -1
73 ; CHECK-NEXT: vsetvli zero, a0, e8, mf8, ta, ma
74 ; CHECK-NEXT: vssubu.vx v8, v8, a1, v0.t
76 %v = call <2 x i8> @llvm.vp.usub.sat.v2i8(<2 x i8> %va, <2 x i8> splat (i8 -1), <2 x i1> %m, i32 %evl)
80 define <2 x i8> @vssubu_vi_v2i8_unmasked(<2 x i8> %va, i32 zeroext %evl) {
81 ; CHECK-LABEL: vssubu_vi_v2i8_unmasked:
83 ; CHECK-NEXT: li a1, -1
84 ; CHECK-NEXT: vsetvli zero, a0, e8, mf8, ta, ma
85 ; CHECK-NEXT: vssubu.vx v8, v8, a1
87 %v = call <2 x i8> @llvm.vp.usub.sat.v2i8(<2 x i8> %va, <2 x i8> splat (i8 -1), <2 x i1> splat (i1 true), i32 %evl)
91 declare <4 x i8> @llvm.vp.usub.sat.v4i8(<4 x i8>, <4 x i8>, <4 x i1>, i32)
93 define <4 x i8> @vssubu_vv_v4i8(<4 x i8> %va, <4 x i8> %b, <4 x i1> %m, i32 zeroext %evl) {
94 ; CHECK-LABEL: vssubu_vv_v4i8:
96 ; CHECK-NEXT: vsetvli zero, a0, e8, mf4, ta, ma
97 ; CHECK-NEXT: vssubu.vv v8, v8, v9, v0.t
99 %v = call <4 x i8> @llvm.vp.usub.sat.v4i8(<4 x i8> %va, <4 x i8> %b, <4 x i1> %m, i32 %evl)
103 define <4 x i8> @vssubu_vv_v4i8_unmasked(<4 x i8> %va, <4 x i8> %b, i32 zeroext %evl) {
104 ; CHECK-LABEL: vssubu_vv_v4i8_unmasked:
106 ; CHECK-NEXT: vsetvli zero, a0, e8, mf4, ta, ma
107 ; CHECK-NEXT: vssubu.vv v8, v8, v9
109 %v = call <4 x i8> @llvm.vp.usub.sat.v4i8(<4 x i8> %va, <4 x i8> %b, <4 x i1> splat (i1 true), i32 %evl)
113 define <4 x i8> @vssubu_vx_v4i8(<4 x i8> %va, i8 %b, <4 x i1> %m, i32 zeroext %evl) {
114 ; CHECK-LABEL: vssubu_vx_v4i8:
116 ; CHECK-NEXT: vsetvli zero, a1, e8, mf4, ta, ma
117 ; CHECK-NEXT: vssubu.vx v8, v8, a0, v0.t
119 %elt.head = insertelement <4 x i8> poison, i8 %b, i32 0
120 %vb = shufflevector <4 x i8> %elt.head, <4 x i8> poison, <4 x i32> zeroinitializer
121 %v = call <4 x i8> @llvm.vp.usub.sat.v4i8(<4 x i8> %va, <4 x i8> %vb, <4 x i1> %m, i32 %evl)
125 define <4 x i8> @vssubu_vx_v4i8_commute(<4 x i8> %va, i8 %b, <4 x i1> %m, i32 zeroext %evl) {
126 ; CHECK-LABEL: vssubu_vx_v4i8_commute:
128 ; CHECK-NEXT: vsetivli zero, 4, e8, mf4, ta, ma
129 ; CHECK-NEXT: vmv.v.x v9, a0
130 ; CHECK-NEXT: vsetvli zero, a1, e8, mf4, ta, ma
131 ; CHECK-NEXT: vssubu.vv v8, v9, v8, v0.t
133 %elt.head = insertelement <4 x i8> poison, i8 %b, i32 0
134 %vb = shufflevector <4 x i8> %elt.head, <4 x i8> poison, <4 x i32> zeroinitializer
135 %v = call <4 x i8> @llvm.vp.usub.sat.v4i8(<4 x i8> %vb, <4 x i8> %va, <4 x i1> %m, i32 %evl)
139 define <4 x i8> @vssubu_vx_v4i8_unmasked(<4 x i8> %va, i8 %b, i32 zeroext %evl) {
140 ; CHECK-LABEL: vssubu_vx_v4i8_unmasked:
142 ; CHECK-NEXT: vsetvli zero, a1, e8, mf4, ta, ma
143 ; CHECK-NEXT: vssubu.vx v8, v8, a0
145 %elt.head = insertelement <4 x i8> poison, i8 %b, i32 0
146 %vb = shufflevector <4 x i8> %elt.head, <4 x i8> poison, <4 x i32> zeroinitializer
147 %v = call <4 x i8> @llvm.vp.usub.sat.v4i8(<4 x i8> %va, <4 x i8> %vb, <4 x i1> splat (i1 true), i32 %evl)
151 define <4 x i8> @vssubu_vi_v4i8(<4 x i8> %va, <4 x i1> %m, i32 zeroext %evl) {
152 ; CHECK-LABEL: vssubu_vi_v4i8:
154 ; CHECK-NEXT: li a1, -1
155 ; CHECK-NEXT: vsetvli zero, a0, e8, mf4, ta, ma
156 ; CHECK-NEXT: vssubu.vx v8, v8, a1, v0.t
158 %v = call <4 x i8> @llvm.vp.usub.sat.v4i8(<4 x i8> %va, <4 x i8> splat (i8 -1), <4 x i1> %m, i32 %evl)
162 define <4 x i8> @vssubu_vi_v4i8_unmasked(<4 x i8> %va, i32 zeroext %evl) {
163 ; CHECK-LABEL: vssubu_vi_v4i8_unmasked:
165 ; CHECK-NEXT: li a1, -1
166 ; CHECK-NEXT: vsetvli zero, a0, e8, mf4, ta, ma
167 ; CHECK-NEXT: vssubu.vx v8, v8, a1
169 %v = call <4 x i8> @llvm.vp.usub.sat.v4i8(<4 x i8> %va, <4 x i8> splat (i8 -1), <4 x i1> splat (i1 true), i32 %evl)
173 declare <5 x i8> @llvm.vp.usub.sat.v5i8(<5 x i8>, <5 x i8>, <5 x i1>, i32)
175 define <5 x i8> @vssubu_vv_v5i8(<5 x i8> %va, <5 x i8> %b, <5 x i1> %m, i32 zeroext %evl) {
176 ; CHECK-LABEL: vssubu_vv_v5i8:
178 ; CHECK-NEXT: vsetvli zero, a0, e8, mf2, ta, ma
179 ; CHECK-NEXT: vssubu.vv v8, v8, v9, v0.t
181 %v = call <5 x i8> @llvm.vp.usub.sat.v5i8(<5 x i8> %va, <5 x i8> %b, <5 x i1> %m, i32 %evl)
185 define <5 x i8> @vssubu_vv_v5i8_unmasked(<5 x i8> %va, <5 x i8> %b, i32 zeroext %evl) {
186 ; CHECK-LABEL: vssubu_vv_v5i8_unmasked:
188 ; CHECK-NEXT: vsetvli zero, a0, e8, mf2, ta, ma
189 ; CHECK-NEXT: vssubu.vv v8, v8, v9
191 %v = call <5 x i8> @llvm.vp.usub.sat.v5i8(<5 x i8> %va, <5 x i8> %b, <5 x i1> splat (i1 true), i32 %evl)
195 define <5 x i8> @vssubu_vx_v5i8(<5 x i8> %va, i8 %b, <5 x i1> %m, i32 zeroext %evl) {
196 ; CHECK-LABEL: vssubu_vx_v5i8:
198 ; CHECK-NEXT: vsetvli zero, a1, e8, mf2, ta, ma
199 ; CHECK-NEXT: vssubu.vx v8, v8, a0, v0.t
201 %elt.head = insertelement <5 x i8> poison, i8 %b, i32 0
202 %vb = shufflevector <5 x i8> %elt.head, <5 x i8> poison, <5 x i32> zeroinitializer
203 %v = call <5 x i8> @llvm.vp.usub.sat.v5i8(<5 x i8> %va, <5 x i8> %vb, <5 x i1> %m, i32 %evl)
207 define <5 x i8> @vssubu_vx_v5i8_unmasked(<5 x i8> %va, i8 %b, i32 zeroext %evl) {
208 ; CHECK-LABEL: vssubu_vx_v5i8_unmasked:
210 ; CHECK-NEXT: vsetvli zero, a1, e8, mf2, ta, ma
211 ; CHECK-NEXT: vssubu.vx v8, v8, a0
213 %elt.head = insertelement <5 x i8> poison, i8 %b, i32 0
214 %vb = shufflevector <5 x i8> %elt.head, <5 x i8> poison, <5 x i32> zeroinitializer
215 %v = call <5 x i8> @llvm.vp.usub.sat.v5i8(<5 x i8> %va, <5 x i8> %vb, <5 x i1> splat (i1 true), i32 %evl)
219 define <5 x i8> @vssubu_vi_v5i8(<5 x i8> %va, <5 x i1> %m, i32 zeroext %evl) {
220 ; CHECK-LABEL: vssubu_vi_v5i8:
222 ; CHECK-NEXT: li a1, -1
223 ; CHECK-NEXT: vsetvli zero, a0, e8, mf2, ta, ma
224 ; CHECK-NEXT: vssubu.vx v8, v8, a1, v0.t
226 %v = call <5 x i8> @llvm.vp.usub.sat.v5i8(<5 x i8> %va, <5 x i8> splat (i8 -1), <5 x i1> %m, i32 %evl)
230 define <5 x i8> @vssubu_vi_v5i8_unmasked(<5 x i8> %va, i32 zeroext %evl) {
231 ; CHECK-LABEL: vssubu_vi_v5i8_unmasked:
233 ; CHECK-NEXT: li a1, -1
234 ; CHECK-NEXT: vsetvli zero, a0, e8, mf2, ta, ma
235 ; CHECK-NEXT: vssubu.vx v8, v8, a1
237 %v = call <5 x i8> @llvm.vp.usub.sat.v5i8(<5 x i8> %va, <5 x i8> splat (i8 -1), <5 x i1> splat (i1 true), i32 %evl)
241 declare <8 x i8> @llvm.vp.usub.sat.v8i8(<8 x i8>, <8 x i8>, <8 x i1>, i32)
243 define <8 x i8> @vssubu_vv_v8i8(<8 x i8> %va, <8 x i8> %b, <8 x i1> %m, i32 zeroext %evl) {
244 ; CHECK-LABEL: vssubu_vv_v8i8:
246 ; CHECK-NEXT: vsetvli zero, a0, e8, mf2, ta, ma
247 ; CHECK-NEXT: vssubu.vv v8, v8, v9, v0.t
249 %v = call <8 x i8> @llvm.vp.usub.sat.v8i8(<8 x i8> %va, <8 x i8> %b, <8 x i1> %m, i32 %evl)
253 define <8 x i8> @vssubu_vv_v8i8_unmasked(<8 x i8> %va, <8 x i8> %b, i32 zeroext %evl) {
254 ; CHECK-LABEL: vssubu_vv_v8i8_unmasked:
256 ; CHECK-NEXT: vsetvli zero, a0, e8, mf2, ta, ma
257 ; CHECK-NEXT: vssubu.vv v8, v8, v9
259 %v = call <8 x i8> @llvm.vp.usub.sat.v8i8(<8 x i8> %va, <8 x i8> %b, <8 x i1> splat (i1 true), i32 %evl)
263 define <8 x i8> @vssubu_vx_v8i8(<8 x i8> %va, i8 %b, <8 x i1> %m, i32 zeroext %evl) {
264 ; CHECK-LABEL: vssubu_vx_v8i8:
266 ; CHECK-NEXT: vsetvli zero, a1, e8, mf2, ta, ma
267 ; CHECK-NEXT: vssubu.vx v8, v8, a0, v0.t
269 %elt.head = insertelement <8 x i8> poison, i8 %b, i32 0
270 %vb = shufflevector <8 x i8> %elt.head, <8 x i8> poison, <8 x i32> zeroinitializer
271 %v = call <8 x i8> @llvm.vp.usub.sat.v8i8(<8 x i8> %va, <8 x i8> %vb, <8 x i1> %m, i32 %evl)
275 define <8 x i8> @vssubu_vx_v8i8_unmasked(<8 x i8> %va, i8 %b, i32 zeroext %evl) {
276 ; CHECK-LABEL: vssubu_vx_v8i8_unmasked:
278 ; CHECK-NEXT: vsetvli zero, a1, e8, mf2, ta, ma
279 ; CHECK-NEXT: vssubu.vx v8, v8, a0
281 %elt.head = insertelement <8 x i8> poison, i8 %b, i32 0
282 %vb = shufflevector <8 x i8> %elt.head, <8 x i8> poison, <8 x i32> zeroinitializer
283 %v = call <8 x i8> @llvm.vp.usub.sat.v8i8(<8 x i8> %va, <8 x i8> %vb, <8 x i1> splat (i1 true), i32 %evl)
287 define <8 x i8> @vssubu_vi_v8i8(<8 x i8> %va, <8 x i1> %m, i32 zeroext %evl) {
288 ; CHECK-LABEL: vssubu_vi_v8i8:
290 ; CHECK-NEXT: li a1, -1
291 ; CHECK-NEXT: vsetvli zero, a0, e8, mf2, ta, ma
292 ; CHECK-NEXT: vssubu.vx v8, v8, a1, v0.t
294 %v = call <8 x i8> @llvm.vp.usub.sat.v8i8(<8 x i8> %va, <8 x i8> splat (i8 -1), <8 x i1> %m, i32 %evl)
298 define <8 x i8> @vssubu_vi_v8i8_unmasked(<8 x i8> %va, i32 zeroext %evl) {
299 ; CHECK-LABEL: vssubu_vi_v8i8_unmasked:
301 ; CHECK-NEXT: li a1, -1
302 ; CHECK-NEXT: vsetvli zero, a0, e8, mf2, ta, ma
303 ; CHECK-NEXT: vssubu.vx v8, v8, a1
305 %v = call <8 x i8> @llvm.vp.usub.sat.v8i8(<8 x i8> %va, <8 x i8> splat (i8 -1), <8 x i1> splat (i1 true), i32 %evl)
309 declare <16 x i8> @llvm.vp.usub.sat.v16i8(<16 x i8>, <16 x i8>, <16 x i1>, i32)
311 define <16 x i8> @vssubu_vv_v16i8(<16 x i8> %va, <16 x i8> %b, <16 x i1> %m, i32 zeroext %evl) {
312 ; CHECK-LABEL: vssubu_vv_v16i8:
314 ; CHECK-NEXT: vsetvli zero, a0, e8, m1, ta, ma
315 ; CHECK-NEXT: vssubu.vv v8, v8, v9, v0.t
317 %v = call <16 x i8> @llvm.vp.usub.sat.v16i8(<16 x i8> %va, <16 x i8> %b, <16 x i1> %m, i32 %evl)
321 define <16 x i8> @vssubu_vv_v16i8_unmasked(<16 x i8> %va, <16 x i8> %b, i32 zeroext %evl) {
322 ; CHECK-LABEL: vssubu_vv_v16i8_unmasked:
324 ; CHECK-NEXT: vsetvli zero, a0, e8, m1, ta, ma
325 ; CHECK-NEXT: vssubu.vv v8, v8, v9
327 %v = call <16 x i8> @llvm.vp.usub.sat.v16i8(<16 x i8> %va, <16 x i8> %b, <16 x i1> splat (i1 true), i32 %evl)
331 define <16 x i8> @vssubu_vx_v16i8(<16 x i8> %va, i8 %b, <16 x i1> %m, i32 zeroext %evl) {
332 ; CHECK-LABEL: vssubu_vx_v16i8:
334 ; CHECK-NEXT: vsetvli zero, a1, e8, m1, ta, ma
335 ; CHECK-NEXT: vssubu.vx v8, v8, a0, v0.t
337 %elt.head = insertelement <16 x i8> poison, i8 %b, i32 0
338 %vb = shufflevector <16 x i8> %elt.head, <16 x i8> poison, <16 x i32> zeroinitializer
339 %v = call <16 x i8> @llvm.vp.usub.sat.v16i8(<16 x i8> %va, <16 x i8> %vb, <16 x i1> %m, i32 %evl)
343 define <16 x i8> @vssubu_vx_v16i8_unmasked(<16 x i8> %va, i8 %b, i32 zeroext %evl) {
344 ; CHECK-LABEL: vssubu_vx_v16i8_unmasked:
346 ; CHECK-NEXT: vsetvli zero, a1, e8, m1, ta, ma
347 ; CHECK-NEXT: vssubu.vx v8, v8, a0
349 %elt.head = insertelement <16 x i8> poison, i8 %b, i32 0
350 %vb = shufflevector <16 x i8> %elt.head, <16 x i8> poison, <16 x i32> zeroinitializer
351 %v = call <16 x i8> @llvm.vp.usub.sat.v16i8(<16 x i8> %va, <16 x i8> %vb, <16 x i1> splat (i1 true), i32 %evl)
355 define <16 x i8> @vssubu_vi_v16i8(<16 x i8> %va, <16 x i1> %m, i32 zeroext %evl) {
356 ; CHECK-LABEL: vssubu_vi_v16i8:
358 ; CHECK-NEXT: li a1, -1
359 ; CHECK-NEXT: vsetvli zero, a0, e8, m1, ta, ma
360 ; CHECK-NEXT: vssubu.vx v8, v8, a1, v0.t
362 %v = call <16 x i8> @llvm.vp.usub.sat.v16i8(<16 x i8> %va, <16 x i8> splat (i8 -1), <16 x i1> %m, i32 %evl)
366 define <16 x i8> @vssubu_vi_v16i8_unmasked(<16 x i8> %va, i32 zeroext %evl) {
367 ; CHECK-LABEL: vssubu_vi_v16i8_unmasked:
369 ; CHECK-NEXT: li a1, -1
370 ; CHECK-NEXT: vsetvli zero, a0, e8, m1, ta, ma
371 ; CHECK-NEXT: vssubu.vx v8, v8, a1
373 %v = call <16 x i8> @llvm.vp.usub.sat.v16i8(<16 x i8> %va, <16 x i8> splat (i8 -1), <16 x i1> splat (i1 true), i32 %evl)
377 declare <256 x i8> @llvm.vp.usub.sat.v258i8(<256 x i8>, <256 x i8>, <256 x i1>, i32)
379 define <256 x i8> @vssubu_vi_v258i8(<256 x i8> %va, <256 x i1> %m, i32 zeroext %evl) {
380 ; CHECK-LABEL: vssubu_vi_v258i8:
382 ; CHECK-NEXT: vmv1r.v v24, v0
383 ; CHECK-NEXT: li a2, 128
384 ; CHECK-NEXT: vsetvli zero, a2, e8, m8, ta, ma
385 ; CHECK-NEXT: vlm.v v0, (a0)
386 ; CHECK-NEXT: addi a0, a1, -128
387 ; CHECK-NEXT: sltu a3, a1, a0
388 ; CHECK-NEXT: addi a3, a3, -1
389 ; CHECK-NEXT: and a3, a3, a0
390 ; CHECK-NEXT: li a0, -1
391 ; CHECK-NEXT: vsetvli zero, a3, e8, m8, ta, ma
392 ; CHECK-NEXT: vssubu.vx v16, v16, a0, v0.t
393 ; CHECK-NEXT: bltu a1, a2, .LBB32_2
394 ; CHECK-NEXT: # %bb.1:
395 ; CHECK-NEXT: li a1, 128
396 ; CHECK-NEXT: .LBB32_2:
397 ; CHECK-NEXT: vmv1r.v v0, v24
398 ; CHECK-NEXT: vsetvli zero, a1, e8, m8, ta, ma
399 ; CHECK-NEXT: vssubu.vx v8, v8, a0, v0.t
401 %v = call <256 x i8> @llvm.vp.usub.sat.v258i8(<256 x i8> %va, <256 x i8> splat (i8 -1), <256 x i1> %m, i32 %evl)
405 define <256 x i8> @vssubu_vi_v258i8_unmasked(<256 x i8> %va, i32 zeroext %evl) {
406 ; CHECK-LABEL: vssubu_vi_v258i8_unmasked:
408 ; CHECK-NEXT: li a2, 128
409 ; CHECK-NEXT: mv a1, a0
410 ; CHECK-NEXT: bltu a0, a2, .LBB33_2
411 ; CHECK-NEXT: # %bb.1:
412 ; CHECK-NEXT: li a1, 128
413 ; CHECK-NEXT: .LBB33_2:
414 ; CHECK-NEXT: li a2, -1
415 ; CHECK-NEXT: vsetvli zero, a1, e8, m8, ta, ma
416 ; CHECK-NEXT: vssubu.vx v8, v8, a2
417 ; CHECK-NEXT: addi a1, a0, -128
418 ; CHECK-NEXT: sltu a0, a0, a1
419 ; CHECK-NEXT: addi a0, a0, -1
420 ; CHECK-NEXT: and a0, a0, a1
421 ; CHECK-NEXT: vsetvli zero, a0, e8, m8, ta, ma
422 ; CHECK-NEXT: vssubu.vx v16, v16, a2
424 %v = call <256 x i8> @llvm.vp.usub.sat.v258i8(<256 x i8> %va, <256 x i8> splat (i8 -1), <256 x i1> splat (i1 true), i32 %evl)
428 ; Test splitting when the %evl is a known constant.
430 define <256 x i8> @vssubu_vi_v258i8_evl129(<256 x i8> %va, <256 x i1> %m) {
431 ; CHECK-LABEL: vssubu_vi_v258i8_evl129:
433 ; CHECK-NEXT: li a1, 128
434 ; CHECK-NEXT: vsetvli zero, a1, e8, m8, ta, ma
435 ; CHECK-NEXT: vlm.v v24, (a0)
436 ; CHECK-NEXT: li a0, -1
437 ; CHECK-NEXT: vssubu.vx v8, v8, a0, v0.t
438 ; CHECK-NEXT: vmv1r.v v0, v24
439 ; CHECK-NEXT: vsetivli zero, 1, e8, m8, ta, ma
440 ; CHECK-NEXT: vssubu.vx v16, v16, a0, v0.t
442 %v = call <256 x i8> @llvm.vp.usub.sat.v258i8(<256 x i8> %va, <256 x i8> splat (i8 -1), <256 x i1> %m, i32 129)
446 ; FIXME: The upper half is doing nothing.
448 define <256 x i8> @vssubu_vi_v258i8_evl128(<256 x i8> %va, <256 x i1> %m) {
449 ; CHECK-LABEL: vssubu_vi_v258i8_evl128:
451 ; CHECK-NEXT: li a1, 128
452 ; CHECK-NEXT: vsetvli zero, a1, e8, m8, ta, ma
453 ; CHECK-NEXT: vlm.v v24, (a0)
454 ; CHECK-NEXT: li a0, -1
455 ; CHECK-NEXT: vssubu.vx v8, v8, a0, v0.t
456 ; CHECK-NEXT: vmv1r.v v0, v24
457 ; CHECK-NEXT: vsetivli zero, 0, e8, m8, ta, ma
458 ; CHECK-NEXT: vssubu.vx v16, v16, a0, v0.t
460 %v = call <256 x i8> @llvm.vp.usub.sat.v258i8(<256 x i8> %va, <256 x i8> splat (i8 -1), <256 x i1> %m, i32 128)
464 declare <2 x i16> @llvm.vp.usub.sat.v2i16(<2 x i16>, <2 x i16>, <2 x i1>, i32)
466 define <2 x i16> @vssubu_vv_v2i16(<2 x i16> %va, <2 x i16> %b, <2 x i1> %m, i32 zeroext %evl) {
467 ; CHECK-LABEL: vssubu_vv_v2i16:
469 ; CHECK-NEXT: vsetvli zero, a0, e16, mf4, ta, ma
470 ; CHECK-NEXT: vssubu.vv v8, v8, v9, v0.t
472 %v = call <2 x i16> @llvm.vp.usub.sat.v2i16(<2 x i16> %va, <2 x i16> %b, <2 x i1> %m, i32 %evl)
476 define <2 x i16> @vssubu_vv_v2i16_unmasked(<2 x i16> %va, <2 x i16> %b, i32 zeroext %evl) {
477 ; CHECK-LABEL: vssubu_vv_v2i16_unmasked:
479 ; CHECK-NEXT: vsetvli zero, a0, e16, mf4, ta, ma
480 ; CHECK-NEXT: vssubu.vv v8, v8, v9
482 %v = call <2 x i16> @llvm.vp.usub.sat.v2i16(<2 x i16> %va, <2 x i16> %b, <2 x i1> splat (i1 true), i32 %evl)
486 define <2 x i16> @vssubu_vx_v2i16(<2 x i16> %va, i16 %b, <2 x i1> %m, i32 zeroext %evl) {
487 ; CHECK-LABEL: vssubu_vx_v2i16:
489 ; CHECK-NEXT: vsetvli zero, a1, e16, mf4, ta, ma
490 ; CHECK-NEXT: vssubu.vx v8, v8, a0, v0.t
492 %elt.head = insertelement <2 x i16> poison, i16 %b, i32 0
493 %vb = shufflevector <2 x i16> %elt.head, <2 x i16> poison, <2 x i32> zeroinitializer
494 %v = call <2 x i16> @llvm.vp.usub.sat.v2i16(<2 x i16> %va, <2 x i16> %vb, <2 x i1> %m, i32 %evl)
498 define <2 x i16> @vssubu_vx_v2i16_unmasked(<2 x i16> %va, i16 %b, i32 zeroext %evl) {
499 ; CHECK-LABEL: vssubu_vx_v2i16_unmasked:
501 ; CHECK-NEXT: vsetvli zero, a1, e16, mf4, ta, ma
502 ; CHECK-NEXT: vssubu.vx v8, v8, a0
504 %elt.head = insertelement <2 x i16> poison, i16 %b, i32 0
505 %vb = shufflevector <2 x i16> %elt.head, <2 x i16> poison, <2 x i32> zeroinitializer
506 %v = call <2 x i16> @llvm.vp.usub.sat.v2i16(<2 x i16> %va, <2 x i16> %vb, <2 x i1> splat (i1 true), i32 %evl)
510 define <2 x i16> @vssubu_vi_v2i16(<2 x i16> %va, <2 x i1> %m, i32 zeroext %evl) {
511 ; CHECK-LABEL: vssubu_vi_v2i16:
513 ; CHECK-NEXT: li a1, -1
514 ; CHECK-NEXT: vsetvli zero, a0, e16, mf4, ta, ma
515 ; CHECK-NEXT: vssubu.vx v8, v8, a1, v0.t
517 %v = call <2 x i16> @llvm.vp.usub.sat.v2i16(<2 x i16> %va, <2 x i16> splat (i16 -1), <2 x i1> %m, i32 %evl)
521 define <2 x i16> @vssubu_vi_v2i16_unmasked(<2 x i16> %va, i32 zeroext %evl) {
522 ; CHECK-LABEL: vssubu_vi_v2i16_unmasked:
524 ; CHECK-NEXT: li a1, -1
525 ; CHECK-NEXT: vsetvli zero, a0, e16, mf4, ta, ma
526 ; CHECK-NEXT: vssubu.vx v8, v8, a1
528 %v = call <2 x i16> @llvm.vp.usub.sat.v2i16(<2 x i16> %va, <2 x i16> splat (i16 -1), <2 x i1> splat (i1 true), i32 %evl)
532 declare <4 x i16> @llvm.vp.usub.sat.v4i16(<4 x i16>, <4 x i16>, <4 x i1>, i32)
534 define <4 x i16> @vssubu_vv_v4i16(<4 x i16> %va, <4 x i16> %b, <4 x i1> %m, i32 zeroext %evl) {
535 ; CHECK-LABEL: vssubu_vv_v4i16:
537 ; CHECK-NEXT: vsetvli zero, a0, e16, mf2, ta, ma
538 ; CHECK-NEXT: vssubu.vv v8, v8, v9, v0.t
540 %v = call <4 x i16> @llvm.vp.usub.sat.v4i16(<4 x i16> %va, <4 x i16> %b, <4 x i1> %m, i32 %evl)
544 define <4 x i16> @vssubu_vv_v4i16_unmasked(<4 x i16> %va, <4 x i16> %b, i32 zeroext %evl) {
545 ; CHECK-LABEL: vssubu_vv_v4i16_unmasked:
547 ; CHECK-NEXT: vsetvli zero, a0, e16, mf2, ta, ma
548 ; CHECK-NEXT: vssubu.vv v8, v8, v9
550 %v = call <4 x i16> @llvm.vp.usub.sat.v4i16(<4 x i16> %va, <4 x i16> %b, <4 x i1> splat (i1 true), i32 %evl)
554 define <4 x i16> @vssubu_vx_v4i16(<4 x i16> %va, i16 %b, <4 x i1> %m, i32 zeroext %evl) {
555 ; CHECK-LABEL: vssubu_vx_v4i16:
557 ; CHECK-NEXT: vsetvli zero, a1, e16, mf2, ta, ma
558 ; CHECK-NEXT: vssubu.vx v8, v8, a0, v0.t
560 %elt.head = insertelement <4 x i16> poison, i16 %b, i32 0
561 %vb = shufflevector <4 x i16> %elt.head, <4 x i16> poison, <4 x i32> zeroinitializer
562 %v = call <4 x i16> @llvm.vp.usub.sat.v4i16(<4 x i16> %va, <4 x i16> %vb, <4 x i1> %m, i32 %evl)
566 define <4 x i16> @vssubu_vx_v4i16_unmasked(<4 x i16> %va, i16 %b, i32 zeroext %evl) {
567 ; CHECK-LABEL: vssubu_vx_v4i16_unmasked:
569 ; CHECK-NEXT: vsetvli zero, a1, e16, mf2, ta, ma
570 ; CHECK-NEXT: vssubu.vx v8, v8, a0
572 %elt.head = insertelement <4 x i16> poison, i16 %b, i32 0
573 %vb = shufflevector <4 x i16> %elt.head, <4 x i16> poison, <4 x i32> zeroinitializer
574 %v = call <4 x i16> @llvm.vp.usub.sat.v4i16(<4 x i16> %va, <4 x i16> %vb, <4 x i1> splat (i1 true), i32 %evl)
578 define <4 x i16> @vssubu_vi_v4i16(<4 x i16> %va, <4 x i1> %m, i32 zeroext %evl) {
579 ; CHECK-LABEL: vssubu_vi_v4i16:
581 ; CHECK-NEXT: li a1, -1
582 ; CHECK-NEXT: vsetvli zero, a0, e16, mf2, ta, ma
583 ; CHECK-NEXT: vssubu.vx v8, v8, a1, v0.t
585 %v = call <4 x i16> @llvm.vp.usub.sat.v4i16(<4 x i16> %va, <4 x i16> splat (i16 -1), <4 x i1> %m, i32 %evl)
589 define <4 x i16> @vssubu_vi_v4i16_unmasked(<4 x i16> %va, i32 zeroext %evl) {
590 ; CHECK-LABEL: vssubu_vi_v4i16_unmasked:
592 ; CHECK-NEXT: li a1, -1
593 ; CHECK-NEXT: vsetvli zero, a0, e16, mf2, ta, ma
594 ; CHECK-NEXT: vssubu.vx v8, v8, a1
596 %v = call <4 x i16> @llvm.vp.usub.sat.v4i16(<4 x i16> %va, <4 x i16> splat (i16 -1), <4 x i1> splat (i1 true), i32 %evl)
600 declare <8 x i16> @llvm.vp.usub.sat.v8i16(<8 x i16>, <8 x i16>, <8 x i1>, i32)
602 define <8 x i16> @vssubu_vv_v8i16(<8 x i16> %va, <8 x i16> %b, <8 x i1> %m, i32 zeroext %evl) {
603 ; CHECK-LABEL: vssubu_vv_v8i16:
605 ; CHECK-NEXT: vsetvli zero, a0, e16, m1, ta, ma
606 ; CHECK-NEXT: vssubu.vv v8, v8, v9, v0.t
608 %v = call <8 x i16> @llvm.vp.usub.sat.v8i16(<8 x i16> %va, <8 x i16> %b, <8 x i1> %m, i32 %evl)
612 define <8 x i16> @vssubu_vv_v8i16_unmasked(<8 x i16> %va, <8 x i16> %b, i32 zeroext %evl) {
613 ; CHECK-LABEL: vssubu_vv_v8i16_unmasked:
615 ; CHECK-NEXT: vsetvli zero, a0, e16, m1, ta, ma
616 ; CHECK-NEXT: vssubu.vv v8, v8, v9
618 %v = call <8 x i16> @llvm.vp.usub.sat.v8i16(<8 x i16> %va, <8 x i16> %b, <8 x i1> splat (i1 true), i32 %evl)
622 define <8 x i16> @vssubu_vx_v8i16(<8 x i16> %va, i16 %b, <8 x i1> %m, i32 zeroext %evl) {
623 ; CHECK-LABEL: vssubu_vx_v8i16:
625 ; CHECK-NEXT: vsetvli zero, a1, e16, m1, ta, ma
626 ; CHECK-NEXT: vssubu.vx v8, v8, a0, v0.t
628 %elt.head = insertelement <8 x i16> poison, i16 %b, i32 0
629 %vb = shufflevector <8 x i16> %elt.head, <8 x i16> poison, <8 x i32> zeroinitializer
630 %v = call <8 x i16> @llvm.vp.usub.sat.v8i16(<8 x i16> %va, <8 x i16> %vb, <8 x i1> %m, i32 %evl)
634 define <8 x i16> @vssubu_vx_v8i16_unmasked(<8 x i16> %va, i16 %b, i32 zeroext %evl) {
635 ; CHECK-LABEL: vssubu_vx_v8i16_unmasked:
637 ; CHECK-NEXT: vsetvli zero, a1, e16, m1, ta, ma
638 ; CHECK-NEXT: vssubu.vx v8, v8, a0
640 %elt.head = insertelement <8 x i16> poison, i16 %b, i32 0
641 %vb = shufflevector <8 x i16> %elt.head, <8 x i16> poison, <8 x i32> zeroinitializer
642 %v = call <8 x i16> @llvm.vp.usub.sat.v8i16(<8 x i16> %va, <8 x i16> %vb, <8 x i1> splat (i1 true), i32 %evl)
646 define <8 x i16> @vssubu_vi_v8i16(<8 x i16> %va, <8 x i1> %m, i32 zeroext %evl) {
647 ; CHECK-LABEL: vssubu_vi_v8i16:
649 ; CHECK-NEXT: li a1, -1
650 ; CHECK-NEXT: vsetvli zero, a0, e16, m1, ta, ma
651 ; CHECK-NEXT: vssubu.vx v8, v8, a1, v0.t
653 %v = call <8 x i16> @llvm.vp.usub.sat.v8i16(<8 x i16> %va, <8 x i16> splat (i16 -1), <8 x i1> %m, i32 %evl)
657 define <8 x i16> @vssubu_vi_v8i16_unmasked(<8 x i16> %va, i32 zeroext %evl) {
658 ; CHECK-LABEL: vssubu_vi_v8i16_unmasked:
660 ; CHECK-NEXT: li a1, -1
661 ; CHECK-NEXT: vsetvli zero, a0, e16, m1, ta, ma
662 ; CHECK-NEXT: vssubu.vx v8, v8, a1
664 %v = call <8 x i16> @llvm.vp.usub.sat.v8i16(<8 x i16> %va, <8 x i16> splat (i16 -1), <8 x i1> splat (i1 true), i32 %evl)
668 declare <16 x i16> @llvm.vp.usub.sat.v16i16(<16 x i16>, <16 x i16>, <16 x i1>, i32)
670 define <16 x i16> @vssubu_vv_v16i16(<16 x i16> %va, <16 x i16> %b, <16 x i1> %m, i32 zeroext %evl) {
671 ; CHECK-LABEL: vssubu_vv_v16i16:
673 ; CHECK-NEXT: vsetvli zero, a0, e16, m2, ta, ma
674 ; CHECK-NEXT: vssubu.vv v8, v8, v10, v0.t
676 %v = call <16 x i16> @llvm.vp.usub.sat.v16i16(<16 x i16> %va, <16 x i16> %b, <16 x i1> %m, i32 %evl)
680 define <16 x i16> @vssubu_vv_v16i16_unmasked(<16 x i16> %va, <16 x i16> %b, i32 zeroext %evl) {
681 ; CHECK-LABEL: vssubu_vv_v16i16_unmasked:
683 ; CHECK-NEXT: vsetvli zero, a0, e16, m2, ta, ma
684 ; CHECK-NEXT: vssubu.vv v8, v8, v10
686 %v = call <16 x i16> @llvm.vp.usub.sat.v16i16(<16 x i16> %va, <16 x i16> %b, <16 x i1> splat (i1 true), i32 %evl)
690 define <16 x i16> @vssubu_vx_v16i16(<16 x i16> %va, i16 %b, <16 x i1> %m, i32 zeroext %evl) {
691 ; CHECK-LABEL: vssubu_vx_v16i16:
693 ; CHECK-NEXT: vsetvli zero, a1, e16, m2, ta, ma
694 ; CHECK-NEXT: vssubu.vx v8, v8, a0, v0.t
696 %elt.head = insertelement <16 x i16> poison, i16 %b, i32 0
697 %vb = shufflevector <16 x i16> %elt.head, <16 x i16> poison, <16 x i32> zeroinitializer
698 %v = call <16 x i16> @llvm.vp.usub.sat.v16i16(<16 x i16> %va, <16 x i16> %vb, <16 x i1> %m, i32 %evl)
702 define <16 x i16> @vssubu_vx_v16i16_unmasked(<16 x i16> %va, i16 %b, i32 zeroext %evl) {
703 ; CHECK-LABEL: vssubu_vx_v16i16_unmasked:
705 ; CHECK-NEXT: vsetvli zero, a1, e16, m2, ta, ma
706 ; CHECK-NEXT: vssubu.vx v8, v8, a0
708 %elt.head = insertelement <16 x i16> poison, i16 %b, i32 0
709 %vb = shufflevector <16 x i16> %elt.head, <16 x i16> poison, <16 x i32> zeroinitializer
710 %v = call <16 x i16> @llvm.vp.usub.sat.v16i16(<16 x i16> %va, <16 x i16> %vb, <16 x i1> splat (i1 true), i32 %evl)
714 define <16 x i16> @vssubu_vi_v16i16(<16 x i16> %va, <16 x i1> %m, i32 zeroext %evl) {
715 ; CHECK-LABEL: vssubu_vi_v16i16:
717 ; CHECK-NEXT: li a1, -1
718 ; CHECK-NEXT: vsetvli zero, a0, e16, m2, ta, ma
719 ; CHECK-NEXT: vssubu.vx v8, v8, a1, v0.t
721 %v = call <16 x i16> @llvm.vp.usub.sat.v16i16(<16 x i16> %va, <16 x i16> splat (i16 -1), <16 x i1> %m, i32 %evl)
725 define <16 x i16> @vssubu_vi_v16i16_unmasked(<16 x i16> %va, i32 zeroext %evl) {
726 ; CHECK-LABEL: vssubu_vi_v16i16_unmasked:
728 ; CHECK-NEXT: li a1, -1
729 ; CHECK-NEXT: vsetvli zero, a0, e16, m2, ta, ma
730 ; CHECK-NEXT: vssubu.vx v8, v8, a1
732 %v = call <16 x i16> @llvm.vp.usub.sat.v16i16(<16 x i16> %va, <16 x i16> splat (i16 -1), <16 x i1> splat (i1 true), i32 %evl)
736 declare <2 x i32> @llvm.vp.usub.sat.v2i32(<2 x i32>, <2 x i32>, <2 x i1>, i32)
738 define <2 x i32> @vssubu_vv_v2i32(<2 x i32> %va, <2 x i32> %b, <2 x i1> %m, i32 zeroext %evl) {
739 ; CHECK-LABEL: vssubu_vv_v2i32:
741 ; CHECK-NEXT: vsetvli zero, a0, e32, mf2, ta, ma
742 ; CHECK-NEXT: vssubu.vv v8, v8, v9, v0.t
744 %v = call <2 x i32> @llvm.vp.usub.sat.v2i32(<2 x i32> %va, <2 x i32> %b, <2 x i1> %m, i32 %evl)
748 define <2 x i32> @vssubu_vv_v2i32_unmasked(<2 x i32> %va, <2 x i32> %b, i32 zeroext %evl) {
749 ; CHECK-LABEL: vssubu_vv_v2i32_unmasked:
751 ; CHECK-NEXT: vsetvli zero, a0, e32, mf2, ta, ma
752 ; CHECK-NEXT: vssubu.vv v8, v8, v9
754 %v = call <2 x i32> @llvm.vp.usub.sat.v2i32(<2 x i32> %va, <2 x i32> %b, <2 x i1> splat (i1 true), i32 %evl)
758 define <2 x i32> @vssubu_vx_v2i32(<2 x i32> %va, i32 %b, <2 x i1> %m, i32 zeroext %evl) {
759 ; CHECK-LABEL: vssubu_vx_v2i32:
761 ; CHECK-NEXT: vsetvli zero, a1, e32, mf2, ta, ma
762 ; CHECK-NEXT: vssubu.vx v8, v8, a0, v0.t
764 %elt.head = insertelement <2 x i32> poison, i32 %b, i32 0
765 %vb = shufflevector <2 x i32> %elt.head, <2 x i32> poison, <2 x i32> zeroinitializer
766 %v = call <2 x i32> @llvm.vp.usub.sat.v2i32(<2 x i32> %va, <2 x i32> %vb, <2 x i1> %m, i32 %evl)
770 define <2 x i32> @vssubu_vx_v2i32_unmasked(<2 x i32> %va, i32 %b, i32 zeroext %evl) {
771 ; CHECK-LABEL: vssubu_vx_v2i32_unmasked:
773 ; CHECK-NEXT: vsetvli zero, a1, e32, mf2, ta, ma
774 ; CHECK-NEXT: vssubu.vx v8, v8, a0
776 %elt.head = insertelement <2 x i32> poison, i32 %b, i32 0
777 %vb = shufflevector <2 x i32> %elt.head, <2 x i32> poison, <2 x i32> zeroinitializer
778 %v = call <2 x i32> @llvm.vp.usub.sat.v2i32(<2 x i32> %va, <2 x i32> %vb, <2 x i1> splat (i1 true), i32 %evl)
782 define <2 x i32> @vssubu_vi_v2i32(<2 x i32> %va, <2 x i1> %m, i32 zeroext %evl) {
783 ; CHECK-LABEL: vssubu_vi_v2i32:
785 ; CHECK-NEXT: li a1, -1
786 ; CHECK-NEXT: vsetvli zero, a0, e32, mf2, ta, ma
787 ; CHECK-NEXT: vssubu.vx v8, v8, a1, v0.t
789 %v = call <2 x i32> @llvm.vp.usub.sat.v2i32(<2 x i32> %va, <2 x i32> splat (i32 -1), <2 x i1> %m, i32 %evl)
793 define <2 x i32> @vssubu_vi_v2i32_unmasked(<2 x i32> %va, i32 zeroext %evl) {
794 ; CHECK-LABEL: vssubu_vi_v2i32_unmasked:
796 ; CHECK-NEXT: li a1, -1
797 ; CHECK-NEXT: vsetvli zero, a0, e32, mf2, ta, ma
798 ; CHECK-NEXT: vssubu.vx v8, v8, a1
800 %v = call <2 x i32> @llvm.vp.usub.sat.v2i32(<2 x i32> %va, <2 x i32> splat (i32 -1), <2 x i1> splat (i1 true), i32 %evl)
804 declare <4 x i32> @llvm.vp.usub.sat.v4i32(<4 x i32>, <4 x i32>, <4 x i1>, i32)
806 define <4 x i32> @vssubu_vv_v4i32(<4 x i32> %va, <4 x i32> %b, <4 x i1> %m, i32 zeroext %evl) {
807 ; CHECK-LABEL: vssubu_vv_v4i32:
809 ; CHECK-NEXT: vsetvli zero, a0, e32, m1, ta, ma
810 ; CHECK-NEXT: vssubu.vv v8, v8, v9, v0.t
812 %v = call <4 x i32> @llvm.vp.usub.sat.v4i32(<4 x i32> %va, <4 x i32> %b, <4 x i1> %m, i32 %evl)
816 define <4 x i32> @vssubu_vv_v4i32_unmasked(<4 x i32> %va, <4 x i32> %b, i32 zeroext %evl) {
817 ; CHECK-LABEL: vssubu_vv_v4i32_unmasked:
819 ; CHECK-NEXT: vsetvli zero, a0, e32, m1, ta, ma
820 ; CHECK-NEXT: vssubu.vv v8, v8, v9
822 %v = call <4 x i32> @llvm.vp.usub.sat.v4i32(<4 x i32> %va, <4 x i32> %b, <4 x i1> splat (i1 true), i32 %evl)
826 define <4 x i32> @vssubu_vx_v4i32(<4 x i32> %va, i32 %b, <4 x i1> %m, i32 zeroext %evl) {
827 ; CHECK-LABEL: vssubu_vx_v4i32:
829 ; CHECK-NEXT: vsetvli zero, a1, e32, m1, ta, ma
830 ; CHECK-NEXT: vssubu.vx v8, v8, a0, v0.t
832 %elt.head = insertelement <4 x i32> poison, i32 %b, i32 0
833 %vb = shufflevector <4 x i32> %elt.head, <4 x i32> poison, <4 x i32> zeroinitializer
834 %v = call <4 x i32> @llvm.vp.usub.sat.v4i32(<4 x i32> %va, <4 x i32> %vb, <4 x i1> %m, i32 %evl)
838 define <4 x i32> @vssubu_vx_v4i32_unmasked(<4 x i32> %va, i32 %b, i32 zeroext %evl) {
839 ; CHECK-LABEL: vssubu_vx_v4i32_unmasked:
841 ; CHECK-NEXT: vsetvli zero, a1, e32, m1, ta, ma
842 ; CHECK-NEXT: vssubu.vx v8, v8, a0
844 %elt.head = insertelement <4 x i32> poison, i32 %b, i32 0
845 %vb = shufflevector <4 x i32> %elt.head, <4 x i32> poison, <4 x i32> zeroinitializer
846 %v = call <4 x i32> @llvm.vp.usub.sat.v4i32(<4 x i32> %va, <4 x i32> %vb, <4 x i1> splat (i1 true), i32 %evl)
850 define <4 x i32> @vssubu_vi_v4i32(<4 x i32> %va, <4 x i1> %m, i32 zeroext %evl) {
851 ; CHECK-LABEL: vssubu_vi_v4i32:
853 ; CHECK-NEXT: li a1, -1
854 ; CHECK-NEXT: vsetvli zero, a0, e32, m1, ta, ma
855 ; CHECK-NEXT: vssubu.vx v8, v8, a1, v0.t
857 %v = call <4 x i32> @llvm.vp.usub.sat.v4i32(<4 x i32> %va, <4 x i32> splat (i32 -1), <4 x i1> %m, i32 %evl)
861 define <4 x i32> @vssubu_vi_v4i32_unmasked(<4 x i32> %va, i32 zeroext %evl) {
862 ; CHECK-LABEL: vssubu_vi_v4i32_unmasked:
864 ; CHECK-NEXT: li a1, -1
865 ; CHECK-NEXT: vsetvli zero, a0, e32, m1, ta, ma
866 ; CHECK-NEXT: vssubu.vx v8, v8, a1
868 %v = call <4 x i32> @llvm.vp.usub.sat.v4i32(<4 x i32> %va, <4 x i32> splat (i32 -1), <4 x i1> splat (i1 true), i32 %evl)
872 declare <8 x i32> @llvm.vp.usub.sat.v8i32(<8 x i32>, <8 x i32>, <8 x i1>, i32)
874 define <8 x i32> @vssubu_vv_v8i32(<8 x i32> %va, <8 x i32> %b, <8 x i1> %m, i32 zeroext %evl) {
875 ; CHECK-LABEL: vssubu_vv_v8i32:
877 ; CHECK-NEXT: vsetvli zero, a0, e32, m2, ta, ma
878 ; CHECK-NEXT: vssubu.vv v8, v8, v10, v0.t
880 %v = call <8 x i32> @llvm.vp.usub.sat.v8i32(<8 x i32> %va, <8 x i32> %b, <8 x i1> %m, i32 %evl)
884 define <8 x i32> @vssubu_vv_v8i32_unmasked(<8 x i32> %va, <8 x i32> %b, i32 zeroext %evl) {
885 ; CHECK-LABEL: vssubu_vv_v8i32_unmasked:
887 ; CHECK-NEXT: vsetvli zero, a0, e32, m2, ta, ma
888 ; CHECK-NEXT: vssubu.vv v8, v8, v10
890 %v = call <8 x i32> @llvm.vp.usub.sat.v8i32(<8 x i32> %va, <8 x i32> %b, <8 x i1> splat (i1 true), i32 %evl)
894 define <8 x i32> @vssubu_vx_v8i32(<8 x i32> %va, i32 %b, <8 x i1> %m, i32 zeroext %evl) {
895 ; CHECK-LABEL: vssubu_vx_v8i32:
897 ; CHECK-NEXT: vsetvli zero, a1, e32, m2, ta, ma
898 ; CHECK-NEXT: vssubu.vx v8, v8, a0, v0.t
900 %elt.head = insertelement <8 x i32> poison, i32 %b, i32 0
901 %vb = shufflevector <8 x i32> %elt.head, <8 x i32> poison, <8 x i32> zeroinitializer
902 %v = call <8 x i32> @llvm.vp.usub.sat.v8i32(<8 x i32> %va, <8 x i32> %vb, <8 x i1> %m, i32 %evl)
906 define <8 x i32> @vssubu_vx_v8i32_unmasked(<8 x i32> %va, i32 %b, i32 zeroext %evl) {
907 ; CHECK-LABEL: vssubu_vx_v8i32_unmasked:
909 ; CHECK-NEXT: vsetvli zero, a1, e32, m2, ta, ma
910 ; CHECK-NEXT: vssubu.vx v8, v8, a0
912 %elt.head = insertelement <8 x i32> poison, i32 %b, i32 0
913 %vb = shufflevector <8 x i32> %elt.head, <8 x i32> poison, <8 x i32> zeroinitializer
914 %v = call <8 x i32> @llvm.vp.usub.sat.v8i32(<8 x i32> %va, <8 x i32> %vb, <8 x i1> splat (i1 true), i32 %evl)
918 define <8 x i32> @vssubu_vi_v8i32(<8 x i32> %va, <8 x i1> %m, i32 zeroext %evl) {
919 ; CHECK-LABEL: vssubu_vi_v8i32:
921 ; CHECK-NEXT: li a1, -1
922 ; CHECK-NEXT: vsetvli zero, a0, e32, m2, ta, ma
923 ; CHECK-NEXT: vssubu.vx v8, v8, a1, v0.t
925 %v = call <8 x i32> @llvm.vp.usub.sat.v8i32(<8 x i32> %va, <8 x i32> splat (i32 -1), <8 x i1> %m, i32 %evl)
929 define <8 x i32> @vssubu_vi_v8i32_unmasked(<8 x i32> %va, i32 zeroext %evl) {
930 ; CHECK-LABEL: vssubu_vi_v8i32_unmasked:
932 ; CHECK-NEXT: li a1, -1
933 ; CHECK-NEXT: vsetvli zero, a0, e32, m2, ta, ma
934 ; CHECK-NEXT: vssubu.vx v8, v8, a1
936 %v = call <8 x i32> @llvm.vp.usub.sat.v8i32(<8 x i32> %va, <8 x i32> splat (i32 -1), <8 x i1> splat (i1 true), i32 %evl)
940 declare <16 x i32> @llvm.vp.usub.sat.v16i32(<16 x i32>, <16 x i32>, <16 x i1>, i32)
942 define <16 x i32> @vssubu_vv_v16i32(<16 x i32> %va, <16 x i32> %b, <16 x i1> %m, i32 zeroext %evl) {
943 ; CHECK-LABEL: vssubu_vv_v16i32:
945 ; CHECK-NEXT: vsetvli zero, a0, e32, m4, ta, ma
946 ; CHECK-NEXT: vssubu.vv v8, v8, v12, v0.t
948 %v = call <16 x i32> @llvm.vp.usub.sat.v16i32(<16 x i32> %va, <16 x i32> %b, <16 x i1> %m, i32 %evl)
952 define <16 x i32> @vssubu_vv_v16i32_unmasked(<16 x i32> %va, <16 x i32> %b, i32 zeroext %evl) {
953 ; CHECK-LABEL: vssubu_vv_v16i32_unmasked:
955 ; CHECK-NEXT: vsetvli zero, a0, e32, m4, ta, ma
956 ; CHECK-NEXT: vssubu.vv v8, v8, v12
958 %v = call <16 x i32> @llvm.vp.usub.sat.v16i32(<16 x i32> %va, <16 x i32> %b, <16 x i1> splat (i1 true), i32 %evl)
962 define <16 x i32> @vssubu_vx_v16i32(<16 x i32> %va, i32 %b, <16 x i1> %m, i32 zeroext %evl) {
963 ; CHECK-LABEL: vssubu_vx_v16i32:
965 ; CHECK-NEXT: vsetvli zero, a1, e32, m4, ta, ma
966 ; CHECK-NEXT: vssubu.vx v8, v8, a0, v0.t
968 %elt.head = insertelement <16 x i32> poison, i32 %b, i32 0
969 %vb = shufflevector <16 x i32> %elt.head, <16 x i32> poison, <16 x i32> zeroinitializer
970 %v = call <16 x i32> @llvm.vp.usub.sat.v16i32(<16 x i32> %va, <16 x i32> %vb, <16 x i1> %m, i32 %evl)
974 define <16 x i32> @vssubu_vx_v16i32_unmasked(<16 x i32> %va, i32 %b, i32 zeroext %evl) {
975 ; CHECK-LABEL: vssubu_vx_v16i32_unmasked:
977 ; CHECK-NEXT: vsetvli zero, a1, e32, m4, ta, ma
978 ; CHECK-NEXT: vssubu.vx v8, v8, a0
980 %elt.head = insertelement <16 x i32> poison, i32 %b, i32 0
981 %vb = shufflevector <16 x i32> %elt.head, <16 x i32> poison, <16 x i32> zeroinitializer
982 %v = call <16 x i32> @llvm.vp.usub.sat.v16i32(<16 x i32> %va, <16 x i32> %vb, <16 x i1> splat (i1 true), i32 %evl)
986 define <16 x i32> @vssubu_vi_v16i32(<16 x i32> %va, <16 x i1> %m, i32 zeroext %evl) {
987 ; CHECK-LABEL: vssubu_vi_v16i32:
989 ; CHECK-NEXT: li a1, -1
990 ; CHECK-NEXT: vsetvli zero, a0, e32, m4, ta, ma
991 ; CHECK-NEXT: vssubu.vx v8, v8, a1, v0.t
993 %v = call <16 x i32> @llvm.vp.usub.sat.v16i32(<16 x i32> %va, <16 x i32> splat (i32 -1), <16 x i1> %m, i32 %evl)
997 define <16 x i32> @vssubu_vi_v16i32_unmasked(<16 x i32> %va, i32 zeroext %evl) {
998 ; CHECK-LABEL: vssubu_vi_v16i32_unmasked:
1000 ; CHECK-NEXT: li a1, -1
1001 ; CHECK-NEXT: vsetvli zero, a0, e32, m4, ta, ma
1002 ; CHECK-NEXT: vssubu.vx v8, v8, a1
1004 %v = call <16 x i32> @llvm.vp.usub.sat.v16i32(<16 x i32> %va, <16 x i32> splat (i32 -1), <16 x i1> splat (i1 true), i32 %evl)
1008 declare <2 x i64> @llvm.vp.usub.sat.v2i64(<2 x i64>, <2 x i64>, <2 x i1>, i32)
1010 define <2 x i64> @vssubu_vv_v2i64(<2 x i64> %va, <2 x i64> %b, <2 x i1> %m, i32 zeroext %evl) {
1011 ; CHECK-LABEL: vssubu_vv_v2i64:
1013 ; CHECK-NEXT: vsetvli zero, a0, e64, m1, ta, ma
1014 ; CHECK-NEXT: vssubu.vv v8, v8, v9, v0.t
1016 %v = call <2 x i64> @llvm.vp.usub.sat.v2i64(<2 x i64> %va, <2 x i64> %b, <2 x i1> %m, i32 %evl)
1020 define <2 x i64> @vssubu_vv_v2i64_unmasked(<2 x i64> %va, <2 x i64> %b, i32 zeroext %evl) {
1021 ; CHECK-LABEL: vssubu_vv_v2i64_unmasked:
1023 ; CHECK-NEXT: vsetvli zero, a0, e64, m1, ta, ma
1024 ; CHECK-NEXT: vssubu.vv v8, v8, v9
1026 %v = call <2 x i64> @llvm.vp.usub.sat.v2i64(<2 x i64> %va, <2 x i64> %b, <2 x i1> splat (i1 true), i32 %evl)
1030 define <2 x i64> @vssubu_vx_v2i64(<2 x i64> %va, i64 %b, <2 x i1> %m, i32 zeroext %evl) {
1031 ; RV32-LABEL: vssubu_vx_v2i64:
1033 ; RV32-NEXT: addi sp, sp, -16
1034 ; RV32-NEXT: .cfi_def_cfa_offset 16
1035 ; RV32-NEXT: sw a1, 12(sp)
1036 ; RV32-NEXT: sw a0, 8(sp)
1037 ; RV32-NEXT: addi a0, sp, 8
1038 ; RV32-NEXT: vsetivli zero, 2, e64, m1, ta, ma
1039 ; RV32-NEXT: vlse64.v v9, (a0), zero
1040 ; RV32-NEXT: vsetvli zero, a2, e64, m1, ta, ma
1041 ; RV32-NEXT: vssubu.vv v8, v8, v9, v0.t
1042 ; RV32-NEXT: addi sp, sp, 16
1045 ; RV64-LABEL: vssubu_vx_v2i64:
1047 ; RV64-NEXT: vsetvli zero, a1, e64, m1, ta, ma
1048 ; RV64-NEXT: vssubu.vx v8, v8, a0, v0.t
1050 %elt.head = insertelement <2 x i64> poison, i64 %b, i32 0
1051 %vb = shufflevector <2 x i64> %elt.head, <2 x i64> poison, <2 x i32> zeroinitializer
1052 %v = call <2 x i64> @llvm.vp.usub.sat.v2i64(<2 x i64> %va, <2 x i64> %vb, <2 x i1> %m, i32 %evl)
1056 define <2 x i64> @vssubu_vx_v2i64_unmasked(<2 x i64> %va, i64 %b, i32 zeroext %evl) {
1057 ; RV32-LABEL: vssubu_vx_v2i64_unmasked:
1059 ; RV32-NEXT: addi sp, sp, -16
1060 ; RV32-NEXT: .cfi_def_cfa_offset 16
1061 ; RV32-NEXT: sw a1, 12(sp)
1062 ; RV32-NEXT: sw a0, 8(sp)
1063 ; RV32-NEXT: addi a0, sp, 8
1064 ; RV32-NEXT: vsetivli zero, 2, e64, m1, ta, ma
1065 ; RV32-NEXT: vlse64.v v9, (a0), zero
1066 ; RV32-NEXT: vsetvli zero, a2, e64, m1, ta, ma
1067 ; RV32-NEXT: vssubu.vv v8, v8, v9
1068 ; RV32-NEXT: addi sp, sp, 16
1071 ; RV64-LABEL: vssubu_vx_v2i64_unmasked:
1073 ; RV64-NEXT: vsetvli zero, a1, e64, m1, ta, ma
1074 ; RV64-NEXT: vssubu.vx v8, v8, a0
1076 %elt.head = insertelement <2 x i64> poison, i64 %b, i32 0
1077 %vb = shufflevector <2 x i64> %elt.head, <2 x i64> poison, <2 x i32> zeroinitializer
1078 %v = call <2 x i64> @llvm.vp.usub.sat.v2i64(<2 x i64> %va, <2 x i64> %vb, <2 x i1> splat (i1 true), i32 %evl)
1082 define <2 x i64> @vssubu_vi_v2i64(<2 x i64> %va, <2 x i1> %m, i32 zeroext %evl) {
1083 ; CHECK-LABEL: vssubu_vi_v2i64:
1085 ; CHECK-NEXT: li a1, -1
1086 ; CHECK-NEXT: vsetvli zero, a0, e64, m1, ta, ma
1087 ; CHECK-NEXT: vssubu.vx v8, v8, a1, v0.t
1089 %v = call <2 x i64> @llvm.vp.usub.sat.v2i64(<2 x i64> %va, <2 x i64> splat (i64 -1), <2 x i1> %m, i32 %evl)
1093 define <2 x i64> @vssubu_vi_v2i64_unmasked(<2 x i64> %va, i32 zeroext %evl) {
1094 ; CHECK-LABEL: vssubu_vi_v2i64_unmasked:
1096 ; CHECK-NEXT: li a1, -1
1097 ; CHECK-NEXT: vsetvli zero, a0, e64, m1, ta, ma
1098 ; CHECK-NEXT: vssubu.vx v8, v8, a1
1100 %v = call <2 x i64> @llvm.vp.usub.sat.v2i64(<2 x i64> %va, <2 x i64> splat (i64 -1), <2 x i1> splat (i1 true), i32 %evl)
1104 declare <4 x i64> @llvm.vp.usub.sat.v4i64(<4 x i64>, <4 x i64>, <4 x i1>, i32)
1106 define <4 x i64> @vssubu_vv_v4i64(<4 x i64> %va, <4 x i64> %b, <4 x i1> %m, i32 zeroext %evl) {
1107 ; CHECK-LABEL: vssubu_vv_v4i64:
1109 ; CHECK-NEXT: vsetvli zero, a0, e64, m2, ta, ma
1110 ; CHECK-NEXT: vssubu.vv v8, v8, v10, v0.t
1112 %v = call <4 x i64> @llvm.vp.usub.sat.v4i64(<4 x i64> %va, <4 x i64> %b, <4 x i1> %m, i32 %evl)
1116 define <4 x i64> @vssubu_vv_v4i64_unmasked(<4 x i64> %va, <4 x i64> %b, i32 zeroext %evl) {
1117 ; CHECK-LABEL: vssubu_vv_v4i64_unmasked:
1119 ; CHECK-NEXT: vsetvli zero, a0, e64, m2, ta, ma
1120 ; CHECK-NEXT: vssubu.vv v8, v8, v10
1122 %v = call <4 x i64> @llvm.vp.usub.sat.v4i64(<4 x i64> %va, <4 x i64> %b, <4 x i1> splat (i1 true), i32 %evl)
1126 define <4 x i64> @vssubu_vx_v4i64(<4 x i64> %va, i64 %b, <4 x i1> %m, i32 zeroext %evl) {
1127 ; RV32-LABEL: vssubu_vx_v4i64:
1129 ; RV32-NEXT: addi sp, sp, -16
1130 ; RV32-NEXT: .cfi_def_cfa_offset 16
1131 ; RV32-NEXT: sw a1, 12(sp)
1132 ; RV32-NEXT: sw a0, 8(sp)
1133 ; RV32-NEXT: addi a0, sp, 8
1134 ; RV32-NEXT: vsetivli zero, 4, e64, m2, ta, ma
1135 ; RV32-NEXT: vlse64.v v10, (a0), zero
1136 ; RV32-NEXT: vsetvli zero, a2, e64, m2, ta, ma
1137 ; RV32-NEXT: vssubu.vv v8, v8, v10, v0.t
1138 ; RV32-NEXT: addi sp, sp, 16
1141 ; RV64-LABEL: vssubu_vx_v4i64:
1143 ; RV64-NEXT: vsetvli zero, a1, e64, m2, ta, ma
1144 ; RV64-NEXT: vssubu.vx v8, v8, a0, v0.t
1146 %elt.head = insertelement <4 x i64> poison, i64 %b, i32 0
1147 %vb = shufflevector <4 x i64> %elt.head, <4 x i64> poison, <4 x i32> zeroinitializer
1148 %v = call <4 x i64> @llvm.vp.usub.sat.v4i64(<4 x i64> %va, <4 x i64> %vb, <4 x i1> %m, i32 %evl)
1152 define <4 x i64> @vssubu_vx_v4i64_unmasked(<4 x i64> %va, i64 %b, i32 zeroext %evl) {
1153 ; RV32-LABEL: vssubu_vx_v4i64_unmasked:
1155 ; RV32-NEXT: addi sp, sp, -16
1156 ; RV32-NEXT: .cfi_def_cfa_offset 16
1157 ; RV32-NEXT: sw a1, 12(sp)
1158 ; RV32-NEXT: sw a0, 8(sp)
1159 ; RV32-NEXT: addi a0, sp, 8
1160 ; RV32-NEXT: vsetivli zero, 4, e64, m2, ta, ma
1161 ; RV32-NEXT: vlse64.v v10, (a0), zero
1162 ; RV32-NEXT: vsetvli zero, a2, e64, m2, ta, ma
1163 ; RV32-NEXT: vssubu.vv v8, v8, v10
1164 ; RV32-NEXT: addi sp, sp, 16
1167 ; RV64-LABEL: vssubu_vx_v4i64_unmasked:
1169 ; RV64-NEXT: vsetvli zero, a1, e64, m2, ta, ma
1170 ; RV64-NEXT: vssubu.vx v8, v8, a0
1172 %elt.head = insertelement <4 x i64> poison, i64 %b, i32 0
1173 %vb = shufflevector <4 x i64> %elt.head, <4 x i64> poison, <4 x i32> zeroinitializer
1174 %v = call <4 x i64> @llvm.vp.usub.sat.v4i64(<4 x i64> %va, <4 x i64> %vb, <4 x i1> splat (i1 true), i32 %evl)
1178 define <4 x i64> @vssubu_vi_v4i64(<4 x i64> %va, <4 x i1> %m, i32 zeroext %evl) {
1179 ; CHECK-LABEL: vssubu_vi_v4i64:
1181 ; CHECK-NEXT: li a1, -1
1182 ; CHECK-NEXT: vsetvli zero, a0, e64, m2, ta, ma
1183 ; CHECK-NEXT: vssubu.vx v8, v8, a1, v0.t
1185 %v = call <4 x i64> @llvm.vp.usub.sat.v4i64(<4 x i64> %va, <4 x i64> splat (i64 -1), <4 x i1> %m, i32 %evl)
1189 define <4 x i64> @vssubu_vi_v4i64_unmasked(<4 x i64> %va, i32 zeroext %evl) {
1190 ; CHECK-LABEL: vssubu_vi_v4i64_unmasked:
1192 ; CHECK-NEXT: li a1, -1
1193 ; CHECK-NEXT: vsetvli zero, a0, e64, m2, ta, ma
1194 ; CHECK-NEXT: vssubu.vx v8, v8, a1
1196 %v = call <4 x i64> @llvm.vp.usub.sat.v4i64(<4 x i64> %va, <4 x i64> splat (i64 -1), <4 x i1> splat (i1 true), i32 %evl)
1200 declare <8 x i64> @llvm.vp.usub.sat.v8i64(<8 x i64>, <8 x i64>, <8 x i1>, i32)
1202 define <8 x i64> @vssubu_vv_v8i64(<8 x i64> %va, <8 x i64> %b, <8 x i1> %m, i32 zeroext %evl) {
1203 ; CHECK-LABEL: vssubu_vv_v8i64:
1205 ; CHECK-NEXT: vsetvli zero, a0, e64, m4, ta, ma
1206 ; CHECK-NEXT: vssubu.vv v8, v8, v12, v0.t
1208 %v = call <8 x i64> @llvm.vp.usub.sat.v8i64(<8 x i64> %va, <8 x i64> %b, <8 x i1> %m, i32 %evl)
1212 define <8 x i64> @vssubu_vv_v8i64_unmasked(<8 x i64> %va, <8 x i64> %b, i32 zeroext %evl) {
1213 ; CHECK-LABEL: vssubu_vv_v8i64_unmasked:
1215 ; CHECK-NEXT: vsetvli zero, a0, e64, m4, ta, ma
1216 ; CHECK-NEXT: vssubu.vv v8, v8, v12
1218 %v = call <8 x i64> @llvm.vp.usub.sat.v8i64(<8 x i64> %va, <8 x i64> %b, <8 x i1> splat (i1 true), i32 %evl)
1222 define <8 x i64> @vssubu_vx_v8i64(<8 x i64> %va, i64 %b, <8 x i1> %m, i32 zeroext %evl) {
1223 ; RV32-LABEL: vssubu_vx_v8i64:
1225 ; RV32-NEXT: addi sp, sp, -16
1226 ; RV32-NEXT: .cfi_def_cfa_offset 16
1227 ; RV32-NEXT: sw a1, 12(sp)
1228 ; RV32-NEXT: sw a0, 8(sp)
1229 ; RV32-NEXT: addi a0, sp, 8
1230 ; RV32-NEXT: vsetivli zero, 8, e64, m4, ta, ma
1231 ; RV32-NEXT: vlse64.v v12, (a0), zero
1232 ; RV32-NEXT: vsetvli zero, a2, e64, m4, ta, ma
1233 ; RV32-NEXT: vssubu.vv v8, v8, v12, v0.t
1234 ; RV32-NEXT: addi sp, sp, 16
1237 ; RV64-LABEL: vssubu_vx_v8i64:
1239 ; RV64-NEXT: vsetvli zero, a1, e64, m4, ta, ma
1240 ; RV64-NEXT: vssubu.vx v8, v8, a0, v0.t
1242 %elt.head = insertelement <8 x i64> poison, i64 %b, i32 0
1243 %vb = shufflevector <8 x i64> %elt.head, <8 x i64> poison, <8 x i32> zeroinitializer
1244 %v = call <8 x i64> @llvm.vp.usub.sat.v8i64(<8 x i64> %va, <8 x i64> %vb, <8 x i1> %m, i32 %evl)
1248 define <8 x i64> @vssubu_vx_v8i64_unmasked(<8 x i64> %va, i64 %b, i32 zeroext %evl) {
1249 ; RV32-LABEL: vssubu_vx_v8i64_unmasked:
1251 ; RV32-NEXT: addi sp, sp, -16
1252 ; RV32-NEXT: .cfi_def_cfa_offset 16
1253 ; RV32-NEXT: sw a1, 12(sp)
1254 ; RV32-NEXT: sw a0, 8(sp)
1255 ; RV32-NEXT: addi a0, sp, 8
1256 ; RV32-NEXT: vsetivli zero, 8, e64, m4, ta, ma
1257 ; RV32-NEXT: vlse64.v v12, (a0), zero
1258 ; RV32-NEXT: vsetvli zero, a2, e64, m4, ta, ma
1259 ; RV32-NEXT: vssubu.vv v8, v8, v12
1260 ; RV32-NEXT: addi sp, sp, 16
1263 ; RV64-LABEL: vssubu_vx_v8i64_unmasked:
1265 ; RV64-NEXT: vsetvli zero, a1, e64, m4, ta, ma
1266 ; RV64-NEXT: vssubu.vx v8, v8, a0
1268 %elt.head = insertelement <8 x i64> poison, i64 %b, i32 0
1269 %vb = shufflevector <8 x i64> %elt.head, <8 x i64> poison, <8 x i32> zeroinitializer
1270 %v = call <8 x i64> @llvm.vp.usub.sat.v8i64(<8 x i64> %va, <8 x i64> %vb, <8 x i1> splat (i1 true), i32 %evl)
1274 define <8 x i64> @vssubu_vi_v8i64(<8 x i64> %va, <8 x i1> %m, i32 zeroext %evl) {
1275 ; CHECK-LABEL: vssubu_vi_v8i64:
1277 ; CHECK-NEXT: li a1, -1
1278 ; CHECK-NEXT: vsetvli zero, a0, e64, m4, ta, ma
1279 ; CHECK-NEXT: vssubu.vx v8, v8, a1, v0.t
1281 %v = call <8 x i64> @llvm.vp.usub.sat.v8i64(<8 x i64> %va, <8 x i64> splat (i64 -1), <8 x i1> %m, i32 %evl)
1285 define <8 x i64> @vssubu_vi_v8i64_unmasked(<8 x i64> %va, i32 zeroext %evl) {
1286 ; CHECK-LABEL: vssubu_vi_v8i64_unmasked:
1288 ; CHECK-NEXT: li a1, -1
1289 ; CHECK-NEXT: vsetvli zero, a0, e64, m4, ta, ma
1290 ; CHECK-NEXT: vssubu.vx v8, v8, a1
1292 %v = call <8 x i64> @llvm.vp.usub.sat.v8i64(<8 x i64> %va, <8 x i64> splat (i64 -1), <8 x i1> splat (i1 true), i32 %evl)
1296 declare <16 x i64> @llvm.vp.usub.sat.v16i64(<16 x i64>, <16 x i64>, <16 x i1>, i32)
1298 define <16 x i64> @vssubu_vv_v16i64(<16 x i64> %va, <16 x i64> %b, <16 x i1> %m, i32 zeroext %evl) {
1299 ; CHECK-LABEL: vssubu_vv_v16i64:
1301 ; CHECK-NEXT: vsetvli zero, a0, e64, m8, ta, ma
1302 ; CHECK-NEXT: vssubu.vv v8, v8, v16, v0.t
1304 %v = call <16 x i64> @llvm.vp.usub.sat.v16i64(<16 x i64> %va, <16 x i64> %b, <16 x i1> %m, i32 %evl)
1308 define <16 x i64> @vssubu_vv_v16i64_unmasked(<16 x i64> %va, <16 x i64> %b, i32 zeroext %evl) {
1309 ; CHECK-LABEL: vssubu_vv_v16i64_unmasked:
1311 ; CHECK-NEXT: vsetvli zero, a0, e64, m8, ta, ma
1312 ; CHECK-NEXT: vssubu.vv v8, v8, v16
1314 %v = call <16 x i64> @llvm.vp.usub.sat.v16i64(<16 x i64> %va, <16 x i64> %b, <16 x i1> splat (i1 true), i32 %evl)
1318 define <16 x i64> @vssubu_vx_v16i64(<16 x i64> %va, i64 %b, <16 x i1> %m, i32 zeroext %evl) {
1319 ; RV32-LABEL: vssubu_vx_v16i64:
1321 ; RV32-NEXT: addi sp, sp, -16
1322 ; RV32-NEXT: .cfi_def_cfa_offset 16
1323 ; RV32-NEXT: sw a1, 12(sp)
1324 ; RV32-NEXT: sw a0, 8(sp)
1325 ; RV32-NEXT: addi a0, sp, 8
1326 ; RV32-NEXT: vsetivli zero, 16, e64, m8, ta, ma
1327 ; RV32-NEXT: vlse64.v v16, (a0), zero
1328 ; RV32-NEXT: vsetvli zero, a2, e64, m8, ta, ma
1329 ; RV32-NEXT: vssubu.vv v8, v8, v16, v0.t
1330 ; RV32-NEXT: addi sp, sp, 16
1333 ; RV64-LABEL: vssubu_vx_v16i64:
1335 ; RV64-NEXT: vsetvli zero, a1, e64, m8, ta, ma
1336 ; RV64-NEXT: vssubu.vx v8, v8, a0, v0.t
1338 %elt.head = insertelement <16 x i64> poison, i64 %b, i32 0
1339 %vb = shufflevector <16 x i64> %elt.head, <16 x i64> poison, <16 x i32> zeroinitializer
1340 %v = call <16 x i64> @llvm.vp.usub.sat.v16i64(<16 x i64> %va, <16 x i64> %vb, <16 x i1> %m, i32 %evl)
1344 define <16 x i64> @vssubu_vx_v16i64_unmasked(<16 x i64> %va, i64 %b, i32 zeroext %evl) {
1345 ; RV32-LABEL: vssubu_vx_v16i64_unmasked:
1347 ; RV32-NEXT: addi sp, sp, -16
1348 ; RV32-NEXT: .cfi_def_cfa_offset 16
1349 ; RV32-NEXT: sw a1, 12(sp)
1350 ; RV32-NEXT: sw a0, 8(sp)
1351 ; RV32-NEXT: addi a0, sp, 8
1352 ; RV32-NEXT: vsetivli zero, 16, e64, m8, ta, ma
1353 ; RV32-NEXT: vlse64.v v16, (a0), zero
1354 ; RV32-NEXT: vsetvli zero, a2, e64, m8, ta, ma
1355 ; RV32-NEXT: vssubu.vv v8, v8, v16
1356 ; RV32-NEXT: addi sp, sp, 16
1359 ; RV64-LABEL: vssubu_vx_v16i64_unmasked:
1361 ; RV64-NEXT: vsetvli zero, a1, e64, m8, ta, ma
1362 ; RV64-NEXT: vssubu.vx v8, v8, a0
1364 %elt.head = insertelement <16 x i64> poison, i64 %b, i32 0
1365 %vb = shufflevector <16 x i64> %elt.head, <16 x i64> poison, <16 x i32> zeroinitializer
1366 %v = call <16 x i64> @llvm.vp.usub.sat.v16i64(<16 x i64> %va, <16 x i64> %vb, <16 x i1> splat (i1 true), i32 %evl)
1370 define <16 x i64> @vssubu_vi_v16i64(<16 x i64> %va, <16 x i1> %m, i32 zeroext %evl) {
1371 ; CHECK-LABEL: vssubu_vi_v16i64:
1373 ; CHECK-NEXT: li a1, -1
1374 ; CHECK-NEXT: vsetvli zero, a0, e64, m8, ta, ma
1375 ; CHECK-NEXT: vssubu.vx v8, v8, a1, v0.t
1377 %v = call <16 x i64> @llvm.vp.usub.sat.v16i64(<16 x i64> %va, <16 x i64> splat (i64 -1), <16 x i1> %m, i32 %evl)
1381 define <16 x i64> @vssubu_vi_v16i64_unmasked(<16 x i64> %va, i32 zeroext %evl) {
1382 ; CHECK-LABEL: vssubu_vi_v16i64_unmasked:
1384 ; CHECK-NEXT: li a1, -1
1385 ; CHECK-NEXT: vsetvli zero, a0, e64, m8, ta, ma
1386 ; CHECK-NEXT: vssubu.vx v8, v8, a1
1388 %v = call <16 x i64> @llvm.vp.usub.sat.v16i64(<16 x i64> %va, <16 x i64> splat (i64 -1), <16 x i1> splat (i1 true), i32 %evl)
1392 ; Test that split-legalization works as expected.
1394 declare <32 x i64> @llvm.vp.usub.sat.v32i64(<32 x i64>, <32 x i64>, <32 x i1>, i32)
1396 define <32 x i64> @vssubu_vx_v32i64(<32 x i64> %va, <32 x i1> %m, i32 zeroext %evl) {
1397 ; RV32-LABEL: vssubu_vx_v32i64:
1399 ; RV32-NEXT: li a2, 16
1400 ; RV32-NEXT: vsetivli zero, 2, e8, mf4, ta, ma
1401 ; RV32-NEXT: vslidedown.vi v7, v0, 2
1402 ; RV32-NEXT: mv a1, a0
1403 ; RV32-NEXT: bltu a0, a2, .LBB108_2
1404 ; RV32-NEXT: # %bb.1:
1405 ; RV32-NEXT: li a1, 16
1406 ; RV32-NEXT: .LBB108_2:
1407 ; RV32-NEXT: li a2, 32
1408 ; RV32-NEXT: vsetvli zero, a2, e32, m8, ta, ma
1409 ; RV32-NEXT: vmv.v.i v24, -1
1410 ; RV32-NEXT: vsetvli zero, a1, e64, m8, ta, ma
1411 ; RV32-NEXT: vssubu.vv v8, v8, v24, v0.t
1412 ; RV32-NEXT: addi a1, a0, -16
1413 ; RV32-NEXT: sltu a0, a0, a1
1414 ; RV32-NEXT: addi a0, a0, -1
1415 ; RV32-NEXT: and a0, a0, a1
1416 ; RV32-NEXT: vmv1r.v v0, v7
1417 ; RV32-NEXT: vsetvli zero, a0, e64, m8, ta, ma
1418 ; RV32-NEXT: vssubu.vv v16, v16, v24, v0.t
1421 ; RV64-LABEL: vssubu_vx_v32i64:
1423 ; RV64-NEXT: li a2, 16
1424 ; RV64-NEXT: vsetivli zero, 2, e8, mf4, ta, ma
1425 ; RV64-NEXT: vslidedown.vi v24, v0, 2
1426 ; RV64-NEXT: mv a1, a0
1427 ; RV64-NEXT: bltu a0, a2, .LBB108_2
1428 ; RV64-NEXT: # %bb.1:
1429 ; RV64-NEXT: li a1, 16
1430 ; RV64-NEXT: .LBB108_2:
1431 ; RV64-NEXT: li a2, -1
1432 ; RV64-NEXT: vsetvli zero, a1, e64, m8, ta, ma
1433 ; RV64-NEXT: vssubu.vx v8, v8, a2, v0.t
1434 ; RV64-NEXT: addi a1, a0, -16
1435 ; RV64-NEXT: sltu a0, a0, a1
1436 ; RV64-NEXT: addi a0, a0, -1
1437 ; RV64-NEXT: and a0, a0, a1
1438 ; RV64-NEXT: vmv1r.v v0, v24
1439 ; RV64-NEXT: vsetvli zero, a0, e64, m8, ta, ma
1440 ; RV64-NEXT: vssubu.vx v16, v16, a2, v0.t
1442 %v = call <32 x i64> @llvm.vp.usub.sat.v32i64(<32 x i64> %va, <32 x i64> splat (i64 -1), <32 x i1> %m, i32 %evl)
1446 define <32 x i64> @vssubu_vi_v32i64_unmasked(<32 x i64> %va, i32 zeroext %evl) {
1447 ; RV32-LABEL: vssubu_vi_v32i64_unmasked:
1449 ; RV32-NEXT: li a2, 16
1450 ; RV32-NEXT: mv a1, a0
1451 ; RV32-NEXT: bltu a0, a2, .LBB109_2
1452 ; RV32-NEXT: # %bb.1:
1453 ; RV32-NEXT: li a1, 16
1454 ; RV32-NEXT: .LBB109_2:
1455 ; RV32-NEXT: li a2, 32
1456 ; RV32-NEXT: vsetvli zero, a2, e32, m8, ta, ma
1457 ; RV32-NEXT: vmv.v.i v24, -1
1458 ; RV32-NEXT: vsetvli zero, a1, e64, m8, ta, ma
1459 ; RV32-NEXT: vssubu.vv v8, v8, v24
1460 ; RV32-NEXT: addi a1, a0, -16
1461 ; RV32-NEXT: sltu a0, a0, a1
1462 ; RV32-NEXT: addi a0, a0, -1
1463 ; RV32-NEXT: and a0, a0, a1
1464 ; RV32-NEXT: vsetvli zero, a0, e64, m8, ta, ma
1465 ; RV32-NEXT: vssubu.vv v16, v16, v24
1468 ; RV64-LABEL: vssubu_vi_v32i64_unmasked:
1470 ; RV64-NEXT: li a2, 16
1471 ; RV64-NEXT: mv a1, a0
1472 ; RV64-NEXT: bltu a0, a2, .LBB109_2
1473 ; RV64-NEXT: # %bb.1:
1474 ; RV64-NEXT: li a1, 16
1475 ; RV64-NEXT: .LBB109_2:
1476 ; RV64-NEXT: li a2, -1
1477 ; RV64-NEXT: vsetvli zero, a1, e64, m8, ta, ma
1478 ; RV64-NEXT: vssubu.vx v8, v8, a2
1479 ; RV64-NEXT: addi a1, a0, -16
1480 ; RV64-NEXT: sltu a0, a0, a1
1481 ; RV64-NEXT: addi a0, a0, -1
1482 ; RV64-NEXT: and a0, a0, a1
1483 ; RV64-NEXT: vsetvli zero, a0, e64, m8, ta, ma
1484 ; RV64-NEXT: vssubu.vx v16, v16, a2
1486 %v = call <32 x i64> @llvm.vp.usub.sat.v32i64(<32 x i64> %va, <32 x i64> splat (i64 -1), <32 x i1> splat (i1 true), i32 %evl)
1490 ; FIXME: We don't match vssubu.vi on RV32.
1492 define <32 x i64> @vssubu_vx_v32i64_evl12(<32 x i64> %va, <32 x i1> %m) {
1493 ; RV32-LABEL: vssubu_vx_v32i64_evl12:
1495 ; RV32-NEXT: vsetivli zero, 2, e8, mf4, ta, ma
1496 ; RV32-NEXT: vslidedown.vi v7, v0, 2
1497 ; RV32-NEXT: li a0, 32
1498 ; RV32-NEXT: vsetvli zero, a0, e32, m8, ta, ma
1499 ; RV32-NEXT: vmv.v.i v24, -1
1500 ; RV32-NEXT: vsetivli zero, 12, e64, m8, ta, ma
1501 ; RV32-NEXT: vssubu.vv v8, v8, v24, v0.t
1502 ; RV32-NEXT: vmv1r.v v0, v7
1503 ; RV32-NEXT: vsetivli zero, 0, e64, m8, ta, ma
1504 ; RV32-NEXT: vssubu.vv v16, v16, v24, v0.t
1507 ; RV64-LABEL: vssubu_vx_v32i64_evl12:
1509 ; RV64-NEXT: vsetivli zero, 2, e8, mf4, ta, ma
1510 ; RV64-NEXT: vslidedown.vi v24, v0, 2
1511 ; RV64-NEXT: li a0, -1
1512 ; RV64-NEXT: vsetivli zero, 12, e64, m8, ta, ma
1513 ; RV64-NEXT: vssubu.vx v8, v8, a0, v0.t
1514 ; RV64-NEXT: vmv1r.v v0, v24
1515 ; RV64-NEXT: vsetivli zero, 0, e64, m8, ta, ma
1516 ; RV64-NEXT: vssubu.vx v16, v16, a0, v0.t
1518 %v = call <32 x i64> @llvm.vp.usub.sat.v32i64(<32 x i64> %va, <32 x i64> splat (i64 -1), <32 x i1> %m, i32 12)
1522 define <32 x i64> @vssubu_vx_v32i64_evl27(<32 x i64> %va, <32 x i1> %m) {
1523 ; RV32-LABEL: vssubu_vx_v32i64_evl27:
1525 ; RV32-NEXT: vsetivli zero, 2, e8, mf4, ta, ma
1526 ; RV32-NEXT: vslidedown.vi v7, v0, 2
1527 ; RV32-NEXT: li a0, 32
1528 ; RV32-NEXT: vsetvli zero, a0, e32, m8, ta, ma
1529 ; RV32-NEXT: vmv.v.i v24, -1
1530 ; RV32-NEXT: vsetivli zero, 16, e64, m8, ta, ma
1531 ; RV32-NEXT: vssubu.vv v8, v8, v24, v0.t
1532 ; RV32-NEXT: vmv1r.v v0, v7
1533 ; RV32-NEXT: vsetivli zero, 11, e64, m8, ta, ma
1534 ; RV32-NEXT: vssubu.vv v16, v16, v24, v0.t
1537 ; RV64-LABEL: vssubu_vx_v32i64_evl27:
1539 ; RV64-NEXT: vsetivli zero, 2, e8, mf4, ta, ma
1540 ; RV64-NEXT: vslidedown.vi v24, v0, 2
1541 ; RV64-NEXT: li a0, -1
1542 ; RV64-NEXT: vsetivli zero, 16, e64, m8, ta, ma
1543 ; RV64-NEXT: vssubu.vx v8, v8, a0, v0.t
1544 ; RV64-NEXT: vmv1r.v v0, v24
1545 ; RV64-NEXT: vsetivli zero, 11, e64, m8, ta, ma
1546 ; RV64-NEXT: vssubu.vx v16, v16, a0, v0.t
1548 %v = call <32 x i64> @llvm.vp.usub.sat.v32i64(<32 x i64> %va, <32 x i64> splat (i64 -1), <32 x i1> %m, i32 27)