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.smin.v8i7(<8 x i7>, <8 x i7>, <8 x i1>, i32)
9 define <8 x i7> @vmin_vv_v8i7(<8 x i7> %va, <8 x i7> %b, <8 x i1> %m, i32 zeroext %evl) {
10 ; CHECK-LABEL: vmin_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: vmin.vv v8, v8, v9, v0.t
19 %v = call <8 x i7> @llvm.vp.smin.v8i7(<8 x i7> %va, <8 x i7> %b, <8 x i1> %m, i32 %evl)
23 declare <2 x i8> @llvm.vp.smin.v2i8(<2 x i8>, <2 x i8>, <2 x i1>, i32)
25 define <2 x i8> @vmin_vv_v2i8(<2 x i8> %va, <2 x i8> %b, <2 x i1> %m, i32 zeroext %evl) {
26 ; CHECK-LABEL: vmin_vv_v2i8:
28 ; CHECK-NEXT: vsetvli zero, a0, e8, mf8, ta, ma
29 ; CHECK-NEXT: vmin.vv v8, v8, v9, v0.t
31 %v = call <2 x i8> @llvm.vp.smin.v2i8(<2 x i8> %va, <2 x i8> %b, <2 x i1> %m, i32 %evl)
35 define <2 x i8> @vmin_vv_v2i8_unmasked(<2 x i8> %va, <2 x i8> %b, i32 zeroext %evl) {
36 ; CHECK-LABEL: vmin_vv_v2i8_unmasked:
38 ; CHECK-NEXT: vsetvli zero, a0, e8, mf8, ta, ma
39 ; CHECK-NEXT: vmin.vv v8, v8, v9
41 %v = call <2 x i8> @llvm.vp.smin.v2i8(<2 x i8> %va, <2 x i8> %b, <2 x i1> splat (i1 true), i32 %evl)
45 define <2 x i8> @vmin_vx_v2i8(<2 x i8> %va, i8 %b, <2 x i1> %m, i32 zeroext %evl) {
46 ; CHECK-LABEL: vmin_vx_v2i8:
48 ; CHECK-NEXT: vsetvli zero, a1, e8, mf8, ta, ma
49 ; CHECK-NEXT: vmin.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.smin.v2i8(<2 x i8> %va, <2 x i8> %vb, <2 x i1> %m, i32 %evl)
57 define <2 x i8> @vmin_vx_v2i8_unmasked(<2 x i8> %va, i8 %b, i32 zeroext %evl) {
58 ; CHECK-LABEL: vmin_vx_v2i8_unmasked:
60 ; CHECK-NEXT: vsetvli zero, a1, e8, mf8, ta, ma
61 ; CHECK-NEXT: vmin.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.smin.v2i8(<2 x i8> %va, <2 x i8> %vb, <2 x i1> splat (i1 true), i32 %evl)
69 declare <4 x i8> @llvm.vp.smin.v4i8(<4 x i8>, <4 x i8>, <4 x i1>, i32)
71 define <4 x i8> @vmin_vv_v4i8(<4 x i8> %va, <4 x i8> %b, <4 x i1> %m, i32 zeroext %evl) {
72 ; CHECK-LABEL: vmin_vv_v4i8:
74 ; CHECK-NEXT: vsetvli zero, a0, e8, mf4, ta, ma
75 ; CHECK-NEXT: vmin.vv v8, v8, v9, v0.t
77 %v = call <4 x i8> @llvm.vp.smin.v4i8(<4 x i8> %va, <4 x i8> %b, <4 x i1> %m, i32 %evl)
81 define <4 x i8> @vmin_vv_v4i8_unmasked(<4 x i8> %va, <4 x i8> %b, i32 zeroext %evl) {
82 ; CHECK-LABEL: vmin_vv_v4i8_unmasked:
84 ; CHECK-NEXT: vsetvli zero, a0, e8, mf4, ta, ma
85 ; CHECK-NEXT: vmin.vv v8, v8, v9
87 %v = call <4 x i8> @llvm.vp.smin.v4i8(<4 x i8> %va, <4 x i8> %b, <4 x i1> splat (i1 true), i32 %evl)
91 define <4 x i8> @vmin_vx_v4i8(<4 x i8> %va, i8 %b, <4 x i1> %m, i32 zeroext %evl) {
92 ; CHECK-LABEL: vmin_vx_v4i8:
94 ; CHECK-NEXT: vsetvli zero, a1, e8, mf4, ta, ma
95 ; CHECK-NEXT: vmin.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.smin.v4i8(<4 x i8> %va, <4 x i8> %vb, <4 x i1> %m, i32 %evl)
103 define <4 x i8> @vmin_vx_v4i8_commute(<4 x i8> %va, i8 %b, <4 x i1> %m, i32 zeroext %evl) {
104 ; CHECK-LABEL: vmin_vx_v4i8_commute:
106 ; CHECK-NEXT: vsetvli zero, a1, e8, mf4, ta, ma
107 ; CHECK-NEXT: vmin.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.smin.v4i8(<4 x i8> %vb, <4 x i8> %va, <4 x i1> %m, i32 %evl)
115 define <4 x i8> @vmin_vx_v4i8_unmasked(<4 x i8> %va, i8 %b, i32 zeroext %evl) {
116 ; CHECK-LABEL: vmin_vx_v4i8_unmasked:
118 ; CHECK-NEXT: vsetvli zero, a1, e8, mf4, ta, ma
119 ; CHECK-NEXT: vmin.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.smin.v4i8(<4 x i8> %va, <4 x i8> %vb, <4 x i1> splat (i1 true), i32 %evl)
127 declare <5 x i8> @llvm.vp.smin.v5i8(<5 x i8>, <5 x i8>, <5 x i1>, i32)
129 define <5 x i8> @vmin_vv_v5i8(<5 x i8> %va, <5 x i8> %b, <5 x i1> %m, i32 zeroext %evl) {
130 ; CHECK-LABEL: vmin_vv_v5i8:
132 ; CHECK-NEXT: vsetvli zero, a0, e8, mf2, ta, ma
133 ; CHECK-NEXT: vmin.vv v8, v8, v9, v0.t
135 %v = call <5 x i8> @llvm.vp.smin.v5i8(<5 x i8> %va, <5 x i8> %b, <5 x i1> %m, i32 %evl)
139 define <5 x i8> @vmin_vv_v5i8_unmasked(<5 x i8> %va, <5 x i8> %b, i32 zeroext %evl) {
140 ; CHECK-LABEL: vmin_vv_v5i8_unmasked:
142 ; CHECK-NEXT: vsetvli zero, a0, e8, mf2, ta, ma
143 ; CHECK-NEXT: vmin.vv v8, v8, v9
145 %v = call <5 x i8> @llvm.vp.smin.v5i8(<5 x i8> %va, <5 x i8> %b, <5 x i1> splat (i1 true), i32 %evl)
149 define <5 x i8> @vmin_vx_v5i8(<5 x i8> %va, i8 %b, <5 x i1> %m, i32 zeroext %evl) {
150 ; CHECK-LABEL: vmin_vx_v5i8:
152 ; CHECK-NEXT: vsetvli zero, a1, e8, mf2, ta, ma
153 ; CHECK-NEXT: vmin.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.smin.v5i8(<5 x i8> %va, <5 x i8> %vb, <5 x i1> %m, i32 %evl)
161 define <5 x i8> @vmin_vx_v5i8_unmasked(<5 x i8> %va, i8 %b, i32 zeroext %evl) {
162 ; CHECK-LABEL: vmin_vx_v5i8_unmasked:
164 ; CHECK-NEXT: vsetvli zero, a1, e8, mf2, ta, ma
165 ; CHECK-NEXT: vmin.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.smin.v5i8(<5 x i8> %va, <5 x i8> %vb, <5 x i1> splat (i1 true), i32 %evl)
173 declare <8 x i8> @llvm.vp.smin.v8i8(<8 x i8>, <8 x i8>, <8 x i1>, i32)
175 define <8 x i8> @vmin_vv_v8i8(<8 x i8> %va, <8 x i8> %b, <8 x i1> %m, i32 zeroext %evl) {
176 ; CHECK-LABEL: vmin_vv_v8i8:
178 ; CHECK-NEXT: vsetvli zero, a0, e8, mf2, ta, ma
179 ; CHECK-NEXT: vmin.vv v8, v8, v9, v0.t
181 %v = call <8 x i8> @llvm.vp.smin.v8i8(<8 x i8> %va, <8 x i8> %b, <8 x i1> %m, i32 %evl)
185 define <8 x i8> @vmin_vv_v8i8_unmasked(<8 x i8> %va, <8 x i8> %b, i32 zeroext %evl) {
186 ; CHECK-LABEL: vmin_vv_v8i8_unmasked:
188 ; CHECK-NEXT: vsetvli zero, a0, e8, mf2, ta, ma
189 ; CHECK-NEXT: vmin.vv v8, v8, v9
191 %v = call <8 x i8> @llvm.vp.smin.v8i8(<8 x i8> %va, <8 x i8> %b, <8 x i1> splat (i1 true), i32 %evl)
195 define <8 x i8> @vmin_vx_v8i8(<8 x i8> %va, i8 %b, <8 x i1> %m, i32 zeroext %evl) {
196 ; CHECK-LABEL: vmin_vx_v8i8:
198 ; CHECK-NEXT: vsetvli zero, a1, e8, mf2, ta, ma
199 ; CHECK-NEXT: vmin.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.smin.v8i8(<8 x i8> %va, <8 x i8> %vb, <8 x i1> %m, i32 %evl)
207 define <8 x i8> @vmin_vx_v8i8_unmasked(<8 x i8> %va, i8 %b, i32 zeroext %evl) {
208 ; CHECK-LABEL: vmin_vx_v8i8_unmasked:
210 ; CHECK-NEXT: vsetvli zero, a1, e8, mf2, ta, ma
211 ; CHECK-NEXT: vmin.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.smin.v8i8(<8 x i8> %va, <8 x i8> %vb, <8 x i1> splat (i1 true), i32 %evl)
219 declare <16 x i8> @llvm.vp.smin.v16i8(<16 x i8>, <16 x i8>, <16 x i1>, i32)
221 define <16 x i8> @vmin_vv_v16i8(<16 x i8> %va, <16 x i8> %b, <16 x i1> %m, i32 zeroext %evl) {
222 ; CHECK-LABEL: vmin_vv_v16i8:
224 ; CHECK-NEXT: vsetvli zero, a0, e8, m1, ta, ma
225 ; CHECK-NEXT: vmin.vv v8, v8, v9, v0.t
227 %v = call <16 x i8> @llvm.vp.smin.v16i8(<16 x i8> %va, <16 x i8> %b, <16 x i1> %m, i32 %evl)
231 define <16 x i8> @vmin_vv_v16i8_unmasked(<16 x i8> %va, <16 x i8> %b, i32 zeroext %evl) {
232 ; CHECK-LABEL: vmin_vv_v16i8_unmasked:
234 ; CHECK-NEXT: vsetvli zero, a0, e8, m1, ta, ma
235 ; CHECK-NEXT: vmin.vv v8, v8, v9
237 %v = call <16 x i8> @llvm.vp.smin.v16i8(<16 x i8> %va, <16 x i8> %b, <16 x i1> splat (i1 true), i32 %evl)
241 define <16 x i8> @vmin_vx_v16i8(<16 x i8> %va, i8 %b, <16 x i1> %m, i32 zeroext %evl) {
242 ; CHECK-LABEL: vmin_vx_v16i8:
244 ; CHECK-NEXT: vsetvli zero, a1, e8, m1, ta, ma
245 ; CHECK-NEXT: vmin.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.smin.v16i8(<16 x i8> %va, <16 x i8> %vb, <16 x i1> %m, i32 %evl)
253 define <16 x i8> @vmin_vx_v16i8_unmasked(<16 x i8> %va, i8 %b, i32 zeroext %evl) {
254 ; CHECK-LABEL: vmin_vx_v16i8_unmasked:
256 ; CHECK-NEXT: vsetvli zero, a1, e8, m1, ta, ma
257 ; CHECK-NEXT: vmin.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.smin.v16i8(<16 x i8> %va, <16 x i8> %vb, <16 x i1> splat (i1 true), i32 %evl)
265 declare <256 x i8> @llvm.vp.smin.v258i8(<256 x i8>, <256 x i8>, <256 x i1>, i32)
267 define <256 x i8> @vmin_vx_v258i8(<256 x i8> %va, i8 %b, <256 x i1> %m, i32 zeroext %evl) {
268 ; CHECK-LABEL: vmin_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: vmin.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: vmin.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.smin.v258i8(<256 x i8> %va, <256 x i8> %vb, <256 x i1> %m, i32 %evl)
294 define <256 x i8> @vmin_vx_v258i8_unmasked(<256 x i8> %va, i8 %b, i32 zeroext %evl) {
295 ; CHECK-LABEL: vmin_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: vmin.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: vmin.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.smin.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> @vmin_vx_v258i8_evl129(<256 x i8> %va, i8 %b, <256 x i1> %m) {
321 ; CHECK-LABEL: vmin_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: vmin.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: vmin.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.smin.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> @vmin_vx_v258i8_evl128(<256 x i8> %va, i8 %b, <256 x i1> %m) {
340 ; CHECK-LABEL: vmin_vx_v258i8_evl128:
342 ; CHECK-NEXT: li a1, 128
343 ; CHECK-NEXT: vsetvli zero, a1, e8, m8, ta, ma
344 ; CHECK-NEXT: vmin.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.smin.v258i8(<256 x i8> %va, <256 x i8> %vb, <256 x i1> %m, i32 128)
352 declare <2 x i16> @llvm.vp.smin.v2i16(<2 x i16>, <2 x i16>, <2 x i1>, i32)
354 define <2 x i16> @vmin_vv_v2i16(<2 x i16> %va, <2 x i16> %b, <2 x i1> %m, i32 zeroext %evl) {
355 ; CHECK-LABEL: vmin_vv_v2i16:
357 ; CHECK-NEXT: vsetvli zero, a0, e16, mf4, ta, ma
358 ; CHECK-NEXT: vmin.vv v8, v8, v9, v0.t
360 %v = call <2 x i16> @llvm.vp.smin.v2i16(<2 x i16> %va, <2 x i16> %b, <2 x i1> %m, i32 %evl)
364 define <2 x i16> @vmin_vv_v2i16_unmasked(<2 x i16> %va, <2 x i16> %b, i32 zeroext %evl) {
365 ; CHECK-LABEL: vmin_vv_v2i16_unmasked:
367 ; CHECK-NEXT: vsetvli zero, a0, e16, mf4, ta, ma
368 ; CHECK-NEXT: vmin.vv v8, v8, v9
370 %v = call <2 x i16> @llvm.vp.smin.v2i16(<2 x i16> %va, <2 x i16> %b, <2 x i1> splat (i1 true), i32 %evl)
374 define <2 x i16> @vmin_vx_v2i16(<2 x i16> %va, i16 %b, <2 x i1> %m, i32 zeroext %evl) {
375 ; CHECK-LABEL: vmin_vx_v2i16:
377 ; CHECK-NEXT: vsetvli zero, a1, e16, mf4, ta, ma
378 ; CHECK-NEXT: vmin.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.smin.v2i16(<2 x i16> %va, <2 x i16> %vb, <2 x i1> %m, i32 %evl)
386 define <2 x i16> @vmin_vx_v2i16_unmasked(<2 x i16> %va, i16 %b, i32 zeroext %evl) {
387 ; CHECK-LABEL: vmin_vx_v2i16_unmasked:
389 ; CHECK-NEXT: vsetvli zero, a1, e16, mf4, ta, ma
390 ; CHECK-NEXT: vmin.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.smin.v2i16(<2 x i16> %va, <2 x i16> %vb, <2 x i1> splat (i1 true), i32 %evl)
398 declare <4 x i16> @llvm.vp.smin.v4i16(<4 x i16>, <4 x i16>, <4 x i1>, i32)
400 define <4 x i16> @vmin_vv_v4i16(<4 x i16> %va, <4 x i16> %b, <4 x i1> %m, i32 zeroext %evl) {
401 ; CHECK-LABEL: vmin_vv_v4i16:
403 ; CHECK-NEXT: vsetvli zero, a0, e16, mf2, ta, ma
404 ; CHECK-NEXT: vmin.vv v8, v8, v9, v0.t
406 %v = call <4 x i16> @llvm.vp.smin.v4i16(<4 x i16> %va, <4 x i16> %b, <4 x i1> %m, i32 %evl)
410 define <4 x i16> @vmin_vv_v4i16_unmasked(<4 x i16> %va, <4 x i16> %b, i32 zeroext %evl) {
411 ; CHECK-LABEL: vmin_vv_v4i16_unmasked:
413 ; CHECK-NEXT: vsetvli zero, a0, e16, mf2, ta, ma
414 ; CHECK-NEXT: vmin.vv v8, v8, v9
416 %v = call <4 x i16> @llvm.vp.smin.v4i16(<4 x i16> %va, <4 x i16> %b, <4 x i1> splat (i1 true), i32 %evl)
420 define <4 x i16> @vmin_vx_v4i16(<4 x i16> %va, i16 %b, <4 x i1> %m, i32 zeroext %evl) {
421 ; CHECK-LABEL: vmin_vx_v4i16:
423 ; CHECK-NEXT: vsetvli zero, a1, e16, mf2, ta, ma
424 ; CHECK-NEXT: vmin.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.smin.v4i16(<4 x i16> %va, <4 x i16> %vb, <4 x i1> %m, i32 %evl)
432 define <4 x i16> @vmin_vx_v4i16_unmasked(<4 x i16> %va, i16 %b, i32 zeroext %evl) {
433 ; CHECK-LABEL: vmin_vx_v4i16_unmasked:
435 ; CHECK-NEXT: vsetvli zero, a1, e16, mf2, ta, ma
436 ; CHECK-NEXT: vmin.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.smin.v4i16(<4 x i16> %va, <4 x i16> %vb, <4 x i1> splat (i1 true), i32 %evl)
444 declare <8 x i16> @llvm.vp.smin.v8i16(<8 x i16>, <8 x i16>, <8 x i1>, i32)
446 define <8 x i16> @vmin_vv_v8i16(<8 x i16> %va, <8 x i16> %b, <8 x i1> %m, i32 zeroext %evl) {
447 ; CHECK-LABEL: vmin_vv_v8i16:
449 ; CHECK-NEXT: vsetvli zero, a0, e16, m1, ta, ma
450 ; CHECK-NEXT: vmin.vv v8, v8, v9, v0.t
452 %v = call <8 x i16> @llvm.vp.smin.v8i16(<8 x i16> %va, <8 x i16> %b, <8 x i1> %m, i32 %evl)
456 define <8 x i16> @vmin_vv_v8i16_unmasked(<8 x i16> %va, <8 x i16> %b, i32 zeroext %evl) {
457 ; CHECK-LABEL: vmin_vv_v8i16_unmasked:
459 ; CHECK-NEXT: vsetvli zero, a0, e16, m1, ta, ma
460 ; CHECK-NEXT: vmin.vv v8, v8, v9
462 %v = call <8 x i16> @llvm.vp.smin.v8i16(<8 x i16> %va, <8 x i16> %b, <8 x i1> splat (i1 true), i32 %evl)
466 define <8 x i16> @vmin_vx_v8i16(<8 x i16> %va, i16 %b, <8 x i1> %m, i32 zeroext %evl) {
467 ; CHECK-LABEL: vmin_vx_v8i16:
469 ; CHECK-NEXT: vsetvli zero, a1, e16, m1, ta, ma
470 ; CHECK-NEXT: vmin.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.smin.v8i16(<8 x i16> %va, <8 x i16> %vb, <8 x i1> %m, i32 %evl)
478 define <8 x i16> @vmin_vx_v8i16_unmasked(<8 x i16> %va, i16 %b, i32 zeroext %evl) {
479 ; CHECK-LABEL: vmin_vx_v8i16_unmasked:
481 ; CHECK-NEXT: vsetvli zero, a1, e16, m1, ta, ma
482 ; CHECK-NEXT: vmin.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.smin.v8i16(<8 x i16> %va, <8 x i16> %vb, <8 x i1> splat (i1 true), i32 %evl)
490 declare <16 x i16> @llvm.vp.smin.v16i16(<16 x i16>, <16 x i16>, <16 x i1>, i32)
492 define <16 x i16> @vmin_vv_v16i16(<16 x i16> %va, <16 x i16> %b, <16 x i1> %m, i32 zeroext %evl) {
493 ; CHECK-LABEL: vmin_vv_v16i16:
495 ; CHECK-NEXT: vsetvli zero, a0, e16, m2, ta, ma
496 ; CHECK-NEXT: vmin.vv v8, v8, v10, v0.t
498 %v = call <16 x i16> @llvm.vp.smin.v16i16(<16 x i16> %va, <16 x i16> %b, <16 x i1> %m, i32 %evl)
502 define <16 x i16> @vmin_vv_v16i16_unmasked(<16 x i16> %va, <16 x i16> %b, i32 zeroext %evl) {
503 ; CHECK-LABEL: vmin_vv_v16i16_unmasked:
505 ; CHECK-NEXT: vsetvli zero, a0, e16, m2, ta, ma
506 ; CHECK-NEXT: vmin.vv v8, v8, v10
508 %v = call <16 x i16> @llvm.vp.smin.v16i16(<16 x i16> %va, <16 x i16> %b, <16 x i1> splat (i1 true), i32 %evl)
512 define <16 x i16> @vmin_vx_v16i16(<16 x i16> %va, i16 %b, <16 x i1> %m, i32 zeroext %evl) {
513 ; CHECK-LABEL: vmin_vx_v16i16:
515 ; CHECK-NEXT: vsetvli zero, a1, e16, m2, ta, ma
516 ; CHECK-NEXT: vmin.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.smin.v16i16(<16 x i16> %va, <16 x i16> %vb, <16 x i1> %m, i32 %evl)
524 define <16 x i16> @vmin_vx_v16i16_unmasked(<16 x i16> %va, i16 %b, i32 zeroext %evl) {
525 ; CHECK-LABEL: vmin_vx_v16i16_unmasked:
527 ; CHECK-NEXT: vsetvli zero, a1, e16, m2, ta, ma
528 ; CHECK-NEXT: vmin.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.smin.v16i16(<16 x i16> %va, <16 x i16> %vb, <16 x i1> splat (i1 true), i32 %evl)
536 declare <2 x i32> @llvm.vp.smin.v2i32(<2 x i32>, <2 x i32>, <2 x i1>, i32)
538 define <2 x i32> @vmin_vv_v2i32(<2 x i32> %va, <2 x i32> %b, <2 x i1> %m, i32 zeroext %evl) {
539 ; CHECK-LABEL: vmin_vv_v2i32:
541 ; CHECK-NEXT: vsetvli zero, a0, e32, mf2, ta, ma
542 ; CHECK-NEXT: vmin.vv v8, v8, v9, v0.t
544 %v = call <2 x i32> @llvm.vp.smin.v2i32(<2 x i32> %va, <2 x i32> %b, <2 x i1> %m, i32 %evl)
548 define <2 x i32> @vmin_vv_v2i32_unmasked(<2 x i32> %va, <2 x i32> %b, i32 zeroext %evl) {
549 ; CHECK-LABEL: vmin_vv_v2i32_unmasked:
551 ; CHECK-NEXT: vsetvli zero, a0, e32, mf2, ta, ma
552 ; CHECK-NEXT: vmin.vv v8, v8, v9
554 %v = call <2 x i32> @llvm.vp.smin.v2i32(<2 x i32> %va, <2 x i32> %b, <2 x i1> splat (i1 true), i32 %evl)
558 define <2 x i32> @vmin_vx_v2i32(<2 x i32> %va, i32 %b, <2 x i1> %m, i32 zeroext %evl) {
559 ; CHECK-LABEL: vmin_vx_v2i32:
561 ; CHECK-NEXT: vsetvli zero, a1, e32, mf2, ta, ma
562 ; CHECK-NEXT: vmin.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.smin.v2i32(<2 x i32> %va, <2 x i32> %vb, <2 x i1> %m, i32 %evl)
570 define <2 x i32> @vmin_vx_v2i32_unmasked(<2 x i32> %va, i32 %b, i32 zeroext %evl) {
571 ; CHECK-LABEL: vmin_vx_v2i32_unmasked:
573 ; CHECK-NEXT: vsetvli zero, a1, e32, mf2, ta, ma
574 ; CHECK-NEXT: vmin.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.smin.v2i32(<2 x i32> %va, <2 x i32> %vb, <2 x i1> splat (i1 true), i32 %evl)
582 declare <4 x i32> @llvm.vp.smin.v4i32(<4 x i32>, <4 x i32>, <4 x i1>, i32)
584 define <4 x i32> @vmin_vv_v4i32(<4 x i32> %va, <4 x i32> %b, <4 x i1> %m, i32 zeroext %evl) {
585 ; CHECK-LABEL: vmin_vv_v4i32:
587 ; CHECK-NEXT: vsetvli zero, a0, e32, m1, ta, ma
588 ; CHECK-NEXT: vmin.vv v8, v8, v9, v0.t
590 %v = call <4 x i32> @llvm.vp.smin.v4i32(<4 x i32> %va, <4 x i32> %b, <4 x i1> %m, i32 %evl)
594 define <4 x i32> @vmin_vv_v4i32_unmasked(<4 x i32> %va, <4 x i32> %b, i32 zeroext %evl) {
595 ; CHECK-LABEL: vmin_vv_v4i32_unmasked:
597 ; CHECK-NEXT: vsetvli zero, a0, e32, m1, ta, ma
598 ; CHECK-NEXT: vmin.vv v8, v8, v9
600 %v = call <4 x i32> @llvm.vp.smin.v4i32(<4 x i32> %va, <4 x i32> %b, <4 x i1> splat (i1 true), i32 %evl)
604 define <4 x i32> @vmin_vx_v4i32(<4 x i32> %va, i32 %b, <4 x i1> %m, i32 zeroext %evl) {
605 ; CHECK-LABEL: vmin_vx_v4i32:
607 ; CHECK-NEXT: vsetvli zero, a1, e32, m1, ta, ma
608 ; CHECK-NEXT: vmin.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.smin.v4i32(<4 x i32> %va, <4 x i32> %vb, <4 x i1> %m, i32 %evl)
616 define <4 x i32> @vmin_vx_v4i32_unmasked(<4 x i32> %va, i32 %b, i32 zeroext %evl) {
617 ; CHECK-LABEL: vmin_vx_v4i32_unmasked:
619 ; CHECK-NEXT: vsetvli zero, a1, e32, m1, ta, ma
620 ; CHECK-NEXT: vmin.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.smin.v4i32(<4 x i32> %va, <4 x i32> %vb, <4 x i1> splat (i1 true), i32 %evl)
628 declare <8 x i32> @llvm.vp.smin.v8i32(<8 x i32>, <8 x i32>, <8 x i1>, i32)
630 define <8 x i32> @vmin_vv_v8i32(<8 x i32> %va, <8 x i32> %b, <8 x i1> %m, i32 zeroext %evl) {
631 ; CHECK-LABEL: vmin_vv_v8i32:
633 ; CHECK-NEXT: vsetvli zero, a0, e32, m2, ta, ma
634 ; CHECK-NEXT: vmin.vv v8, v8, v10, v0.t
636 %v = call <8 x i32> @llvm.vp.smin.v8i32(<8 x i32> %va, <8 x i32> %b, <8 x i1> %m, i32 %evl)
640 define <8 x i32> @vmin_vv_v8i32_unmasked(<8 x i32> %va, <8 x i32> %b, i32 zeroext %evl) {
641 ; CHECK-LABEL: vmin_vv_v8i32_unmasked:
643 ; CHECK-NEXT: vsetvli zero, a0, e32, m2, ta, ma
644 ; CHECK-NEXT: vmin.vv v8, v8, v10
646 %v = call <8 x i32> @llvm.vp.smin.v8i32(<8 x i32> %va, <8 x i32> %b, <8 x i1> splat (i1 true), i32 %evl)
650 define <8 x i32> @vmin_vx_v8i32(<8 x i32> %va, i32 %b, <8 x i1> %m, i32 zeroext %evl) {
651 ; CHECK-LABEL: vmin_vx_v8i32:
653 ; CHECK-NEXT: vsetvli zero, a1, e32, m2, ta, ma
654 ; CHECK-NEXT: vmin.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.smin.v8i32(<8 x i32> %va, <8 x i32> %vb, <8 x i1> %m, i32 %evl)
662 define <8 x i32> @vmin_vx_v8i32_unmasked(<8 x i32> %va, i32 %b, i32 zeroext %evl) {
663 ; CHECK-LABEL: vmin_vx_v8i32_unmasked:
665 ; CHECK-NEXT: vsetvli zero, a1, e32, m2, ta, ma
666 ; CHECK-NEXT: vmin.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.smin.v8i32(<8 x i32> %va, <8 x i32> %vb, <8 x i1> splat (i1 true), i32 %evl)
674 declare <16 x i32> @llvm.vp.smin.v16i32(<16 x i32>, <16 x i32>, <16 x i1>, i32)
676 define <16 x i32> @vmin_vv_v16i32(<16 x i32> %va, <16 x i32> %b, <16 x i1> %m, i32 zeroext %evl) {
677 ; CHECK-LABEL: vmin_vv_v16i32:
679 ; CHECK-NEXT: vsetvli zero, a0, e32, m4, ta, ma
680 ; CHECK-NEXT: vmin.vv v8, v8, v12, v0.t
682 %v = call <16 x i32> @llvm.vp.smin.v16i32(<16 x i32> %va, <16 x i32> %b, <16 x i1> %m, i32 %evl)
686 define <16 x i32> @vmin_vv_v16i32_unmasked(<16 x i32> %va, <16 x i32> %b, i32 zeroext %evl) {
687 ; CHECK-LABEL: vmin_vv_v16i32_unmasked:
689 ; CHECK-NEXT: vsetvli zero, a0, e32, m4, ta, ma
690 ; CHECK-NEXT: vmin.vv v8, v8, v12
692 %v = call <16 x i32> @llvm.vp.smin.v16i32(<16 x i32> %va, <16 x i32> %b, <16 x i1> splat (i1 true), i32 %evl)
696 define <16 x i32> @vmin_vx_v16i32(<16 x i32> %va, i32 %b, <16 x i1> %m, i32 zeroext %evl) {
697 ; CHECK-LABEL: vmin_vx_v16i32:
699 ; CHECK-NEXT: vsetvli zero, a1, e32, m4, ta, ma
700 ; CHECK-NEXT: vmin.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.smin.v16i32(<16 x i32> %va, <16 x i32> %vb, <16 x i1> %m, i32 %evl)
708 define <16 x i32> @vmin_vx_v16i32_unmasked(<16 x i32> %va, i32 %b, i32 zeroext %evl) {
709 ; CHECK-LABEL: vmin_vx_v16i32_unmasked:
711 ; CHECK-NEXT: vsetvli zero, a1, e32, m4, ta, ma
712 ; CHECK-NEXT: vmin.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.smin.v16i32(<16 x i32> %va, <16 x i32> %vb, <16 x i1> splat (i1 true), i32 %evl)
720 declare <2 x i64> @llvm.vp.smin.v2i64(<2 x i64>, <2 x i64>, <2 x i1>, i32)
722 define <2 x i64> @vmin_vv_v2i64(<2 x i64> %va, <2 x i64> %b, <2 x i1> %m, i32 zeroext %evl) {
723 ; CHECK-LABEL: vmin_vv_v2i64:
725 ; CHECK-NEXT: vsetvli zero, a0, e64, m1, ta, ma
726 ; CHECK-NEXT: vmin.vv v8, v8, v9, v0.t
728 %v = call <2 x i64> @llvm.vp.smin.v2i64(<2 x i64> %va, <2 x i64> %b, <2 x i1> %m, i32 %evl)
732 define <2 x i64> @vmin_vv_v2i64_unmasked(<2 x i64> %va, <2 x i64> %b, i32 zeroext %evl) {
733 ; CHECK-LABEL: vmin_vv_v2i64_unmasked:
735 ; CHECK-NEXT: vsetvli zero, a0, e64, m1, ta, ma
736 ; CHECK-NEXT: vmin.vv v8, v8, v9
738 %v = call <2 x i64> @llvm.vp.smin.v2i64(<2 x i64> %va, <2 x i64> %b, <2 x i1> splat (i1 true), i32 %evl)
742 define <2 x i64> @vmin_vx_v2i64(<2 x i64> %va, i64 %b, <2 x i1> %m, i32 zeroext %evl) {
743 ; RV32-LABEL: vmin_vx_v2i64:
745 ; RV32-NEXT: addi sp, sp, -16
746 ; RV32-NEXT: .cfi_def_cfa_offset 16
747 ; RV32-NEXT: sw a0, 8(sp)
748 ; RV32-NEXT: sw a1, 12(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: vmin.vv v8, v8, v9, v0.t
754 ; RV32-NEXT: addi sp, sp, 16
755 ; RV32-NEXT: .cfi_def_cfa_offset 0
758 ; RV64-LABEL: vmin_vx_v2i64:
760 ; RV64-NEXT: vsetvli zero, a1, e64, m1, ta, ma
761 ; RV64-NEXT: vmin.vx v8, v8, a0, v0.t
763 %elt.head = insertelement <2 x i64> poison, i64 %b, i32 0
764 %vb = shufflevector <2 x i64> %elt.head, <2 x i64> poison, <2 x i32> zeroinitializer
765 %v = call <2 x i64> @llvm.vp.smin.v2i64(<2 x i64> %va, <2 x i64> %vb, <2 x i1> %m, i32 %evl)
769 define <2 x i64> @vmin_vx_v2i64_unmasked(<2 x i64> %va, i64 %b, i32 zeroext %evl) {
770 ; RV32-LABEL: vmin_vx_v2i64_unmasked:
772 ; RV32-NEXT: addi sp, sp, -16
773 ; RV32-NEXT: .cfi_def_cfa_offset 16
774 ; RV32-NEXT: sw a0, 8(sp)
775 ; RV32-NEXT: sw a1, 12(sp)
776 ; RV32-NEXT: addi a0, sp, 8
777 ; RV32-NEXT: vsetivli zero, 2, e64, m1, ta, ma
778 ; RV32-NEXT: vlse64.v v9, (a0), zero
779 ; RV32-NEXT: vsetvli zero, a2, e64, m1, ta, ma
780 ; RV32-NEXT: vmin.vv v8, v8, v9
781 ; RV32-NEXT: addi sp, sp, 16
782 ; RV32-NEXT: .cfi_def_cfa_offset 0
785 ; RV64-LABEL: vmin_vx_v2i64_unmasked:
787 ; RV64-NEXT: vsetvli zero, a1, e64, m1, ta, ma
788 ; RV64-NEXT: vmin.vx v8, v8, a0
790 %elt.head = insertelement <2 x i64> poison, i64 %b, i32 0
791 %vb = shufflevector <2 x i64> %elt.head, <2 x i64> poison, <2 x i32> zeroinitializer
792 %v = call <2 x i64> @llvm.vp.smin.v2i64(<2 x i64> %va, <2 x i64> %vb, <2 x i1> splat (i1 true), i32 %evl)
796 declare <4 x i64> @llvm.vp.smin.v4i64(<4 x i64>, <4 x i64>, <4 x i1>, i32)
798 define <4 x i64> @vmin_vv_v4i64(<4 x i64> %va, <4 x i64> %b, <4 x i1> %m, i32 zeroext %evl) {
799 ; CHECK-LABEL: vmin_vv_v4i64:
801 ; CHECK-NEXT: vsetvli zero, a0, e64, m2, ta, ma
802 ; CHECK-NEXT: vmin.vv v8, v8, v10, v0.t
804 %v = call <4 x i64> @llvm.vp.smin.v4i64(<4 x i64> %va, <4 x i64> %b, <4 x i1> %m, i32 %evl)
808 define <4 x i64> @vmin_vv_v4i64_unmasked(<4 x i64> %va, <4 x i64> %b, i32 zeroext %evl) {
809 ; CHECK-LABEL: vmin_vv_v4i64_unmasked:
811 ; CHECK-NEXT: vsetvli zero, a0, e64, m2, ta, ma
812 ; CHECK-NEXT: vmin.vv v8, v8, v10
814 %v = call <4 x i64> @llvm.vp.smin.v4i64(<4 x i64> %va, <4 x i64> %b, <4 x i1> splat (i1 true), i32 %evl)
818 define <4 x i64> @vmin_vx_v4i64(<4 x i64> %va, i64 %b, <4 x i1> %m, i32 zeroext %evl) {
819 ; RV32-LABEL: vmin_vx_v4i64:
821 ; RV32-NEXT: addi sp, sp, -16
822 ; RV32-NEXT: .cfi_def_cfa_offset 16
823 ; RV32-NEXT: sw a0, 8(sp)
824 ; RV32-NEXT: sw a1, 12(sp)
825 ; RV32-NEXT: addi a0, sp, 8
826 ; RV32-NEXT: vsetivli zero, 4, e64, m2, ta, ma
827 ; RV32-NEXT: vlse64.v v10, (a0), zero
828 ; RV32-NEXT: vsetvli zero, a2, e64, m2, ta, ma
829 ; RV32-NEXT: vmin.vv v8, v8, v10, v0.t
830 ; RV32-NEXT: addi sp, sp, 16
831 ; RV32-NEXT: .cfi_def_cfa_offset 0
834 ; RV64-LABEL: vmin_vx_v4i64:
836 ; RV64-NEXT: vsetvli zero, a1, e64, m2, ta, ma
837 ; RV64-NEXT: vmin.vx v8, v8, a0, v0.t
839 %elt.head = insertelement <4 x i64> poison, i64 %b, i32 0
840 %vb = shufflevector <4 x i64> %elt.head, <4 x i64> poison, <4 x i32> zeroinitializer
841 %v = call <4 x i64> @llvm.vp.smin.v4i64(<4 x i64> %va, <4 x i64> %vb, <4 x i1> %m, i32 %evl)
845 define <4 x i64> @vmin_vx_v4i64_unmasked(<4 x i64> %va, i64 %b, i32 zeroext %evl) {
846 ; RV32-LABEL: vmin_vx_v4i64_unmasked:
848 ; RV32-NEXT: addi sp, sp, -16
849 ; RV32-NEXT: .cfi_def_cfa_offset 16
850 ; RV32-NEXT: sw a0, 8(sp)
851 ; RV32-NEXT: sw a1, 12(sp)
852 ; RV32-NEXT: addi a0, sp, 8
853 ; RV32-NEXT: vsetivli zero, 4, e64, m2, ta, ma
854 ; RV32-NEXT: vlse64.v v10, (a0), zero
855 ; RV32-NEXT: vsetvli zero, a2, e64, m2, ta, ma
856 ; RV32-NEXT: vmin.vv v8, v8, v10
857 ; RV32-NEXT: addi sp, sp, 16
858 ; RV32-NEXT: .cfi_def_cfa_offset 0
861 ; RV64-LABEL: vmin_vx_v4i64_unmasked:
863 ; RV64-NEXT: vsetvli zero, a1, e64, m2, ta, ma
864 ; RV64-NEXT: vmin.vx v8, v8, a0
866 %elt.head = insertelement <4 x i64> poison, i64 %b, i32 0
867 %vb = shufflevector <4 x i64> %elt.head, <4 x i64> poison, <4 x i32> zeroinitializer
868 %v = call <4 x i64> @llvm.vp.smin.v4i64(<4 x i64> %va, <4 x i64> %vb, <4 x i1> splat (i1 true), i32 %evl)
872 declare <8 x i64> @llvm.vp.smin.v8i64(<8 x i64>, <8 x i64>, <8 x i1>, i32)
874 define <8 x i64> @vmin_vv_v8i64(<8 x i64> %va, <8 x i64> %b, <8 x i1> %m, i32 zeroext %evl) {
875 ; CHECK-LABEL: vmin_vv_v8i64:
877 ; CHECK-NEXT: vsetvli zero, a0, e64, m4, ta, ma
878 ; CHECK-NEXT: vmin.vv v8, v8, v12, v0.t
880 %v = call <8 x i64> @llvm.vp.smin.v8i64(<8 x i64> %va, <8 x i64> %b, <8 x i1> %m, i32 %evl)
884 define <8 x i64> @vmin_vv_v8i64_unmasked(<8 x i64> %va, <8 x i64> %b, i32 zeroext %evl) {
885 ; CHECK-LABEL: vmin_vv_v8i64_unmasked:
887 ; CHECK-NEXT: vsetvli zero, a0, e64, m4, ta, ma
888 ; CHECK-NEXT: vmin.vv v8, v8, v12
890 %v = call <8 x i64> @llvm.vp.smin.v8i64(<8 x i64> %va, <8 x i64> %b, <8 x i1> splat (i1 true), i32 %evl)
894 define <8 x i64> @vmin_vx_v8i64(<8 x i64> %va, i64 %b, <8 x i1> %m, i32 zeroext %evl) {
895 ; RV32-LABEL: vmin_vx_v8i64:
897 ; RV32-NEXT: addi sp, sp, -16
898 ; RV32-NEXT: .cfi_def_cfa_offset 16
899 ; RV32-NEXT: sw a0, 8(sp)
900 ; RV32-NEXT: sw a1, 12(sp)
901 ; RV32-NEXT: addi a0, sp, 8
902 ; RV32-NEXT: vsetivli zero, 8, e64, m4, ta, ma
903 ; RV32-NEXT: vlse64.v v12, (a0), zero
904 ; RV32-NEXT: vsetvli zero, a2, e64, m4, ta, ma
905 ; RV32-NEXT: vmin.vv v8, v8, v12, v0.t
906 ; RV32-NEXT: addi sp, sp, 16
907 ; RV32-NEXT: .cfi_def_cfa_offset 0
910 ; RV64-LABEL: vmin_vx_v8i64:
912 ; RV64-NEXT: vsetvli zero, a1, e64, m4, ta, ma
913 ; RV64-NEXT: vmin.vx v8, v8, a0, v0.t
915 %elt.head = insertelement <8 x i64> poison, i64 %b, i32 0
916 %vb = shufflevector <8 x i64> %elt.head, <8 x i64> poison, <8 x i32> zeroinitializer
917 %v = call <8 x i64> @llvm.vp.smin.v8i64(<8 x i64> %va, <8 x i64> %vb, <8 x i1> %m, i32 %evl)
921 define <8 x i64> @vmin_vx_v8i64_unmasked(<8 x i64> %va, i64 %b, i32 zeroext %evl) {
922 ; RV32-LABEL: vmin_vx_v8i64_unmasked:
924 ; RV32-NEXT: addi sp, sp, -16
925 ; RV32-NEXT: .cfi_def_cfa_offset 16
926 ; RV32-NEXT: sw a0, 8(sp)
927 ; RV32-NEXT: sw a1, 12(sp)
928 ; RV32-NEXT: addi a0, sp, 8
929 ; RV32-NEXT: vsetivli zero, 8, e64, m4, ta, ma
930 ; RV32-NEXT: vlse64.v v12, (a0), zero
931 ; RV32-NEXT: vsetvli zero, a2, e64, m4, ta, ma
932 ; RV32-NEXT: vmin.vv v8, v8, v12
933 ; RV32-NEXT: addi sp, sp, 16
934 ; RV32-NEXT: .cfi_def_cfa_offset 0
937 ; RV64-LABEL: vmin_vx_v8i64_unmasked:
939 ; RV64-NEXT: vsetvli zero, a1, e64, m4, ta, ma
940 ; RV64-NEXT: vmin.vx v8, v8, a0
942 %elt.head = insertelement <8 x i64> poison, i64 %b, i32 0
943 %vb = shufflevector <8 x i64> %elt.head, <8 x i64> poison, <8 x i32> zeroinitializer
944 %v = call <8 x i64> @llvm.vp.smin.v8i64(<8 x i64> %va, <8 x i64> %vb, <8 x i1> splat (i1 true), i32 %evl)
948 declare <16 x i64> @llvm.vp.smin.v16i64(<16 x i64>, <16 x i64>, <16 x i1>, i32)
950 define <16 x i64> @vmin_vv_v16i64(<16 x i64> %va, <16 x i64> %b, <16 x i1> %m, i32 zeroext %evl) {
951 ; CHECK-LABEL: vmin_vv_v16i64:
953 ; CHECK-NEXT: vsetvli zero, a0, e64, m8, ta, ma
954 ; CHECK-NEXT: vmin.vv v8, v8, v16, v0.t
956 %v = call <16 x i64> @llvm.vp.smin.v16i64(<16 x i64> %va, <16 x i64> %b, <16 x i1> %m, i32 %evl)
960 define <16 x i64> @vmin_vv_v16i64_unmasked(<16 x i64> %va, <16 x i64> %b, i32 zeroext %evl) {
961 ; CHECK-LABEL: vmin_vv_v16i64_unmasked:
963 ; CHECK-NEXT: vsetvli zero, a0, e64, m8, ta, ma
964 ; CHECK-NEXT: vmin.vv v8, v8, v16
966 %v = call <16 x i64> @llvm.vp.smin.v16i64(<16 x i64> %va, <16 x i64> %b, <16 x i1> splat (i1 true), i32 %evl)
970 define <16 x i64> @vmin_vx_v16i64(<16 x i64> %va, i64 %b, <16 x i1> %m, i32 zeroext %evl) {
971 ; RV32-LABEL: vmin_vx_v16i64:
973 ; RV32-NEXT: addi sp, sp, -16
974 ; RV32-NEXT: .cfi_def_cfa_offset 16
975 ; RV32-NEXT: sw a0, 8(sp)
976 ; RV32-NEXT: sw a1, 12(sp)
977 ; RV32-NEXT: addi a0, sp, 8
978 ; RV32-NEXT: vsetivli zero, 16, e64, m8, ta, ma
979 ; RV32-NEXT: vlse64.v v16, (a0), zero
980 ; RV32-NEXT: vsetvli zero, a2, e64, m8, ta, ma
981 ; RV32-NEXT: vmin.vv v8, v8, v16, v0.t
982 ; RV32-NEXT: addi sp, sp, 16
983 ; RV32-NEXT: .cfi_def_cfa_offset 0
986 ; RV64-LABEL: vmin_vx_v16i64:
988 ; RV64-NEXT: vsetvli zero, a1, e64, m8, ta, ma
989 ; RV64-NEXT: vmin.vx v8, v8, a0, v0.t
991 %elt.head = insertelement <16 x i64> poison, i64 %b, i32 0
992 %vb = shufflevector <16 x i64> %elt.head, <16 x i64> poison, <16 x i32> zeroinitializer
993 %v = call <16 x i64> @llvm.vp.smin.v16i64(<16 x i64> %va, <16 x i64> %vb, <16 x i1> %m, i32 %evl)
997 define <16 x i64> @vmin_vx_v16i64_unmasked(<16 x i64> %va, i64 %b, i32 zeroext %evl) {
998 ; RV32-LABEL: vmin_vx_v16i64_unmasked:
1000 ; RV32-NEXT: addi sp, sp, -16
1001 ; RV32-NEXT: .cfi_def_cfa_offset 16
1002 ; RV32-NEXT: sw a0, 8(sp)
1003 ; RV32-NEXT: sw a1, 12(sp)
1004 ; RV32-NEXT: addi a0, sp, 8
1005 ; RV32-NEXT: vsetivli zero, 16, e64, m8, ta, ma
1006 ; RV32-NEXT: vlse64.v v16, (a0), zero
1007 ; RV32-NEXT: vsetvli zero, a2, e64, m8, ta, ma
1008 ; RV32-NEXT: vmin.vv v8, v8, v16
1009 ; RV32-NEXT: addi sp, sp, 16
1010 ; RV32-NEXT: .cfi_def_cfa_offset 0
1013 ; RV64-LABEL: vmin_vx_v16i64_unmasked:
1015 ; RV64-NEXT: vsetvli zero, a1, e64, m8, ta, ma
1016 ; RV64-NEXT: vmin.vx v8, v8, a0
1018 %elt.head = insertelement <16 x i64> poison, i64 %b, i32 0
1019 %vb = shufflevector <16 x i64> %elt.head, <16 x i64> poison, <16 x i32> zeroinitializer
1020 %v = call <16 x i64> @llvm.vp.smin.v16i64(<16 x i64> %va, <16 x i64> %vb, <16 x i1> splat (i1 true), i32 %evl)
1024 ; Test that split-legalization works as expected.
1026 declare <32 x i64> @llvm.vp.smin.v32i64(<32 x i64>, <32 x i64>, <32 x i1>, i32)
1028 define <32 x i64> @vmin_vx_v32i64(<32 x i64> %va, <32 x i1> %m, i32 zeroext %evl) {
1029 ; CHECK-LABEL: vmin_vx_v32i64:
1031 ; CHECK-NEXT: li a2, 16
1032 ; CHECK-NEXT: vsetivli zero, 2, e8, mf4, ta, ma
1033 ; CHECK-NEXT: vslidedown.vi v24, v0, 2
1034 ; CHECK-NEXT: mv a1, a0
1035 ; CHECK-NEXT: bltu a0, a2, .LBB74_2
1036 ; CHECK-NEXT: # %bb.1:
1037 ; CHECK-NEXT: li a1, 16
1038 ; CHECK-NEXT: .LBB74_2:
1039 ; CHECK-NEXT: li a2, -1
1040 ; CHECK-NEXT: vsetvli zero, a1, e64, m8, ta, ma
1041 ; CHECK-NEXT: vmin.vx v8, v8, a2, v0.t
1042 ; CHECK-NEXT: addi a1, a0, -16
1043 ; CHECK-NEXT: sltu a0, a0, a1
1044 ; CHECK-NEXT: addi a0, a0, -1
1045 ; CHECK-NEXT: and a0, a0, a1
1046 ; CHECK-NEXT: vmv1r.v v0, v24
1047 ; CHECK-NEXT: vsetvli zero, a0, e64, m8, ta, ma
1048 ; CHECK-NEXT: vmin.vx v16, v16, a2, v0.t
1050 %v = call <32 x i64> @llvm.vp.smin.v32i64(<32 x i64> %va, <32 x i64> splat (i64 -1), <32 x i1> %m, i32 %evl)