1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=riscv32 -mattr=+d,+zfh,+zvfh,+v,+m -target-abi=ilp32d \
3 ; RUN: -verify-machineinstrs < %s | FileCheck %s --check-prefixes=CHECK
4 ; RUN: llc -mtriple=riscv64 -mattr=+d,+zfh,+zvfh,+v,+m -target-abi=lp64d \
5 ; RUN: -verify-machineinstrs < %s | FileCheck %s --check-prefixes=CHECK
7 declare <2 x i8> @llvm.vp.abs.v2i8(<2 x i8>, i1 immarg, <2 x i1>, i32)
9 define <2 x i8> @vp_abs_v2i8(<2 x i8> %va, <2 x i1> %m, i32 zeroext %evl) {
10 ; CHECK-LABEL: vp_abs_v2i8:
12 ; CHECK-NEXT: vsetvli zero, a0, e8, mf8, ta, ma
13 ; CHECK-NEXT: vrsub.vi v9, v8, 0, v0.t
14 ; CHECK-NEXT: vmax.vv v8, v8, v9, v0.t
16 %v = call <2 x i8> @llvm.vp.abs.v2i8(<2 x i8> %va, i1 false, <2 x i1> %m, i32 %evl)
20 define <2 x i8> @vp_abs_v2i8_unmasked(<2 x i8> %va, i32 zeroext %evl) {
21 ; CHECK-LABEL: vp_abs_v2i8_unmasked:
23 ; CHECK-NEXT: vsetvli zero, a0, e8, mf8, ta, ma
24 ; CHECK-NEXT: vrsub.vi v9, v8, 0
25 ; CHECK-NEXT: vmax.vv v8, v8, v9
27 %head = insertelement <2 x i1> poison, i1 true, i32 0
28 %m = shufflevector <2 x i1> %head, <2 x i1> poison, <2 x i32> zeroinitializer
29 %v = call <2 x i8> @llvm.vp.abs.v2i8(<2 x i8> %va, i1 false, <2 x i1> %m, i32 %evl)
33 declare <4 x i8> @llvm.vp.abs.v4i8(<4 x i8>, i1 immarg, <4 x i1>, i32)
35 define <4 x i8> @vp_abs_v4i8(<4 x i8> %va, <4 x i1> %m, i32 zeroext %evl) {
36 ; CHECK-LABEL: vp_abs_v4i8:
38 ; CHECK-NEXT: vsetvli zero, a0, e8, mf4, ta, ma
39 ; CHECK-NEXT: vrsub.vi v9, v8, 0, v0.t
40 ; CHECK-NEXT: vmax.vv v8, v8, v9, v0.t
42 %v = call <4 x i8> @llvm.vp.abs.v4i8(<4 x i8> %va, i1 false, <4 x i1> %m, i32 %evl)
46 define <4 x i8> @vp_abs_v4i8_unmasked(<4 x i8> %va, i32 zeroext %evl) {
47 ; CHECK-LABEL: vp_abs_v4i8_unmasked:
49 ; CHECK-NEXT: vsetvli zero, a0, e8, mf4, ta, ma
50 ; CHECK-NEXT: vrsub.vi v9, v8, 0
51 ; CHECK-NEXT: vmax.vv v8, v8, v9
53 %head = insertelement <4 x i1> poison, i1 true, i32 0
54 %m = shufflevector <4 x i1> %head, <4 x i1> poison, <4 x i32> zeroinitializer
55 %v = call <4 x i8> @llvm.vp.abs.v4i8(<4 x i8> %va, i1 false, <4 x i1> %m, i32 %evl)
59 declare <8 x i8> @llvm.vp.abs.v8i8(<8 x i8>, i1 immarg, <8 x i1>, i32)
61 define <8 x i8> @vp_abs_v8i8(<8 x i8> %va, <8 x i1> %m, i32 zeroext %evl) {
62 ; CHECK-LABEL: vp_abs_v8i8:
64 ; CHECK-NEXT: vsetvli zero, a0, e8, mf2, ta, ma
65 ; CHECK-NEXT: vrsub.vi v9, v8, 0, v0.t
66 ; CHECK-NEXT: vmax.vv v8, v8, v9, v0.t
68 %v = call <8 x i8> @llvm.vp.abs.v8i8(<8 x i8> %va, i1 false, <8 x i1> %m, i32 %evl)
72 define <8 x i8> @vp_abs_v8i8_unmasked(<8 x i8> %va, i32 zeroext %evl) {
73 ; CHECK-LABEL: vp_abs_v8i8_unmasked:
75 ; CHECK-NEXT: vsetvli zero, a0, e8, mf2, ta, ma
76 ; CHECK-NEXT: vrsub.vi v9, v8, 0
77 ; CHECK-NEXT: vmax.vv v8, v8, v9
79 %head = insertelement <8 x i1> poison, i1 true, i32 0
80 %m = shufflevector <8 x i1> %head, <8 x i1> poison, <8 x i32> zeroinitializer
81 %v = call <8 x i8> @llvm.vp.abs.v8i8(<8 x i8> %va, i1 false, <8 x i1> %m, i32 %evl)
85 declare <16 x i8> @llvm.vp.abs.v16i8(<16 x i8>, i1 immarg, <16 x i1>, i32)
87 define <16 x i8> @vp_abs_v16i8(<16 x i8> %va, <16 x i1> %m, i32 zeroext %evl) {
88 ; CHECK-LABEL: vp_abs_v16i8:
90 ; CHECK-NEXT: vsetvli zero, a0, e8, m1, ta, ma
91 ; CHECK-NEXT: vrsub.vi v9, v8, 0, v0.t
92 ; CHECK-NEXT: vmax.vv v8, v8, v9, v0.t
94 %v = call <16 x i8> @llvm.vp.abs.v16i8(<16 x i8> %va, i1 false, <16 x i1> %m, i32 %evl)
98 define <16 x i8> @vp_abs_v16i8_unmasked(<16 x i8> %va, i32 zeroext %evl) {
99 ; CHECK-LABEL: vp_abs_v16i8_unmasked:
101 ; CHECK-NEXT: vsetvli zero, a0, e8, m1, ta, ma
102 ; CHECK-NEXT: vrsub.vi v9, v8, 0
103 ; CHECK-NEXT: vmax.vv v8, v8, v9
105 %head = insertelement <16 x i1> poison, i1 true, i32 0
106 %m = shufflevector <16 x i1> %head, <16 x i1> poison, <16 x i32> zeroinitializer
107 %v = call <16 x i8> @llvm.vp.abs.v16i8(<16 x i8> %va, i1 false, <16 x i1> %m, i32 %evl)
111 declare <2 x i16> @llvm.vp.abs.v2i16(<2 x i16>, i1 immarg, <2 x i1>, i32)
113 define <2 x i16> @vp_abs_v2i16(<2 x i16> %va, <2 x i1> %m, i32 zeroext %evl) {
114 ; CHECK-LABEL: vp_abs_v2i16:
116 ; CHECK-NEXT: vsetvli zero, a0, e16, mf4, ta, ma
117 ; CHECK-NEXT: vrsub.vi v9, v8, 0, v0.t
118 ; CHECK-NEXT: vmax.vv v8, v8, v9, v0.t
120 %v = call <2 x i16> @llvm.vp.abs.v2i16(<2 x i16> %va, i1 false, <2 x i1> %m, i32 %evl)
124 define <2 x i16> @vp_abs_v2i16_unmasked(<2 x i16> %va, i32 zeroext %evl) {
125 ; CHECK-LABEL: vp_abs_v2i16_unmasked:
127 ; CHECK-NEXT: vsetvli zero, a0, e16, mf4, ta, ma
128 ; CHECK-NEXT: vrsub.vi v9, v8, 0
129 ; CHECK-NEXT: vmax.vv v8, v8, v9
131 %head = insertelement <2 x i1> poison, i1 true, i32 0
132 %m = shufflevector <2 x i1> %head, <2 x i1> poison, <2 x i32> zeroinitializer
133 %v = call <2 x i16> @llvm.vp.abs.v2i16(<2 x i16> %va, i1 false, <2 x i1> %m, i32 %evl)
137 declare <4 x i16> @llvm.vp.abs.v4i16(<4 x i16>, i1 immarg, <4 x i1>, i32)
139 define <4 x i16> @vp_abs_v4i16(<4 x i16> %va, <4 x i1> %m, i32 zeroext %evl) {
140 ; CHECK-LABEL: vp_abs_v4i16:
142 ; CHECK-NEXT: vsetvli zero, a0, e16, mf2, ta, ma
143 ; CHECK-NEXT: vrsub.vi v9, v8, 0, v0.t
144 ; CHECK-NEXT: vmax.vv v8, v8, v9, v0.t
146 %v = call <4 x i16> @llvm.vp.abs.v4i16(<4 x i16> %va, i1 false, <4 x i1> %m, i32 %evl)
150 define <4 x i16> @vp_abs_v4i16_unmasked(<4 x i16> %va, i32 zeroext %evl) {
151 ; CHECK-LABEL: vp_abs_v4i16_unmasked:
153 ; CHECK-NEXT: vsetvli zero, a0, e16, mf2, ta, ma
154 ; CHECK-NEXT: vrsub.vi v9, v8, 0
155 ; CHECK-NEXT: vmax.vv v8, v8, v9
157 %head = insertelement <4 x i1> poison, i1 true, i32 0
158 %m = shufflevector <4 x i1> %head, <4 x i1> poison, <4 x i32> zeroinitializer
159 %v = call <4 x i16> @llvm.vp.abs.v4i16(<4 x i16> %va, i1 false, <4 x i1> %m, i32 %evl)
163 declare <8 x i16> @llvm.vp.abs.v8i16(<8 x i16>, i1 immarg, <8 x i1>, i32)
165 define <8 x i16> @vp_abs_v8i16(<8 x i16> %va, <8 x i1> %m, i32 zeroext %evl) {
166 ; CHECK-LABEL: vp_abs_v8i16:
168 ; CHECK-NEXT: vsetvli zero, a0, e16, m1, ta, ma
169 ; CHECK-NEXT: vrsub.vi v9, v8, 0, v0.t
170 ; CHECK-NEXT: vmax.vv v8, v8, v9, v0.t
172 %v = call <8 x i16> @llvm.vp.abs.v8i16(<8 x i16> %va, i1 false, <8 x i1> %m, i32 %evl)
176 define <8 x i16> @vp_abs_v8i16_unmasked(<8 x i16> %va, i32 zeroext %evl) {
177 ; CHECK-LABEL: vp_abs_v8i16_unmasked:
179 ; CHECK-NEXT: vsetvli zero, a0, e16, m1, ta, ma
180 ; CHECK-NEXT: vrsub.vi v9, v8, 0
181 ; CHECK-NEXT: vmax.vv v8, v8, v9
183 %head = insertelement <8 x i1> poison, i1 true, i32 0
184 %m = shufflevector <8 x i1> %head, <8 x i1> poison, <8 x i32> zeroinitializer
185 %v = call <8 x i16> @llvm.vp.abs.v8i16(<8 x i16> %va, i1 false, <8 x i1> %m, i32 %evl)
189 declare <16 x i16> @llvm.vp.abs.v16i16(<16 x i16>, i1 immarg, <16 x i1>, i32)
191 define <16 x i16> @vp_abs_v16i16(<16 x i16> %va, <16 x i1> %m, i32 zeroext %evl) {
192 ; CHECK-LABEL: vp_abs_v16i16:
194 ; CHECK-NEXT: vsetvli zero, a0, e16, m2, ta, ma
195 ; CHECK-NEXT: vrsub.vi v10, v8, 0, v0.t
196 ; CHECK-NEXT: vmax.vv v8, v8, v10, v0.t
198 %v = call <16 x i16> @llvm.vp.abs.v16i16(<16 x i16> %va, i1 false, <16 x i1> %m, i32 %evl)
202 define <16 x i16> @vp_abs_v16i16_unmasked(<16 x i16> %va, i32 zeroext %evl) {
203 ; CHECK-LABEL: vp_abs_v16i16_unmasked:
205 ; CHECK-NEXT: vsetvli zero, a0, e16, m2, ta, ma
206 ; CHECK-NEXT: vrsub.vi v10, v8, 0
207 ; CHECK-NEXT: vmax.vv v8, v8, v10
209 %head = insertelement <16 x i1> poison, i1 true, i32 0
210 %m = shufflevector <16 x i1> %head, <16 x i1> poison, <16 x i32> zeroinitializer
211 %v = call <16 x i16> @llvm.vp.abs.v16i16(<16 x i16> %va, i1 false, <16 x i1> %m, i32 %evl)
215 declare <2 x i32> @llvm.vp.abs.v2i32(<2 x i32>, i1 immarg, <2 x i1>, i32)
217 define <2 x i32> @vp_abs_v2i32(<2 x i32> %va, <2 x i1> %m, i32 zeroext %evl) {
218 ; CHECK-LABEL: vp_abs_v2i32:
220 ; CHECK-NEXT: vsetvli zero, a0, e32, mf2, ta, ma
221 ; CHECK-NEXT: vrsub.vi v9, v8, 0, v0.t
222 ; CHECK-NEXT: vmax.vv v8, v8, v9, v0.t
224 %v = call <2 x i32> @llvm.vp.abs.v2i32(<2 x i32> %va, i1 false, <2 x i1> %m, i32 %evl)
228 define <2 x i32> @vp_abs_v2i32_unmasked(<2 x i32> %va, i32 zeroext %evl) {
229 ; CHECK-LABEL: vp_abs_v2i32_unmasked:
231 ; CHECK-NEXT: vsetvli zero, a0, e32, mf2, ta, ma
232 ; CHECK-NEXT: vrsub.vi v9, v8, 0
233 ; CHECK-NEXT: vmax.vv v8, v8, v9
235 %head = insertelement <2 x i1> poison, i1 true, i32 0
236 %m = shufflevector <2 x i1> %head, <2 x i1> poison, <2 x i32> zeroinitializer
237 %v = call <2 x i32> @llvm.vp.abs.v2i32(<2 x i32> %va, i1 false, <2 x i1> %m, i32 %evl)
241 declare <4 x i32> @llvm.vp.abs.v4i32(<4 x i32>, i1 immarg, <4 x i1>, i32)
243 define <4 x i32> @vp_abs_v4i32(<4 x i32> %va, <4 x i1> %m, i32 zeroext %evl) {
244 ; CHECK-LABEL: vp_abs_v4i32:
246 ; CHECK-NEXT: vsetvli zero, a0, e32, m1, ta, ma
247 ; CHECK-NEXT: vrsub.vi v9, v8, 0, v0.t
248 ; CHECK-NEXT: vmax.vv v8, v8, v9, v0.t
250 %v = call <4 x i32> @llvm.vp.abs.v4i32(<4 x i32> %va, i1 false, <4 x i1> %m, i32 %evl)
254 define <4 x i32> @vp_abs_v4i32_unmasked(<4 x i32> %va, i32 zeroext %evl) {
255 ; CHECK-LABEL: vp_abs_v4i32_unmasked:
257 ; CHECK-NEXT: vsetvli zero, a0, e32, m1, ta, ma
258 ; CHECK-NEXT: vrsub.vi v9, v8, 0
259 ; CHECK-NEXT: vmax.vv v8, v8, v9
261 %head = insertelement <4 x i1> poison, i1 true, i32 0
262 %m = shufflevector <4 x i1> %head, <4 x i1> poison, <4 x i32> zeroinitializer
263 %v = call <4 x i32> @llvm.vp.abs.v4i32(<4 x i32> %va, i1 false, <4 x i1> %m, i32 %evl)
267 declare <8 x i32> @llvm.vp.abs.v8i32(<8 x i32>, i1 immarg, <8 x i1>, i32)
269 define <8 x i32> @vp_abs_v8i32(<8 x i32> %va, <8 x i1> %m, i32 zeroext %evl) {
270 ; CHECK-LABEL: vp_abs_v8i32:
272 ; CHECK-NEXT: vsetvli zero, a0, e32, m2, ta, ma
273 ; CHECK-NEXT: vrsub.vi v10, v8, 0, v0.t
274 ; CHECK-NEXT: vmax.vv v8, v8, v10, v0.t
276 %v = call <8 x i32> @llvm.vp.abs.v8i32(<8 x i32> %va, i1 false, <8 x i1> %m, i32 %evl)
280 define <8 x i32> @vp_abs_v8i32_unmasked(<8 x i32> %va, i32 zeroext %evl) {
281 ; CHECK-LABEL: vp_abs_v8i32_unmasked:
283 ; CHECK-NEXT: vsetvli zero, a0, e32, m2, ta, ma
284 ; CHECK-NEXT: vrsub.vi v10, v8, 0
285 ; CHECK-NEXT: vmax.vv v8, v8, v10
287 %head = insertelement <8 x i1> poison, i1 true, i32 0
288 %m = shufflevector <8 x i1> %head, <8 x i1> poison, <8 x i32> zeroinitializer
289 %v = call <8 x i32> @llvm.vp.abs.v8i32(<8 x i32> %va, i1 false, <8 x i1> %m, i32 %evl)
293 declare <16 x i32> @llvm.vp.abs.v16i32(<16 x i32>, i1 immarg, <16 x i1>, i32)
295 define <16 x i32> @vp_abs_v16i32(<16 x i32> %va, <16 x i1> %m, i32 zeroext %evl) {
296 ; CHECK-LABEL: vp_abs_v16i32:
298 ; CHECK-NEXT: vsetvli zero, a0, e32, m4, ta, ma
299 ; CHECK-NEXT: vrsub.vi v12, v8, 0, v0.t
300 ; CHECK-NEXT: vmax.vv v8, v8, v12, v0.t
302 %v = call <16 x i32> @llvm.vp.abs.v16i32(<16 x i32> %va, i1 false, <16 x i1> %m, i32 %evl)
306 define <16 x i32> @vp_abs_v16i32_unmasked(<16 x i32> %va, i32 zeroext %evl) {
307 ; CHECK-LABEL: vp_abs_v16i32_unmasked:
309 ; CHECK-NEXT: vsetvli zero, a0, e32, m4, ta, ma
310 ; CHECK-NEXT: vrsub.vi v12, v8, 0
311 ; CHECK-NEXT: vmax.vv v8, v8, v12
313 %head = insertelement <16 x i1> poison, i1 true, i32 0
314 %m = shufflevector <16 x i1> %head, <16 x i1> poison, <16 x i32> zeroinitializer
315 %v = call <16 x i32> @llvm.vp.abs.v16i32(<16 x i32> %va, i1 false, <16 x i1> %m, i32 %evl)
319 declare <2 x i64> @llvm.vp.abs.v2i64(<2 x i64>, i1 immarg, <2 x i1>, i32)
321 define <2 x i64> @vp_abs_v2i64(<2 x i64> %va, <2 x i1> %m, i32 zeroext %evl) {
322 ; CHECK-LABEL: vp_abs_v2i64:
324 ; CHECK-NEXT: vsetvli zero, a0, e64, m1, ta, ma
325 ; CHECK-NEXT: vrsub.vi v9, v8, 0, v0.t
326 ; CHECK-NEXT: vmax.vv v8, v8, v9, v0.t
328 %v = call <2 x i64> @llvm.vp.abs.v2i64(<2 x i64> %va, i1 false, <2 x i1> %m, i32 %evl)
332 define <2 x i64> @vp_abs_v2i64_unmasked(<2 x i64> %va, i32 zeroext %evl) {
333 ; CHECK-LABEL: vp_abs_v2i64_unmasked:
335 ; CHECK-NEXT: vsetvli zero, a0, e64, m1, ta, ma
336 ; CHECK-NEXT: vrsub.vi v9, v8, 0
337 ; CHECK-NEXT: vmax.vv v8, v8, v9
339 %head = insertelement <2 x i1> poison, i1 true, i32 0
340 %m = shufflevector <2 x i1> %head, <2 x i1> poison, <2 x i32> zeroinitializer
341 %v = call <2 x i64> @llvm.vp.abs.v2i64(<2 x i64> %va, i1 false, <2 x i1> %m, i32 %evl)
345 declare <4 x i64> @llvm.vp.abs.v4i64(<4 x i64>, i1 immarg, <4 x i1>, i32)
347 define <4 x i64> @vp_abs_v4i64(<4 x i64> %va, <4 x i1> %m, i32 zeroext %evl) {
348 ; CHECK-LABEL: vp_abs_v4i64:
350 ; CHECK-NEXT: vsetvli zero, a0, e64, m2, ta, ma
351 ; CHECK-NEXT: vrsub.vi v10, v8, 0, v0.t
352 ; CHECK-NEXT: vmax.vv v8, v8, v10, v0.t
354 %v = call <4 x i64> @llvm.vp.abs.v4i64(<4 x i64> %va, i1 false, <4 x i1> %m, i32 %evl)
358 define <4 x i64> @vp_abs_v4i64_unmasked(<4 x i64> %va, i32 zeroext %evl) {
359 ; CHECK-LABEL: vp_abs_v4i64_unmasked:
361 ; CHECK-NEXT: vsetvli zero, a0, e64, m2, ta, ma
362 ; CHECK-NEXT: vrsub.vi v10, v8, 0
363 ; CHECK-NEXT: vmax.vv v8, v8, v10
365 %head = insertelement <4 x i1> poison, i1 true, i32 0
366 %m = shufflevector <4 x i1> %head, <4 x i1> poison, <4 x i32> zeroinitializer
367 %v = call <4 x i64> @llvm.vp.abs.v4i64(<4 x i64> %va, i1 false, <4 x i1> %m, i32 %evl)
371 declare <8 x i64> @llvm.vp.abs.v8i64(<8 x i64>, i1 immarg, <8 x i1>, i32)
373 define <8 x i64> @vp_abs_v8i64(<8 x i64> %va, <8 x i1> %m, i32 zeroext %evl) {
374 ; CHECK-LABEL: vp_abs_v8i64:
376 ; CHECK-NEXT: vsetvli zero, a0, e64, m4, ta, ma
377 ; CHECK-NEXT: vrsub.vi v12, v8, 0, v0.t
378 ; CHECK-NEXT: vmax.vv v8, v8, v12, v0.t
380 %v = call <8 x i64> @llvm.vp.abs.v8i64(<8 x i64> %va, i1 false, <8 x i1> %m, i32 %evl)
384 define <8 x i64> @vp_abs_v8i64_unmasked(<8 x i64> %va, i32 zeroext %evl) {
385 ; CHECK-LABEL: vp_abs_v8i64_unmasked:
387 ; CHECK-NEXT: vsetvli zero, a0, e64, m4, ta, ma
388 ; CHECK-NEXT: vrsub.vi v12, v8, 0
389 ; CHECK-NEXT: vmax.vv v8, v8, v12
391 %head = insertelement <8 x i1> poison, i1 true, i32 0
392 %m = shufflevector <8 x i1> %head, <8 x i1> poison, <8 x i32> zeroinitializer
393 %v = call <8 x i64> @llvm.vp.abs.v8i64(<8 x i64> %va, i1 false, <8 x i1> %m, i32 %evl)
397 declare <15 x i64> @llvm.vp.abs.v15i64(<15 x i64>, i1 immarg, <15 x i1>, i32)
399 define <15 x i64> @vp_abs_v15i64(<15 x i64> %va, <15 x i1> %m, i32 zeroext %evl) {
400 ; CHECK-LABEL: vp_abs_v15i64:
402 ; CHECK-NEXT: vsetvli zero, a0, e64, m8, ta, ma
403 ; CHECK-NEXT: vrsub.vi v16, v8, 0, v0.t
404 ; CHECK-NEXT: vmax.vv v8, v8, v16, v0.t
406 %v = call <15 x i64> @llvm.vp.abs.v15i64(<15 x i64> %va, i1 false, <15 x i1> %m, i32 %evl)
410 define <15 x i64> @vp_abs_v15i64_unmasked(<15 x i64> %va, i32 zeroext %evl) {
411 ; CHECK-LABEL: vp_abs_v15i64_unmasked:
413 ; CHECK-NEXT: vsetvli zero, a0, e64, m8, ta, ma
414 ; CHECK-NEXT: vrsub.vi v16, v8, 0
415 ; CHECK-NEXT: vmax.vv v8, v8, v16
417 %head = insertelement <15 x i1> poison, i1 true, i32 0
418 %m = shufflevector <15 x i1> %head, <15 x i1> poison, <15 x i32> zeroinitializer
419 %v = call <15 x i64> @llvm.vp.abs.v15i64(<15 x i64> %va, i1 false, <15 x i1> %m, i32 %evl)
423 declare <16 x i64> @llvm.vp.abs.v16i64(<16 x i64>, i1 immarg, <16 x i1>, i32)
425 define <16 x i64> @vp_abs_v16i64(<16 x i64> %va, <16 x i1> %m, i32 zeroext %evl) {
426 ; CHECK-LABEL: vp_abs_v16i64:
428 ; CHECK-NEXT: vsetvli zero, a0, e64, m8, ta, ma
429 ; CHECK-NEXT: vrsub.vi v16, v8, 0, v0.t
430 ; CHECK-NEXT: vmax.vv v8, v8, v16, v0.t
432 %v = call <16 x i64> @llvm.vp.abs.v16i64(<16 x i64> %va, i1 false, <16 x i1> %m, i32 %evl)
436 define <16 x i64> @vp_abs_v16i64_unmasked(<16 x i64> %va, i32 zeroext %evl) {
437 ; CHECK-LABEL: vp_abs_v16i64_unmasked:
439 ; CHECK-NEXT: vsetvli zero, a0, e64, m8, ta, ma
440 ; CHECK-NEXT: vrsub.vi v16, v8, 0
441 ; CHECK-NEXT: vmax.vv v8, v8, v16
443 %head = insertelement <16 x i1> poison, i1 true, i32 0
444 %m = shufflevector <16 x i1> %head, <16 x i1> poison, <16 x i32> zeroinitializer
445 %v = call <16 x i64> @llvm.vp.abs.v16i64(<16 x i64> %va, i1 false, <16 x i1> %m, i32 %evl)
449 declare <32 x i64> @llvm.vp.abs.v32i64(<32 x i64>, i1 immarg, <32 x i1>, i32)
451 define <32 x i64> @vp_abs_v32i64(<32 x i64> %va, <32 x i1> %m, i32 zeroext %evl) {
452 ; CHECK-LABEL: vp_abs_v32i64:
454 ; CHECK-NEXT: vsetivli zero, 2, e8, mf4, ta, ma
455 ; CHECK-NEXT: li a2, 16
456 ; CHECK-NEXT: vslidedown.vi v1, v0, 2
457 ; CHECK-NEXT: mv a1, a0
458 ; CHECK-NEXT: bltu a0, a2, .LBB34_2
459 ; CHECK-NEXT: # %bb.1:
460 ; CHECK-NEXT: li a1, 16
461 ; CHECK-NEXT: .LBB34_2:
462 ; CHECK-NEXT: vsetvli zero, a1, e64, m8, ta, ma
463 ; CHECK-NEXT: vrsub.vi v24, v8, 0, v0.t
464 ; CHECK-NEXT: vmax.vv v8, v8, v24, v0.t
465 ; CHECK-NEXT: addi a1, a0, -16
466 ; CHECK-NEXT: sltu a0, a0, a1
467 ; CHECK-NEXT: addi a0, a0, -1
468 ; CHECK-NEXT: and a0, a0, a1
469 ; CHECK-NEXT: vsetvli zero, a0, e64, m8, ta, ma
470 ; CHECK-NEXT: vmv1r.v v0, v1
471 ; CHECK-NEXT: vrsub.vi v24, v16, 0, v0.t
472 ; CHECK-NEXT: vmax.vv v16, v16, v24, v0.t
474 %v = call <32 x i64> @llvm.vp.abs.v32i64(<32 x i64> %va, i1 false, <32 x i1> %m, i32 %evl)
478 define <32 x i64> @vp_abs_v32i64_unmasked(<32 x i64> %va, i32 zeroext %evl) {
479 ; CHECK-LABEL: vp_abs_v32i64_unmasked:
481 ; CHECK-NEXT: li a2, 16
482 ; CHECK-NEXT: mv a1, a0
483 ; CHECK-NEXT: bltu a0, a2, .LBB35_2
484 ; CHECK-NEXT: # %bb.1:
485 ; CHECK-NEXT: li a1, 16
486 ; CHECK-NEXT: .LBB35_2:
487 ; CHECK-NEXT: vsetvli zero, a1, e64, m8, ta, ma
488 ; CHECK-NEXT: vrsub.vi v24, v8, 0
489 ; CHECK-NEXT: vmax.vv v8, v8, v24
490 ; CHECK-NEXT: addi a1, a0, -16
491 ; CHECK-NEXT: sltu a0, a0, a1
492 ; CHECK-NEXT: addi a0, a0, -1
493 ; CHECK-NEXT: and a0, a0, a1
494 ; CHECK-NEXT: vsetvli zero, a0, e64, m8, ta, ma
495 ; CHECK-NEXT: vrsub.vi v24, v16, 0
496 ; CHECK-NEXT: vmax.vv v16, v16, v24
498 %head = insertelement <32 x i1> poison, i1 true, i32 0
499 %m = shufflevector <32 x i1> %head, <32 x i1> poison, <32 x i32> zeroinitializer
500 %v = call <32 x i64> @llvm.vp.abs.v32i64(<32 x i64> %va, i1 false, <32 x i1> %m, i32 %evl)