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.smax.v8i7(<8 x i7>, <8 x i7>, <8 x i1>, i32)
9 define <8 x i7> @vmax_vv_v8i7(<8 x i7> %va, <8 x i7> %b, <8 x i1> %m, i32 zeroext %evl) {
10 ; CHECK-LABEL: vmax_vv_v8i7:
12 ; CHECK-NEXT: vsetvli zero, a0, e8, mf2, ta, ma
13 ; CHECK-NEXT: vsll.vi v9, v9, 1, v0.t
14 ; CHECK-NEXT: vsra.vi v9, v9, 1, v0.t
15 ; CHECK-NEXT: vsll.vi v8, v8, 1, v0.t
16 ; CHECK-NEXT: vsra.vi v8, v8, 1, v0.t
17 ; CHECK-NEXT: vmax.vv v8, v8, v9, v0.t
19 %v = call <8 x i7> @llvm.vp.smax.v8i7(<8 x i7> %va, <8 x i7> %b, <8 x i1> %m, i32 %evl)
23 declare <2 x i8> @llvm.vp.smax.v2i8(<2 x i8>, <2 x i8>, <2 x i1>, i32)
25 define <2 x i8> @vmax_vv_v2i8(<2 x i8> %va, <2 x i8> %b, <2 x i1> %m, i32 zeroext %evl) {
26 ; CHECK-LABEL: vmax_vv_v2i8:
28 ; CHECK-NEXT: vsetvli zero, a0, e8, mf8, ta, ma
29 ; CHECK-NEXT: vmax.vv v8, v8, v9, v0.t
31 %v = call <2 x i8> @llvm.vp.smax.v2i8(<2 x i8> %va, <2 x i8> %b, <2 x i1> %m, i32 %evl)
35 define <2 x i8> @vmax_vv_v2i8_unmasked(<2 x i8> %va, <2 x i8> %b, i32 zeroext %evl) {
36 ; CHECK-LABEL: vmax_vv_v2i8_unmasked:
38 ; CHECK-NEXT: vsetvli zero, a0, e8, mf8, ta, ma
39 ; CHECK-NEXT: vmax.vv v8, v8, v9
41 %v = call <2 x i8> @llvm.vp.smax.v2i8(<2 x i8> %va, <2 x i8> %b, <2 x i1> splat (i1 true), i32 %evl)
45 define <2 x i8> @vmax_vx_v2i8(<2 x i8> %va, i8 %b, <2 x i1> %m, i32 zeroext %evl) {
46 ; CHECK-LABEL: vmax_vx_v2i8:
48 ; CHECK-NEXT: vsetvli zero, a1, e8, mf8, ta, ma
49 ; CHECK-NEXT: vmax.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.smax.v2i8(<2 x i8> %va, <2 x i8> %vb, <2 x i1> %m, i32 %evl)
57 define <2 x i8> @vmax_vx_v2i8_unmasked(<2 x i8> %va, i8 %b, i32 zeroext %evl) {
58 ; CHECK-LABEL: vmax_vx_v2i8_unmasked:
60 ; CHECK-NEXT: vsetvli zero, a1, e8, mf8, ta, ma
61 ; CHECK-NEXT: vmax.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.smax.v2i8(<2 x i8> %va, <2 x i8> %vb, <2 x i1> splat (i1 true), i32 %evl)
69 declare <4 x i8> @llvm.vp.smax.v4i8(<4 x i8>, <4 x i8>, <4 x i1>, i32)
71 define <4 x i8> @vmax_vv_v4i8(<4 x i8> %va, <4 x i8> %b, <4 x i1> %m, i32 zeroext %evl) {
72 ; CHECK-LABEL: vmax_vv_v4i8:
74 ; CHECK-NEXT: vsetvli zero, a0, e8, mf4, ta, ma
75 ; CHECK-NEXT: vmax.vv v8, v8, v9, v0.t
77 %v = call <4 x i8> @llvm.vp.smax.v4i8(<4 x i8> %va, <4 x i8> %b, <4 x i1> %m, i32 %evl)
81 define <4 x i8> @vmax_vv_v4i8_unmasked(<4 x i8> %va, <4 x i8> %b, i32 zeroext %evl) {
82 ; CHECK-LABEL: vmax_vv_v4i8_unmasked:
84 ; CHECK-NEXT: vsetvli zero, a0, e8, mf4, ta, ma
85 ; CHECK-NEXT: vmax.vv v8, v8, v9
87 %v = call <4 x i8> @llvm.vp.smax.v4i8(<4 x i8> %va, <4 x i8> %b, <4 x i1> splat (i1 true), i32 %evl)
91 define <4 x i8> @vmax_vx_v4i8(<4 x i8> %va, i8 %b, <4 x i1> %m, i32 zeroext %evl) {
92 ; CHECK-LABEL: vmax_vx_v4i8:
94 ; CHECK-NEXT: vsetvli zero, a1, e8, mf4, ta, ma
95 ; CHECK-NEXT: vmax.vx v8, v8, a0, v0.t
97 %elt.head = insertelement <4 x i8> poison, i8 %b, i32 0
98 %vb = shufflevector <4 x i8> %elt.head, <4 x i8> poison, <4 x i32> zeroinitializer
99 %v = call <4 x i8> @llvm.vp.smax.v4i8(<4 x i8> %va, <4 x i8> %vb, <4 x i1> %m, i32 %evl)
103 define <4 x i8> @vmax_vx_v4i8_commute(<4 x i8> %va, i8 %b, <4 x i1> %m, i32 zeroext %evl) {
104 ; CHECK-LABEL: vmax_vx_v4i8_commute:
106 ; CHECK-NEXT: vsetvli zero, a1, e8, mf4, ta, ma
107 ; CHECK-NEXT: vmax.vx v8, v8, a0, v0.t
109 %elt.head = insertelement <4 x i8> poison, i8 %b, i32 0
110 %vb = shufflevector <4 x i8> %elt.head, <4 x i8> poison, <4 x i32> zeroinitializer
111 %v = call <4 x i8> @llvm.vp.smax.v4i8(<4 x i8> %vb, <4 x i8> %va, <4 x i1> %m, i32 %evl)
115 define <4 x i8> @vmax_vx_v4i8_unmasked(<4 x i8> %va, i8 %b, i32 zeroext %evl) {
116 ; CHECK-LABEL: vmax_vx_v4i8_unmasked:
118 ; CHECK-NEXT: vsetvli zero, a1, e8, mf4, ta, ma
119 ; CHECK-NEXT: vmax.vx v8, v8, a0
121 %elt.head = insertelement <4 x i8> poison, i8 %b, i32 0
122 %vb = shufflevector <4 x i8> %elt.head, <4 x i8> poison, <4 x i32> zeroinitializer
123 %v = call <4 x i8> @llvm.vp.smax.v4i8(<4 x i8> %va, <4 x i8> %vb, <4 x i1> splat (i1 true), i32 %evl)
127 declare <5 x i8> @llvm.vp.smax.v5i8(<5 x i8>, <5 x i8>, <5 x i1>, i32)
129 define <5 x i8> @vmax_vv_v5i8(<5 x i8> %va, <5 x i8> %b, <5 x i1> %m, i32 zeroext %evl) {
130 ; CHECK-LABEL: vmax_vv_v5i8:
132 ; CHECK-NEXT: vsetvli zero, a0, e8, mf2, ta, ma
133 ; CHECK-NEXT: vmax.vv v8, v8, v9, v0.t
135 %v = call <5 x i8> @llvm.vp.smax.v5i8(<5 x i8> %va, <5 x i8> %b, <5 x i1> %m, i32 %evl)
139 define <5 x i8> @vmax_vv_v5i8_unmasked(<5 x i8> %va, <5 x i8> %b, i32 zeroext %evl) {
140 ; CHECK-LABEL: vmax_vv_v5i8_unmasked:
142 ; CHECK-NEXT: vsetvli zero, a0, e8, mf2, ta, ma
143 ; CHECK-NEXT: vmax.vv v8, v8, v9
145 %v = call <5 x i8> @llvm.vp.smax.v5i8(<5 x i8> %va, <5 x i8> %b, <5 x i1> splat (i1 true), i32 %evl)
149 define <5 x i8> @vmax_vx_v5i8(<5 x i8> %va, i8 %b, <5 x i1> %m, i32 zeroext %evl) {
150 ; CHECK-LABEL: vmax_vx_v5i8:
152 ; CHECK-NEXT: vsetvli zero, a1, e8, mf2, ta, ma
153 ; CHECK-NEXT: vmax.vx v8, v8, a0, v0.t
155 %elt.head = insertelement <5 x i8> poison, i8 %b, i32 0
156 %vb = shufflevector <5 x i8> %elt.head, <5 x i8> poison, <5 x i32> zeroinitializer
157 %v = call <5 x i8> @llvm.vp.smax.v5i8(<5 x i8> %va, <5 x i8> %vb, <5 x i1> %m, i32 %evl)
161 define <5 x i8> @vmax_vx_v5i8_unmasked(<5 x i8> %va, i8 %b, i32 zeroext %evl) {
162 ; CHECK-LABEL: vmax_vx_v5i8_unmasked:
164 ; CHECK-NEXT: vsetvli zero, a1, e8, mf2, ta, ma
165 ; CHECK-NEXT: vmax.vx v8, v8, a0
167 %elt.head = insertelement <5 x i8> poison, i8 %b, i32 0
168 %vb = shufflevector <5 x i8> %elt.head, <5 x i8> poison, <5 x i32> zeroinitializer
169 %v = call <5 x i8> @llvm.vp.smax.v5i8(<5 x i8> %va, <5 x i8> %vb, <5 x i1> splat (i1 true), i32 %evl)
173 declare <8 x i8> @llvm.vp.smax.v8i8(<8 x i8>, <8 x i8>, <8 x i1>, i32)
175 define <8 x i8> @vmax_vv_v8i8(<8 x i8> %va, <8 x i8> %b, <8 x i1> %m, i32 zeroext %evl) {
176 ; CHECK-LABEL: vmax_vv_v8i8:
178 ; CHECK-NEXT: vsetvli zero, a0, e8, mf2, ta, ma
179 ; CHECK-NEXT: vmax.vv v8, v8, v9, v0.t
181 %v = call <8 x i8> @llvm.vp.smax.v8i8(<8 x i8> %va, <8 x i8> %b, <8 x i1> %m, i32 %evl)
185 define <8 x i8> @vmax_vv_v8i8_unmasked(<8 x i8> %va, <8 x i8> %b, i32 zeroext %evl) {
186 ; CHECK-LABEL: vmax_vv_v8i8_unmasked:
188 ; CHECK-NEXT: vsetvli zero, a0, e8, mf2, ta, ma
189 ; CHECK-NEXT: vmax.vv v8, v8, v9
191 %v = call <8 x i8> @llvm.vp.smax.v8i8(<8 x i8> %va, <8 x i8> %b, <8 x i1> splat (i1 true), i32 %evl)
195 define <8 x i8> @vmax_vx_v8i8(<8 x i8> %va, i8 %b, <8 x i1> %m, i32 zeroext %evl) {
196 ; CHECK-LABEL: vmax_vx_v8i8:
198 ; CHECK-NEXT: vsetvli zero, a1, e8, mf2, ta, ma
199 ; CHECK-NEXT: vmax.vx v8, v8, a0, v0.t
201 %elt.head = insertelement <8 x i8> poison, i8 %b, i32 0
202 %vb = shufflevector <8 x i8> %elt.head, <8 x i8> poison, <8 x i32> zeroinitializer
203 %v = call <8 x i8> @llvm.vp.smax.v8i8(<8 x i8> %va, <8 x i8> %vb, <8 x i1> %m, i32 %evl)
207 define <8 x i8> @vmax_vx_v8i8_unmasked(<8 x i8> %va, i8 %b, i32 zeroext %evl) {
208 ; CHECK-LABEL: vmax_vx_v8i8_unmasked:
210 ; CHECK-NEXT: vsetvli zero, a1, e8, mf2, ta, ma
211 ; CHECK-NEXT: vmax.vx v8, v8, a0
213 %elt.head = insertelement <8 x i8> poison, i8 %b, i32 0
214 %vb = shufflevector <8 x i8> %elt.head, <8 x i8> poison, <8 x i32> zeroinitializer
215 %v = call <8 x i8> @llvm.vp.smax.v8i8(<8 x i8> %va, <8 x i8> %vb, <8 x i1> splat (i1 true), i32 %evl)
219 declare <16 x i8> @llvm.vp.smax.v16i8(<16 x i8>, <16 x i8>, <16 x i1>, i32)
221 define <16 x i8> @vmax_vv_v16i8(<16 x i8> %va, <16 x i8> %b, <16 x i1> %m, i32 zeroext %evl) {
222 ; CHECK-LABEL: vmax_vv_v16i8:
224 ; CHECK-NEXT: vsetvli zero, a0, e8, m1, ta, ma
225 ; CHECK-NEXT: vmax.vv v8, v8, v9, v0.t
227 %v = call <16 x i8> @llvm.vp.smax.v16i8(<16 x i8> %va, <16 x i8> %b, <16 x i1> %m, i32 %evl)
231 define <16 x i8> @vmax_vv_v16i8_unmasked(<16 x i8> %va, <16 x i8> %b, i32 zeroext %evl) {
232 ; CHECK-LABEL: vmax_vv_v16i8_unmasked:
234 ; CHECK-NEXT: vsetvli zero, a0, e8, m1, ta, ma
235 ; CHECK-NEXT: vmax.vv v8, v8, v9
237 %v = call <16 x i8> @llvm.vp.smax.v16i8(<16 x i8> %va, <16 x i8> %b, <16 x i1> splat (i1 true), i32 %evl)
241 define <16 x i8> @vmax_vx_v16i8(<16 x i8> %va, i8 %b, <16 x i1> %m, i32 zeroext %evl) {
242 ; CHECK-LABEL: vmax_vx_v16i8:
244 ; CHECK-NEXT: vsetvli zero, a1, e8, m1, ta, ma
245 ; CHECK-NEXT: vmax.vx v8, v8, a0, v0.t
247 %elt.head = insertelement <16 x i8> poison, i8 %b, i32 0
248 %vb = shufflevector <16 x i8> %elt.head, <16 x i8> poison, <16 x i32> zeroinitializer
249 %v = call <16 x i8> @llvm.vp.smax.v16i8(<16 x i8> %va, <16 x i8> %vb, <16 x i1> %m, i32 %evl)
253 define <16 x i8> @vmax_vx_v16i8_unmasked(<16 x i8> %va, i8 %b, i32 zeroext %evl) {
254 ; CHECK-LABEL: vmax_vx_v16i8_unmasked:
256 ; CHECK-NEXT: vsetvli zero, a1, e8, m1, ta, ma
257 ; CHECK-NEXT: vmax.vx v8, v8, a0
259 %elt.head = insertelement <16 x i8> poison, i8 %b, i32 0
260 %vb = shufflevector <16 x i8> %elt.head, <16 x i8> poison, <16 x i32> zeroinitializer
261 %v = call <16 x i8> @llvm.vp.smax.v16i8(<16 x i8> %va, <16 x i8> %vb, <16 x i1> splat (i1 true), i32 %evl)
265 declare <256 x i8> @llvm.vp.smax.v258i8(<256 x i8>, <256 x i8>, <256 x i1>, i32)
267 define <256 x i8> @vmax_vx_v258i8(<256 x i8> %va, i8 %b, <256 x i1> %m, i32 zeroext %evl) {
268 ; CHECK-LABEL: vmax_vx_v258i8:
270 ; CHECK-NEXT: vmv1r.v v24, v0
271 ; CHECK-NEXT: li a3, 128
272 ; CHECK-NEXT: vsetvli zero, a3, e8, m8, ta, ma
273 ; CHECK-NEXT: vlm.v v0, (a1)
274 ; CHECK-NEXT: addi a1, a2, -128
275 ; CHECK-NEXT: sltu a4, a2, a1
276 ; CHECK-NEXT: addi a4, a4, -1
277 ; CHECK-NEXT: and a1, a4, a1
278 ; CHECK-NEXT: vsetvli zero, a1, e8, m8, ta, ma
279 ; CHECK-NEXT: vmax.vx v16, v16, a0, v0.t
280 ; CHECK-NEXT: bltu a2, a3, .LBB22_2
281 ; CHECK-NEXT: # %bb.1:
282 ; CHECK-NEXT: li a2, 128
283 ; CHECK-NEXT: .LBB22_2:
284 ; CHECK-NEXT: vmv1r.v v0, v24
285 ; CHECK-NEXT: vsetvli zero, a2, e8, m8, ta, ma
286 ; CHECK-NEXT: vmax.vx v8, v8, a0, v0.t
288 %elt.head = insertelement <256 x i8> poison, i8 %b, i32 0
289 %vb = shufflevector <256 x i8> %elt.head, <256 x i8> poison, <256 x i32> zeroinitializer
290 %v = call <256 x i8> @llvm.vp.smax.v258i8(<256 x i8> %va, <256 x i8> %vb, <256 x i1> %m, i32 %evl)
294 define <256 x i8> @vmax_vx_v258i8_unmasked(<256 x i8> %va, i8 %b, i32 zeroext %evl) {
295 ; CHECK-LABEL: vmax_vx_v258i8_unmasked:
297 ; CHECK-NEXT: li a3, 128
298 ; CHECK-NEXT: mv a2, a1
299 ; CHECK-NEXT: bltu a1, a3, .LBB23_2
300 ; CHECK-NEXT: # %bb.1:
301 ; CHECK-NEXT: li a2, 128
302 ; CHECK-NEXT: .LBB23_2:
303 ; CHECK-NEXT: vsetvli zero, a2, e8, m8, ta, ma
304 ; CHECK-NEXT: vmax.vx v8, v8, a0
305 ; CHECK-NEXT: addi a2, a1, -128
306 ; CHECK-NEXT: sltu a1, a1, a2
307 ; CHECK-NEXT: addi a1, a1, -1
308 ; CHECK-NEXT: and a1, a1, a2
309 ; CHECK-NEXT: vsetvli zero, a1, e8, m8, ta, ma
310 ; CHECK-NEXT: vmax.vx v16, v16, a0
312 %elt.head = insertelement <256 x i8> poison, i8 %b, i32 0
313 %vb = shufflevector <256 x i8> %elt.head, <256 x i8> poison, <256 x i32> zeroinitializer
314 %v = call <256 x i8> @llvm.vp.smax.v258i8(<256 x i8> %va, <256 x i8> %vb, <256 x i1> splat (i1 true), i32 %evl)
318 ; Test splitting when the %evl is a known constant.
320 define <256 x i8> @vmax_vx_v258i8_evl129(<256 x i8> %va, i8 %b, <256 x i1> %m) {
321 ; CHECK-LABEL: vmax_vx_v258i8_evl129:
323 ; CHECK-NEXT: li a2, 128
324 ; CHECK-NEXT: vsetvli zero, a2, e8, m8, ta, ma
325 ; CHECK-NEXT: vlm.v v24, (a1)
326 ; CHECK-NEXT: vmax.vx v8, v8, a0, v0.t
327 ; CHECK-NEXT: vmv1r.v v0, v24
328 ; CHECK-NEXT: vsetivli zero, 1, e8, m8, ta, ma
329 ; CHECK-NEXT: vmax.vx v16, v16, a0, v0.t
331 %elt.head = insertelement <256 x i8> poison, i8 %b, i32 0
332 %vb = shufflevector <256 x i8> %elt.head, <256 x i8> poison, <256 x i32> zeroinitializer
333 %v = call <256 x i8> @llvm.vp.smax.v258i8(<256 x i8> %va, <256 x i8> %vb, <256 x i1> %m, i32 129)
337 ; The upper half is doing nothing.
339 define <256 x i8> @vmax_vx_v258i8_evl128(<256 x i8> %va, i8 %b, <256 x i1> %m) {
340 ; CHECK-LABEL: vmax_vx_v258i8_evl128:
342 ; CHECK-NEXT: li a1, 128
343 ; CHECK-NEXT: vsetvli zero, a1, e8, m8, ta, ma
344 ; CHECK-NEXT: vmax.vx v8, v8, a0, v0.t
346 %elt.head = insertelement <256 x i8> poison, i8 %b, i32 0
347 %vb = shufflevector <256 x i8> %elt.head, <256 x i8> poison, <256 x i32> zeroinitializer
348 %v = call <256 x i8> @llvm.vp.smax.v258i8(<256 x i8> %va, <256 x i8> %vb, <256 x i1> %m, i32 128)
352 declare <2 x i16> @llvm.vp.smax.v2i16(<2 x i16>, <2 x i16>, <2 x i1>, i32)
354 define <2 x i16> @vmax_vv_v2i16(<2 x i16> %va, <2 x i16> %b, <2 x i1> %m, i32 zeroext %evl) {
355 ; CHECK-LABEL: vmax_vv_v2i16:
357 ; CHECK-NEXT: vsetvli zero, a0, e16, mf4, ta, ma
358 ; CHECK-NEXT: vmax.vv v8, v8, v9, v0.t
360 %v = call <2 x i16> @llvm.vp.smax.v2i16(<2 x i16> %va, <2 x i16> %b, <2 x i1> %m, i32 %evl)
364 define <2 x i16> @vmax_vv_v2i16_unmasked(<2 x i16> %va, <2 x i16> %b, i32 zeroext %evl) {
365 ; CHECK-LABEL: vmax_vv_v2i16_unmasked:
367 ; CHECK-NEXT: vsetvli zero, a0, e16, mf4, ta, ma
368 ; CHECK-NEXT: vmax.vv v8, v8, v9
370 %v = call <2 x i16> @llvm.vp.smax.v2i16(<2 x i16> %va, <2 x i16> %b, <2 x i1> splat (i1 true), i32 %evl)
374 define <2 x i16> @vmax_vx_v2i16(<2 x i16> %va, i16 %b, <2 x i1> %m, i32 zeroext %evl) {
375 ; CHECK-LABEL: vmax_vx_v2i16:
377 ; CHECK-NEXT: vsetvli zero, a1, e16, mf4, ta, ma
378 ; CHECK-NEXT: vmax.vx v8, v8, a0, v0.t
380 %elt.head = insertelement <2 x i16> poison, i16 %b, i32 0
381 %vb = shufflevector <2 x i16> %elt.head, <2 x i16> poison, <2 x i32> zeroinitializer
382 %v = call <2 x i16> @llvm.vp.smax.v2i16(<2 x i16> %va, <2 x i16> %vb, <2 x i1> %m, i32 %evl)
386 define <2 x i16> @vmax_vx_v2i16_unmasked(<2 x i16> %va, i16 %b, i32 zeroext %evl) {
387 ; CHECK-LABEL: vmax_vx_v2i16_unmasked:
389 ; CHECK-NEXT: vsetvli zero, a1, e16, mf4, ta, ma
390 ; CHECK-NEXT: vmax.vx v8, v8, a0
392 %elt.head = insertelement <2 x i16> poison, i16 %b, i32 0
393 %vb = shufflevector <2 x i16> %elt.head, <2 x i16> poison, <2 x i32> zeroinitializer
394 %v = call <2 x i16> @llvm.vp.smax.v2i16(<2 x i16> %va, <2 x i16> %vb, <2 x i1> splat (i1 true), i32 %evl)
398 declare <4 x i16> @llvm.vp.smax.v4i16(<4 x i16>, <4 x i16>, <4 x i1>, i32)
400 define <4 x i16> @vmax_vv_v4i16(<4 x i16> %va, <4 x i16> %b, <4 x i1> %m, i32 zeroext %evl) {
401 ; CHECK-LABEL: vmax_vv_v4i16:
403 ; CHECK-NEXT: vsetvli zero, a0, e16, mf2, ta, ma
404 ; CHECK-NEXT: vmax.vv v8, v8, v9, v0.t
406 %v = call <4 x i16> @llvm.vp.smax.v4i16(<4 x i16> %va, <4 x i16> %b, <4 x i1> %m, i32 %evl)
410 define <4 x i16> @vmax_vv_v4i16_unmasked(<4 x i16> %va, <4 x i16> %b, i32 zeroext %evl) {
411 ; CHECK-LABEL: vmax_vv_v4i16_unmasked:
413 ; CHECK-NEXT: vsetvli zero, a0, e16, mf2, ta, ma
414 ; CHECK-NEXT: vmax.vv v8, v8, v9
416 %v = call <4 x i16> @llvm.vp.smax.v4i16(<4 x i16> %va, <4 x i16> %b, <4 x i1> splat (i1 true), i32 %evl)
420 define <4 x i16> @vmax_vx_v4i16(<4 x i16> %va, i16 %b, <4 x i1> %m, i32 zeroext %evl) {
421 ; CHECK-LABEL: vmax_vx_v4i16:
423 ; CHECK-NEXT: vsetvli zero, a1, e16, mf2, ta, ma
424 ; CHECK-NEXT: vmax.vx v8, v8, a0, v0.t
426 %elt.head = insertelement <4 x i16> poison, i16 %b, i32 0
427 %vb = shufflevector <4 x i16> %elt.head, <4 x i16> poison, <4 x i32> zeroinitializer
428 %v = call <4 x i16> @llvm.vp.smax.v4i16(<4 x i16> %va, <4 x i16> %vb, <4 x i1> %m, i32 %evl)
432 define <4 x i16> @vmax_vx_v4i16_unmasked(<4 x i16> %va, i16 %b, i32 zeroext %evl) {
433 ; CHECK-LABEL: vmax_vx_v4i16_unmasked:
435 ; CHECK-NEXT: vsetvli zero, a1, e16, mf2, ta, ma
436 ; CHECK-NEXT: vmax.vx v8, v8, a0
438 %elt.head = insertelement <4 x i16> poison, i16 %b, i32 0
439 %vb = shufflevector <4 x i16> %elt.head, <4 x i16> poison, <4 x i32> zeroinitializer
440 %v = call <4 x i16> @llvm.vp.smax.v4i16(<4 x i16> %va, <4 x i16> %vb, <4 x i1> splat (i1 true), i32 %evl)
444 declare <8 x i16> @llvm.vp.smax.v8i16(<8 x i16>, <8 x i16>, <8 x i1>, i32)
446 define <8 x i16> @vmax_vv_v8i16(<8 x i16> %va, <8 x i16> %b, <8 x i1> %m, i32 zeroext %evl) {
447 ; CHECK-LABEL: vmax_vv_v8i16:
449 ; CHECK-NEXT: vsetvli zero, a0, e16, m1, ta, ma
450 ; CHECK-NEXT: vmax.vv v8, v8, v9, v0.t
452 %v = call <8 x i16> @llvm.vp.smax.v8i16(<8 x i16> %va, <8 x i16> %b, <8 x i1> %m, i32 %evl)
456 define <8 x i16> @vmax_vv_v8i16_unmasked(<8 x i16> %va, <8 x i16> %b, i32 zeroext %evl) {
457 ; CHECK-LABEL: vmax_vv_v8i16_unmasked:
459 ; CHECK-NEXT: vsetvli zero, a0, e16, m1, ta, ma
460 ; CHECK-NEXT: vmax.vv v8, v8, v9
462 %v = call <8 x i16> @llvm.vp.smax.v8i16(<8 x i16> %va, <8 x i16> %b, <8 x i1> splat (i1 true), i32 %evl)
466 define <8 x i16> @vmax_vx_v8i16(<8 x i16> %va, i16 %b, <8 x i1> %m, i32 zeroext %evl) {
467 ; CHECK-LABEL: vmax_vx_v8i16:
469 ; CHECK-NEXT: vsetvli zero, a1, e16, m1, ta, ma
470 ; CHECK-NEXT: vmax.vx v8, v8, a0, v0.t
472 %elt.head = insertelement <8 x i16> poison, i16 %b, i32 0
473 %vb = shufflevector <8 x i16> %elt.head, <8 x i16> poison, <8 x i32> zeroinitializer
474 %v = call <8 x i16> @llvm.vp.smax.v8i16(<8 x i16> %va, <8 x i16> %vb, <8 x i1> %m, i32 %evl)
478 define <8 x i16> @vmax_vx_v8i16_unmasked(<8 x i16> %va, i16 %b, i32 zeroext %evl) {
479 ; CHECK-LABEL: vmax_vx_v8i16_unmasked:
481 ; CHECK-NEXT: vsetvli zero, a1, e16, m1, ta, ma
482 ; CHECK-NEXT: vmax.vx v8, v8, a0
484 %elt.head = insertelement <8 x i16> poison, i16 %b, i32 0
485 %vb = shufflevector <8 x i16> %elt.head, <8 x i16> poison, <8 x i32> zeroinitializer
486 %v = call <8 x i16> @llvm.vp.smax.v8i16(<8 x i16> %va, <8 x i16> %vb, <8 x i1> splat (i1 true), i32 %evl)
490 declare <16 x i16> @llvm.vp.smax.v16i16(<16 x i16>, <16 x i16>, <16 x i1>, i32)
492 define <16 x i16> @vmax_vv_v16i16(<16 x i16> %va, <16 x i16> %b, <16 x i1> %m, i32 zeroext %evl) {
493 ; CHECK-LABEL: vmax_vv_v16i16:
495 ; CHECK-NEXT: vsetvli zero, a0, e16, m2, ta, ma
496 ; CHECK-NEXT: vmax.vv v8, v8, v10, v0.t
498 %v = call <16 x i16> @llvm.vp.smax.v16i16(<16 x i16> %va, <16 x i16> %b, <16 x i1> %m, i32 %evl)
502 define <16 x i16> @vmax_vv_v16i16_unmasked(<16 x i16> %va, <16 x i16> %b, i32 zeroext %evl) {
503 ; CHECK-LABEL: vmax_vv_v16i16_unmasked:
505 ; CHECK-NEXT: vsetvli zero, a0, e16, m2, ta, ma
506 ; CHECK-NEXT: vmax.vv v8, v8, v10
508 %v = call <16 x i16> @llvm.vp.smax.v16i16(<16 x i16> %va, <16 x i16> %b, <16 x i1> splat (i1 true), i32 %evl)
512 define <16 x i16> @vmax_vx_v16i16(<16 x i16> %va, i16 %b, <16 x i1> %m, i32 zeroext %evl) {
513 ; CHECK-LABEL: vmax_vx_v16i16:
515 ; CHECK-NEXT: vsetvli zero, a1, e16, m2, ta, ma
516 ; CHECK-NEXT: vmax.vx v8, v8, a0, v0.t
518 %elt.head = insertelement <16 x i16> poison, i16 %b, i32 0
519 %vb = shufflevector <16 x i16> %elt.head, <16 x i16> poison, <16 x i32> zeroinitializer
520 %v = call <16 x i16> @llvm.vp.smax.v16i16(<16 x i16> %va, <16 x i16> %vb, <16 x i1> %m, i32 %evl)
524 define <16 x i16> @vmax_vx_v16i16_unmasked(<16 x i16> %va, i16 %b, i32 zeroext %evl) {
525 ; CHECK-LABEL: vmax_vx_v16i16_unmasked:
527 ; CHECK-NEXT: vsetvli zero, a1, e16, m2, ta, ma
528 ; CHECK-NEXT: vmax.vx v8, v8, a0
530 %elt.head = insertelement <16 x i16> poison, i16 %b, i32 0
531 %vb = shufflevector <16 x i16> %elt.head, <16 x i16> poison, <16 x i32> zeroinitializer
532 %v = call <16 x i16> @llvm.vp.smax.v16i16(<16 x i16> %va, <16 x i16> %vb, <16 x i1> splat (i1 true), i32 %evl)
536 declare <2 x i32> @llvm.vp.smax.v2i32(<2 x i32>, <2 x i32>, <2 x i1>, i32)
538 define <2 x i32> @vmax_vv_v2i32(<2 x i32> %va, <2 x i32> %b, <2 x i1> %m, i32 zeroext %evl) {
539 ; CHECK-LABEL: vmax_vv_v2i32:
541 ; CHECK-NEXT: vsetvli zero, a0, e32, mf2, ta, ma
542 ; CHECK-NEXT: vmax.vv v8, v8, v9, v0.t
544 %v = call <2 x i32> @llvm.vp.smax.v2i32(<2 x i32> %va, <2 x i32> %b, <2 x i1> %m, i32 %evl)
548 define <2 x i32> @vmax_vv_v2i32_unmasked(<2 x i32> %va, <2 x i32> %b, i32 zeroext %evl) {
549 ; CHECK-LABEL: vmax_vv_v2i32_unmasked:
551 ; CHECK-NEXT: vsetvli zero, a0, e32, mf2, ta, ma
552 ; CHECK-NEXT: vmax.vv v8, v8, v9
554 %v = call <2 x i32> @llvm.vp.smax.v2i32(<2 x i32> %va, <2 x i32> %b, <2 x i1> splat (i1 true), i32 %evl)
558 define <2 x i32> @vmax_vx_v2i32(<2 x i32> %va, i32 %b, <2 x i1> %m, i32 zeroext %evl) {
559 ; CHECK-LABEL: vmax_vx_v2i32:
561 ; CHECK-NEXT: vsetvli zero, a1, e32, mf2, ta, ma
562 ; CHECK-NEXT: vmax.vx v8, v8, a0, v0.t
564 %elt.head = insertelement <2 x i32> poison, i32 %b, i32 0
565 %vb = shufflevector <2 x i32> %elt.head, <2 x i32> poison, <2 x i32> zeroinitializer
566 %v = call <2 x i32> @llvm.vp.smax.v2i32(<2 x i32> %va, <2 x i32> %vb, <2 x i1> %m, i32 %evl)
570 define <2 x i32> @vmax_vx_v2i32_unmasked(<2 x i32> %va, i32 %b, i32 zeroext %evl) {
571 ; CHECK-LABEL: vmax_vx_v2i32_unmasked:
573 ; CHECK-NEXT: vsetvli zero, a1, e32, mf2, ta, ma
574 ; CHECK-NEXT: vmax.vx v8, v8, a0
576 %elt.head = insertelement <2 x i32> poison, i32 %b, i32 0
577 %vb = shufflevector <2 x i32> %elt.head, <2 x i32> poison, <2 x i32> zeroinitializer
578 %v = call <2 x i32> @llvm.vp.smax.v2i32(<2 x i32> %va, <2 x i32> %vb, <2 x i1> splat (i1 true), i32 %evl)
582 declare <4 x i32> @llvm.vp.smax.v4i32(<4 x i32>, <4 x i32>, <4 x i1>, i32)
584 define <4 x i32> @vmax_vv_v4i32(<4 x i32> %va, <4 x i32> %b, <4 x i1> %m, i32 zeroext %evl) {
585 ; CHECK-LABEL: vmax_vv_v4i32:
587 ; CHECK-NEXT: vsetvli zero, a0, e32, m1, ta, ma
588 ; CHECK-NEXT: vmax.vv v8, v8, v9, v0.t
590 %v = call <4 x i32> @llvm.vp.smax.v4i32(<4 x i32> %va, <4 x i32> %b, <4 x i1> %m, i32 %evl)
594 define <4 x i32> @vmax_vv_v4i32_unmasked(<4 x i32> %va, <4 x i32> %b, i32 zeroext %evl) {
595 ; CHECK-LABEL: vmax_vv_v4i32_unmasked:
597 ; CHECK-NEXT: vsetvli zero, a0, e32, m1, ta, ma
598 ; CHECK-NEXT: vmax.vv v8, v8, v9
600 %v = call <4 x i32> @llvm.vp.smax.v4i32(<4 x i32> %va, <4 x i32> %b, <4 x i1> splat (i1 true), i32 %evl)
604 define <4 x i32> @vmax_vx_v4i32(<4 x i32> %va, i32 %b, <4 x i1> %m, i32 zeroext %evl) {
605 ; CHECK-LABEL: vmax_vx_v4i32:
607 ; CHECK-NEXT: vsetvli zero, a1, e32, m1, ta, ma
608 ; CHECK-NEXT: vmax.vx v8, v8, a0, v0.t
610 %elt.head = insertelement <4 x i32> poison, i32 %b, i32 0
611 %vb = shufflevector <4 x i32> %elt.head, <4 x i32> poison, <4 x i32> zeroinitializer
612 %v = call <4 x i32> @llvm.vp.smax.v4i32(<4 x i32> %va, <4 x i32> %vb, <4 x i1> %m, i32 %evl)
616 define <4 x i32> @vmax_vx_v4i32_unmasked(<4 x i32> %va, i32 %b, i32 zeroext %evl) {
617 ; CHECK-LABEL: vmax_vx_v4i32_unmasked:
619 ; CHECK-NEXT: vsetvli zero, a1, e32, m1, ta, ma
620 ; CHECK-NEXT: vmax.vx v8, v8, a0
622 %elt.head = insertelement <4 x i32> poison, i32 %b, i32 0
623 %vb = shufflevector <4 x i32> %elt.head, <4 x i32> poison, <4 x i32> zeroinitializer
624 %v = call <4 x i32> @llvm.vp.smax.v4i32(<4 x i32> %va, <4 x i32> %vb, <4 x i1> splat (i1 true), i32 %evl)
628 declare <8 x i32> @llvm.vp.smax.v8i32(<8 x i32>, <8 x i32>, <8 x i1>, i32)
630 define <8 x i32> @vmax_vv_v8i32(<8 x i32> %va, <8 x i32> %b, <8 x i1> %m, i32 zeroext %evl) {
631 ; CHECK-LABEL: vmax_vv_v8i32:
633 ; CHECK-NEXT: vsetvli zero, a0, e32, m2, ta, ma
634 ; CHECK-NEXT: vmax.vv v8, v8, v10, v0.t
636 %v = call <8 x i32> @llvm.vp.smax.v8i32(<8 x i32> %va, <8 x i32> %b, <8 x i1> %m, i32 %evl)
640 define <8 x i32> @vmax_vv_v8i32_unmasked(<8 x i32> %va, <8 x i32> %b, i32 zeroext %evl) {
641 ; CHECK-LABEL: vmax_vv_v8i32_unmasked:
643 ; CHECK-NEXT: vsetvli zero, a0, e32, m2, ta, ma
644 ; CHECK-NEXT: vmax.vv v8, v8, v10
646 %v = call <8 x i32> @llvm.vp.smax.v8i32(<8 x i32> %va, <8 x i32> %b, <8 x i1> splat (i1 true), i32 %evl)
650 define <8 x i32> @vmax_vx_v8i32(<8 x i32> %va, i32 %b, <8 x i1> %m, i32 zeroext %evl) {
651 ; CHECK-LABEL: vmax_vx_v8i32:
653 ; CHECK-NEXT: vsetvli zero, a1, e32, m2, ta, ma
654 ; CHECK-NEXT: vmax.vx v8, v8, a0, v0.t
656 %elt.head = insertelement <8 x i32> poison, i32 %b, i32 0
657 %vb = shufflevector <8 x i32> %elt.head, <8 x i32> poison, <8 x i32> zeroinitializer
658 %v = call <8 x i32> @llvm.vp.smax.v8i32(<8 x i32> %va, <8 x i32> %vb, <8 x i1> %m, i32 %evl)
662 define <8 x i32> @vmax_vx_v8i32_unmasked(<8 x i32> %va, i32 %b, i32 zeroext %evl) {
663 ; CHECK-LABEL: vmax_vx_v8i32_unmasked:
665 ; CHECK-NEXT: vsetvli zero, a1, e32, m2, ta, ma
666 ; CHECK-NEXT: vmax.vx v8, v8, a0
668 %elt.head = insertelement <8 x i32> poison, i32 %b, i32 0
669 %vb = shufflevector <8 x i32> %elt.head, <8 x i32> poison, <8 x i32> zeroinitializer
670 %v = call <8 x i32> @llvm.vp.smax.v8i32(<8 x i32> %va, <8 x i32> %vb, <8 x i1> splat (i1 true), i32 %evl)
674 declare <16 x i32> @llvm.vp.smax.v16i32(<16 x i32>, <16 x i32>, <16 x i1>, i32)
676 define <16 x i32> @vmax_vv_v16i32(<16 x i32> %va, <16 x i32> %b, <16 x i1> %m, i32 zeroext %evl) {
677 ; CHECK-LABEL: vmax_vv_v16i32:
679 ; CHECK-NEXT: vsetvli zero, a0, e32, m4, ta, ma
680 ; CHECK-NEXT: vmax.vv v8, v8, v12, v0.t
682 %v = call <16 x i32> @llvm.vp.smax.v16i32(<16 x i32> %va, <16 x i32> %b, <16 x i1> %m, i32 %evl)
686 define <16 x i32> @vmax_vv_v16i32_unmasked(<16 x i32> %va, <16 x i32> %b, i32 zeroext %evl) {
687 ; CHECK-LABEL: vmax_vv_v16i32_unmasked:
689 ; CHECK-NEXT: vsetvli zero, a0, e32, m4, ta, ma
690 ; CHECK-NEXT: vmax.vv v8, v8, v12
692 %v = call <16 x i32> @llvm.vp.smax.v16i32(<16 x i32> %va, <16 x i32> %b, <16 x i1> splat (i1 true), i32 %evl)
696 define <16 x i32> @vmax_vx_v16i32(<16 x i32> %va, i32 %b, <16 x i1> %m, i32 zeroext %evl) {
697 ; CHECK-LABEL: vmax_vx_v16i32:
699 ; CHECK-NEXT: vsetvli zero, a1, e32, m4, ta, ma
700 ; CHECK-NEXT: vmax.vx v8, v8, a0, v0.t
702 %elt.head = insertelement <16 x i32> poison, i32 %b, i32 0
703 %vb = shufflevector <16 x i32> %elt.head, <16 x i32> poison, <16 x i32> zeroinitializer
704 %v = call <16 x i32> @llvm.vp.smax.v16i32(<16 x i32> %va, <16 x i32> %vb, <16 x i1> %m, i32 %evl)
708 define <16 x i32> @vmax_vx_v16i32_unmasked(<16 x i32> %va, i32 %b, i32 zeroext %evl) {
709 ; CHECK-LABEL: vmax_vx_v16i32_unmasked:
711 ; CHECK-NEXT: vsetvli zero, a1, e32, m4, ta, ma
712 ; CHECK-NEXT: vmax.vx v8, v8, a0
714 %elt.head = insertelement <16 x i32> poison, i32 %b, i32 0
715 %vb = shufflevector <16 x i32> %elt.head, <16 x i32> poison, <16 x i32> zeroinitializer
716 %v = call <16 x i32> @llvm.vp.smax.v16i32(<16 x i32> %va, <16 x i32> %vb, <16 x i1> splat (i1 true), i32 %evl)
720 declare <2 x i64> @llvm.vp.smax.v2i64(<2 x i64>, <2 x i64>, <2 x i1>, i32)
722 define <2 x i64> @vmax_vv_v2i64(<2 x i64> %va, <2 x i64> %b, <2 x i1> %m, i32 zeroext %evl) {
723 ; CHECK-LABEL: vmax_vv_v2i64:
725 ; CHECK-NEXT: vsetvli zero, a0, e64, m1, ta, ma
726 ; CHECK-NEXT: vmax.vv v8, v8, v9, v0.t
728 %v = call <2 x i64> @llvm.vp.smax.v2i64(<2 x i64> %va, <2 x i64> %b, <2 x i1> %m, i32 %evl)
732 define <2 x i64> @vmax_vv_v2i64_unmasked(<2 x i64> %va, <2 x i64> %b, i32 zeroext %evl) {
733 ; CHECK-LABEL: vmax_vv_v2i64_unmasked:
735 ; CHECK-NEXT: vsetvli zero, a0, e64, m1, ta, ma
736 ; CHECK-NEXT: vmax.vv v8, v8, v9
738 %v = call <2 x i64> @llvm.vp.smax.v2i64(<2 x i64> %va, <2 x i64> %b, <2 x i1> splat (i1 true), i32 %evl)
742 define <2 x i64> @vmax_vx_v2i64(<2 x i64> %va, i64 %b, <2 x i1> %m, i32 zeroext %evl) {
743 ; RV32-LABEL: vmax_vx_v2i64:
745 ; RV32-NEXT: addi sp, sp, -16
746 ; RV32-NEXT: .cfi_def_cfa_offset 16
747 ; RV32-NEXT: sw a1, 12(sp)
748 ; RV32-NEXT: sw a0, 8(sp)
749 ; RV32-NEXT: addi a0, sp, 8
750 ; RV32-NEXT: vsetivli zero, 2, e64, m1, ta, ma
751 ; RV32-NEXT: vlse64.v v9, (a0), zero
752 ; RV32-NEXT: vsetvli zero, a2, e64, m1, ta, ma
753 ; RV32-NEXT: vmax.vv v8, v8, v9, v0.t
754 ; RV32-NEXT: addi sp, sp, 16
757 ; RV64-LABEL: vmax_vx_v2i64:
759 ; RV64-NEXT: vsetvli zero, a1, e64, m1, ta, ma
760 ; RV64-NEXT: vmax.vx v8, v8, a0, v0.t
762 %elt.head = insertelement <2 x i64> poison, i64 %b, i32 0
763 %vb = shufflevector <2 x i64> %elt.head, <2 x i64> poison, <2 x i32> zeroinitializer
764 %v = call <2 x i64> @llvm.vp.smax.v2i64(<2 x i64> %va, <2 x i64> %vb, <2 x i1> %m, i32 %evl)
768 define <2 x i64> @vmax_vx_v2i64_unmasked(<2 x i64> %va, i64 %b, i32 zeroext %evl) {
769 ; RV32-LABEL: vmax_vx_v2i64_unmasked:
771 ; RV32-NEXT: addi sp, sp, -16
772 ; RV32-NEXT: .cfi_def_cfa_offset 16
773 ; RV32-NEXT: sw a1, 12(sp)
774 ; RV32-NEXT: sw a0, 8(sp)
775 ; RV32-NEXT: addi a0, sp, 8
776 ; RV32-NEXT: vsetivli zero, 2, e64, m1, ta, ma
777 ; RV32-NEXT: vlse64.v v9, (a0), zero
778 ; RV32-NEXT: vsetvli zero, a2, e64, m1, ta, ma
779 ; RV32-NEXT: vmax.vv v8, v8, v9
780 ; RV32-NEXT: addi sp, sp, 16
783 ; RV64-LABEL: vmax_vx_v2i64_unmasked:
785 ; RV64-NEXT: vsetvli zero, a1, e64, m1, ta, ma
786 ; RV64-NEXT: vmax.vx v8, v8, a0
788 %elt.head = insertelement <2 x i64> poison, i64 %b, i32 0
789 %vb = shufflevector <2 x i64> %elt.head, <2 x i64> poison, <2 x i32> zeroinitializer
790 %v = call <2 x i64> @llvm.vp.smax.v2i64(<2 x i64> %va, <2 x i64> %vb, <2 x i1> splat (i1 true), i32 %evl)
794 declare <4 x i64> @llvm.vp.smax.v4i64(<4 x i64>, <4 x i64>, <4 x i1>, i32)
796 define <4 x i64> @vmax_vv_v4i64(<4 x i64> %va, <4 x i64> %b, <4 x i1> %m, i32 zeroext %evl) {
797 ; CHECK-LABEL: vmax_vv_v4i64:
799 ; CHECK-NEXT: vsetvli zero, a0, e64, m2, ta, ma
800 ; CHECK-NEXT: vmax.vv v8, v8, v10, v0.t
802 %v = call <4 x i64> @llvm.vp.smax.v4i64(<4 x i64> %va, <4 x i64> %b, <4 x i1> %m, i32 %evl)
806 define <4 x i64> @vmax_vv_v4i64_unmasked(<4 x i64> %va, <4 x i64> %b, i32 zeroext %evl) {
807 ; CHECK-LABEL: vmax_vv_v4i64_unmasked:
809 ; CHECK-NEXT: vsetvli zero, a0, e64, m2, ta, ma
810 ; CHECK-NEXT: vmax.vv v8, v8, v10
812 %v = call <4 x i64> @llvm.vp.smax.v4i64(<4 x i64> %va, <4 x i64> %b, <4 x i1> splat (i1 true), i32 %evl)
816 define <4 x i64> @vmax_vx_v4i64(<4 x i64> %va, i64 %b, <4 x i1> %m, i32 zeroext %evl) {
817 ; RV32-LABEL: vmax_vx_v4i64:
819 ; RV32-NEXT: addi sp, sp, -16
820 ; RV32-NEXT: .cfi_def_cfa_offset 16
821 ; RV32-NEXT: sw a1, 12(sp)
822 ; RV32-NEXT: sw a0, 8(sp)
823 ; RV32-NEXT: addi a0, sp, 8
824 ; RV32-NEXT: vsetivli zero, 4, e64, m2, ta, ma
825 ; RV32-NEXT: vlse64.v v10, (a0), zero
826 ; RV32-NEXT: vsetvli zero, a2, e64, m2, ta, ma
827 ; RV32-NEXT: vmax.vv v8, v8, v10, v0.t
828 ; RV32-NEXT: addi sp, sp, 16
831 ; RV64-LABEL: vmax_vx_v4i64:
833 ; RV64-NEXT: vsetvli zero, a1, e64, m2, ta, ma
834 ; RV64-NEXT: vmax.vx v8, v8, a0, v0.t
836 %elt.head = insertelement <4 x i64> poison, i64 %b, i32 0
837 %vb = shufflevector <4 x i64> %elt.head, <4 x i64> poison, <4 x i32> zeroinitializer
838 %v = call <4 x i64> @llvm.vp.smax.v4i64(<4 x i64> %va, <4 x i64> %vb, <4 x i1> %m, i32 %evl)
842 define <4 x i64> @vmax_vx_v4i64_unmasked(<4 x i64> %va, i64 %b, i32 zeroext %evl) {
843 ; RV32-LABEL: vmax_vx_v4i64_unmasked:
845 ; RV32-NEXT: addi sp, sp, -16
846 ; RV32-NEXT: .cfi_def_cfa_offset 16
847 ; RV32-NEXT: sw a1, 12(sp)
848 ; RV32-NEXT: sw a0, 8(sp)
849 ; RV32-NEXT: addi a0, sp, 8
850 ; RV32-NEXT: vsetivli zero, 4, e64, m2, ta, ma
851 ; RV32-NEXT: vlse64.v v10, (a0), zero
852 ; RV32-NEXT: vsetvli zero, a2, e64, m2, ta, ma
853 ; RV32-NEXT: vmax.vv v8, v8, v10
854 ; RV32-NEXT: addi sp, sp, 16
857 ; RV64-LABEL: vmax_vx_v4i64_unmasked:
859 ; RV64-NEXT: vsetvli zero, a1, e64, m2, ta, ma
860 ; RV64-NEXT: vmax.vx v8, v8, a0
862 %elt.head = insertelement <4 x i64> poison, i64 %b, i32 0
863 %vb = shufflevector <4 x i64> %elt.head, <4 x i64> poison, <4 x i32> zeroinitializer
864 %v = call <4 x i64> @llvm.vp.smax.v4i64(<4 x i64> %va, <4 x i64> %vb, <4 x i1> splat (i1 true), i32 %evl)
868 declare <8 x i64> @llvm.vp.smax.v8i64(<8 x i64>, <8 x i64>, <8 x i1>, i32)
870 define <8 x i64> @vmax_vv_v8i64(<8 x i64> %va, <8 x i64> %b, <8 x i1> %m, i32 zeroext %evl) {
871 ; CHECK-LABEL: vmax_vv_v8i64:
873 ; CHECK-NEXT: vsetvli zero, a0, e64, m4, ta, ma
874 ; CHECK-NEXT: vmax.vv v8, v8, v12, v0.t
876 %v = call <8 x i64> @llvm.vp.smax.v8i64(<8 x i64> %va, <8 x i64> %b, <8 x i1> %m, i32 %evl)
880 define <8 x i64> @vmax_vv_v8i64_unmasked(<8 x i64> %va, <8 x i64> %b, i32 zeroext %evl) {
881 ; CHECK-LABEL: vmax_vv_v8i64_unmasked:
883 ; CHECK-NEXT: vsetvli zero, a0, e64, m4, ta, ma
884 ; CHECK-NEXT: vmax.vv v8, v8, v12
886 %v = call <8 x i64> @llvm.vp.smax.v8i64(<8 x i64> %va, <8 x i64> %b, <8 x i1> splat (i1 true), i32 %evl)
890 define <8 x i64> @vmax_vx_v8i64(<8 x i64> %va, i64 %b, <8 x i1> %m, i32 zeroext %evl) {
891 ; RV32-LABEL: vmax_vx_v8i64:
893 ; RV32-NEXT: addi sp, sp, -16
894 ; RV32-NEXT: .cfi_def_cfa_offset 16
895 ; RV32-NEXT: sw a1, 12(sp)
896 ; RV32-NEXT: sw a0, 8(sp)
897 ; RV32-NEXT: addi a0, sp, 8
898 ; RV32-NEXT: vsetivli zero, 8, e64, m4, ta, ma
899 ; RV32-NEXT: vlse64.v v12, (a0), zero
900 ; RV32-NEXT: vsetvli zero, a2, e64, m4, ta, ma
901 ; RV32-NEXT: vmax.vv v8, v8, v12, v0.t
902 ; RV32-NEXT: addi sp, sp, 16
905 ; RV64-LABEL: vmax_vx_v8i64:
907 ; RV64-NEXT: vsetvli zero, a1, e64, m4, ta, ma
908 ; RV64-NEXT: vmax.vx v8, v8, a0, v0.t
910 %elt.head = insertelement <8 x i64> poison, i64 %b, i32 0
911 %vb = shufflevector <8 x i64> %elt.head, <8 x i64> poison, <8 x i32> zeroinitializer
912 %v = call <8 x i64> @llvm.vp.smax.v8i64(<8 x i64> %va, <8 x i64> %vb, <8 x i1> %m, i32 %evl)
916 define <8 x i64> @vmax_vx_v8i64_unmasked(<8 x i64> %va, i64 %b, i32 zeroext %evl) {
917 ; RV32-LABEL: vmax_vx_v8i64_unmasked:
919 ; RV32-NEXT: addi sp, sp, -16
920 ; RV32-NEXT: .cfi_def_cfa_offset 16
921 ; RV32-NEXT: sw a1, 12(sp)
922 ; RV32-NEXT: sw a0, 8(sp)
923 ; RV32-NEXT: addi a0, sp, 8
924 ; RV32-NEXT: vsetivli zero, 8, e64, m4, ta, ma
925 ; RV32-NEXT: vlse64.v v12, (a0), zero
926 ; RV32-NEXT: vsetvli zero, a2, e64, m4, ta, ma
927 ; RV32-NEXT: vmax.vv v8, v8, v12
928 ; RV32-NEXT: addi sp, sp, 16
931 ; RV64-LABEL: vmax_vx_v8i64_unmasked:
933 ; RV64-NEXT: vsetvli zero, a1, e64, m4, ta, ma
934 ; RV64-NEXT: vmax.vx v8, v8, a0
936 %elt.head = insertelement <8 x i64> poison, i64 %b, i32 0
937 %vb = shufflevector <8 x i64> %elt.head, <8 x i64> poison, <8 x i32> zeroinitializer
938 %v = call <8 x i64> @llvm.vp.smax.v8i64(<8 x i64> %va, <8 x i64> %vb, <8 x i1> splat (i1 true), i32 %evl)
942 declare <16 x i64> @llvm.vp.smax.v16i64(<16 x i64>, <16 x i64>, <16 x i1>, i32)
944 define <16 x i64> @vmax_vv_v16i64(<16 x i64> %va, <16 x i64> %b, <16 x i1> %m, i32 zeroext %evl) {
945 ; CHECK-LABEL: vmax_vv_v16i64:
947 ; CHECK-NEXT: vsetvli zero, a0, e64, m8, ta, ma
948 ; CHECK-NEXT: vmax.vv v8, v8, v16, v0.t
950 %v = call <16 x i64> @llvm.vp.smax.v16i64(<16 x i64> %va, <16 x i64> %b, <16 x i1> %m, i32 %evl)
954 define <16 x i64> @vmax_vv_v16i64_unmasked(<16 x i64> %va, <16 x i64> %b, i32 zeroext %evl) {
955 ; CHECK-LABEL: vmax_vv_v16i64_unmasked:
957 ; CHECK-NEXT: vsetvli zero, a0, e64, m8, ta, ma
958 ; CHECK-NEXT: vmax.vv v8, v8, v16
960 %v = call <16 x i64> @llvm.vp.smax.v16i64(<16 x i64> %va, <16 x i64> %b, <16 x i1> splat (i1 true), i32 %evl)
964 define <16 x i64> @vmax_vx_v16i64(<16 x i64> %va, i64 %b, <16 x i1> %m, i32 zeroext %evl) {
965 ; RV32-LABEL: vmax_vx_v16i64:
967 ; RV32-NEXT: addi sp, sp, -16
968 ; RV32-NEXT: .cfi_def_cfa_offset 16
969 ; RV32-NEXT: sw a1, 12(sp)
970 ; RV32-NEXT: sw a0, 8(sp)
971 ; RV32-NEXT: addi a0, sp, 8
972 ; RV32-NEXT: vsetivli zero, 16, e64, m8, ta, ma
973 ; RV32-NEXT: vlse64.v v16, (a0), zero
974 ; RV32-NEXT: vsetvli zero, a2, e64, m8, ta, ma
975 ; RV32-NEXT: vmax.vv v8, v8, v16, v0.t
976 ; RV32-NEXT: addi sp, sp, 16
979 ; RV64-LABEL: vmax_vx_v16i64:
981 ; RV64-NEXT: vsetvli zero, a1, e64, m8, ta, ma
982 ; RV64-NEXT: vmax.vx v8, v8, a0, v0.t
984 %elt.head = insertelement <16 x i64> poison, i64 %b, i32 0
985 %vb = shufflevector <16 x i64> %elt.head, <16 x i64> poison, <16 x i32> zeroinitializer
986 %v = call <16 x i64> @llvm.vp.smax.v16i64(<16 x i64> %va, <16 x i64> %vb, <16 x i1> %m, i32 %evl)
990 define <16 x i64> @vmax_vx_v16i64_unmasked(<16 x i64> %va, i64 %b, i32 zeroext %evl) {
991 ; RV32-LABEL: vmax_vx_v16i64_unmasked:
993 ; RV32-NEXT: addi sp, sp, -16
994 ; RV32-NEXT: .cfi_def_cfa_offset 16
995 ; RV32-NEXT: sw a1, 12(sp)
996 ; RV32-NEXT: sw a0, 8(sp)
997 ; RV32-NEXT: addi a0, sp, 8
998 ; RV32-NEXT: vsetivli zero, 16, e64, m8, ta, ma
999 ; RV32-NEXT: vlse64.v v16, (a0), zero
1000 ; RV32-NEXT: vsetvli zero, a2, e64, m8, ta, ma
1001 ; RV32-NEXT: vmax.vv v8, v8, v16
1002 ; RV32-NEXT: addi sp, sp, 16
1005 ; RV64-LABEL: vmax_vx_v16i64_unmasked:
1007 ; RV64-NEXT: vsetvli zero, a1, e64, m8, ta, ma
1008 ; RV64-NEXT: vmax.vx v8, v8, a0
1010 %elt.head = insertelement <16 x i64> poison, i64 %b, i32 0
1011 %vb = shufflevector <16 x i64> %elt.head, <16 x i64> poison, <16 x i32> zeroinitializer
1012 %v = call <16 x i64> @llvm.vp.smax.v16i64(<16 x i64> %va, <16 x i64> %vb, <16 x i1> splat (i1 true), i32 %evl)
1016 ; Test that split-legalization works as expected.
1018 declare <32 x i64> @llvm.vp.smax.v32i64(<32 x i64>, <32 x i64>, <32 x i1>, i32)
1020 define <32 x i64> @vmax_vx_v32i64(<32 x i64> %va, <32 x i1> %m, i32 zeroext %evl) {
1021 ; RV32-LABEL: vmax_vx_v32i64:
1023 ; RV32-NEXT: li a2, 16
1024 ; RV32-NEXT: vsetivli zero, 2, e8, mf4, ta, ma
1025 ; RV32-NEXT: vslidedown.vi v7, v0, 2
1026 ; RV32-NEXT: mv a1, a0
1027 ; RV32-NEXT: bltu a0, a2, .LBB74_2
1028 ; RV32-NEXT: # %bb.1:
1029 ; RV32-NEXT: li a1, 16
1030 ; RV32-NEXT: .LBB74_2:
1031 ; RV32-NEXT: li a2, 32
1032 ; RV32-NEXT: vsetvli zero, a2, e32, m8, ta, ma
1033 ; RV32-NEXT: vmv.v.i v24, -1
1034 ; RV32-NEXT: vsetvli zero, a1, e64, m8, ta, ma
1035 ; RV32-NEXT: vmax.vv v8, v8, v24, v0.t
1036 ; RV32-NEXT: addi a1, a0, -16
1037 ; RV32-NEXT: sltu a0, a0, a1
1038 ; RV32-NEXT: addi a0, a0, -1
1039 ; RV32-NEXT: and a0, a0, a1
1040 ; RV32-NEXT: vmv1r.v v0, v7
1041 ; RV32-NEXT: vsetvli zero, a0, e64, m8, ta, ma
1042 ; RV32-NEXT: vmax.vv v16, v16, v24, v0.t
1045 ; RV64-LABEL: vmax_vx_v32i64:
1047 ; RV64-NEXT: li a2, 16
1048 ; RV64-NEXT: vsetivli zero, 2, e8, mf4, ta, ma
1049 ; RV64-NEXT: vslidedown.vi v24, v0, 2
1050 ; RV64-NEXT: mv a1, a0
1051 ; RV64-NEXT: bltu a0, a2, .LBB74_2
1052 ; RV64-NEXT: # %bb.1:
1053 ; RV64-NEXT: li a1, 16
1054 ; RV64-NEXT: .LBB74_2:
1055 ; RV64-NEXT: li a2, -1
1056 ; RV64-NEXT: vsetvli zero, a1, e64, m8, ta, ma
1057 ; RV64-NEXT: vmax.vx v8, v8, a2, v0.t
1058 ; RV64-NEXT: addi a1, a0, -16
1059 ; RV64-NEXT: sltu a0, a0, a1
1060 ; RV64-NEXT: addi a0, a0, -1
1061 ; RV64-NEXT: and a0, a0, a1
1062 ; RV64-NEXT: vmv1r.v v0, v24
1063 ; RV64-NEXT: vsetvli zero, a0, e64, m8, ta, ma
1064 ; RV64-NEXT: vmax.vx v16, v16, a2, v0.t
1066 %v = call <32 x i64> @llvm.vp.smax.v32i64(<32 x i64> %va, <32 x i64> splat (i64 -1), <32 x i1> %m, i32 %evl)