1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=riscv32 -mattr=+v -verify-machineinstrs < %s | FileCheck %s --check-prefixes=CHECK,RV32
3 ; RUN: llc -mtriple=riscv64 -mattr=+v -verify-machineinstrs < %s | FileCheck %s --check-prefixes=CHECK,RV64
5 define <vscale x 1 x i8> @vmin_vv_nxv1i8(<vscale x 1 x i8> %va, <vscale x 1 x i8> %vb) {
6 ; CHECK-LABEL: vmin_vv_nxv1i8:
8 ; CHECK-NEXT: vsetvli a0, zero, e8, mf8, ta, ma
9 ; CHECK-NEXT: vminu.vv v8, v8, v9
11 %cmp = icmp ult <vscale x 1 x i8> %va, %vb
12 %vc = select <vscale x 1 x i1> %cmp, <vscale x 1 x i8> %va, <vscale x 1 x i8> %vb
13 ret <vscale x 1 x i8> %vc
16 define <vscale x 1 x i8> @vmin_vx_nxv1i8(<vscale x 1 x i8> %va, i8 signext %b) {
17 ; CHECK-LABEL: vmin_vx_nxv1i8:
19 ; CHECK-NEXT: vsetvli a1, zero, e8, mf8, ta, ma
20 ; CHECK-NEXT: vminu.vx v8, v8, a0
22 %head = insertelement <vscale x 1 x i8> poison, i8 %b, i32 0
23 %splat = shufflevector <vscale x 1 x i8> %head, <vscale x 1 x i8> poison, <vscale x 1 x i32> zeroinitializer
24 %cmp = icmp ult <vscale x 1 x i8> %va, %splat
25 %vc = select <vscale x 1 x i1> %cmp, <vscale x 1 x i8> %va, <vscale x 1 x i8> %splat
26 ret <vscale x 1 x i8> %vc
29 define <vscale x 1 x i8> @vmin_vi_nxv1i8_0(<vscale x 1 x i8> %va) {
30 ; CHECK-LABEL: vmin_vi_nxv1i8_0:
32 ; CHECK-NEXT: li a0, -3
33 ; CHECK-NEXT: vsetvli a1, zero, e8, mf8, ta, ma
34 ; CHECK-NEXT: vminu.vx v8, v8, a0
36 %cmp = icmp ult <vscale x 1 x i8> %va, splat (i8 -3)
37 %vc = select <vscale x 1 x i1> %cmp, <vscale x 1 x i8> %va, <vscale x 1 x i8> splat (i8 -3)
38 ret <vscale x 1 x i8> %vc
41 define <vscale x 2 x i8> @vmin_vv_nxv2i8(<vscale x 2 x i8> %va, <vscale x 2 x i8> %vb) {
42 ; CHECK-LABEL: vmin_vv_nxv2i8:
44 ; CHECK-NEXT: vsetvli a0, zero, e8, mf4, ta, ma
45 ; CHECK-NEXT: vminu.vv v8, v8, v9
47 %cmp = icmp ult <vscale x 2 x i8> %va, %vb
48 %vc = select <vscale x 2 x i1> %cmp, <vscale x 2 x i8> %va, <vscale x 2 x i8> %vb
49 ret <vscale x 2 x i8> %vc
52 define <vscale x 2 x i8> @vmin_vx_nxv2i8(<vscale x 2 x i8> %va, i8 signext %b) {
53 ; CHECK-LABEL: vmin_vx_nxv2i8:
55 ; CHECK-NEXT: vsetvli a1, zero, e8, mf4, ta, ma
56 ; CHECK-NEXT: vminu.vx v8, v8, a0
58 %head = insertelement <vscale x 2 x i8> poison, i8 %b, i32 0
59 %splat = shufflevector <vscale x 2 x i8> %head, <vscale x 2 x i8> poison, <vscale x 2 x i32> zeroinitializer
60 %cmp = icmp ult <vscale x 2 x i8> %va, %splat
61 %vc = select <vscale x 2 x i1> %cmp, <vscale x 2 x i8> %va, <vscale x 2 x i8> %splat
62 ret <vscale x 2 x i8> %vc
65 define <vscale x 2 x i8> @vmin_vi_nxv2i8_0(<vscale x 2 x i8> %va) {
66 ; CHECK-LABEL: vmin_vi_nxv2i8_0:
68 ; CHECK-NEXT: li a0, -3
69 ; CHECK-NEXT: vsetvli a1, zero, e8, mf4, ta, ma
70 ; CHECK-NEXT: vminu.vx v8, v8, a0
72 %cmp = icmp ult <vscale x 2 x i8> %va, splat (i8 -3)
73 %vc = select <vscale x 2 x i1> %cmp, <vscale x 2 x i8> %va, <vscale x 2 x i8> splat (i8 -3)
74 ret <vscale x 2 x i8> %vc
77 define <vscale x 4 x i8> @vmin_vv_nxv4i8(<vscale x 4 x i8> %va, <vscale x 4 x i8> %vb) {
78 ; CHECK-LABEL: vmin_vv_nxv4i8:
80 ; CHECK-NEXT: vsetvli a0, zero, e8, mf2, ta, ma
81 ; CHECK-NEXT: vminu.vv v8, v8, v9
83 %cmp = icmp ult <vscale x 4 x i8> %va, %vb
84 %vc = select <vscale x 4 x i1> %cmp, <vscale x 4 x i8> %va, <vscale x 4 x i8> %vb
85 ret <vscale x 4 x i8> %vc
88 define <vscale x 4 x i8> @vmin_vx_nxv4i8(<vscale x 4 x i8> %va, i8 signext %b) {
89 ; CHECK-LABEL: vmin_vx_nxv4i8:
91 ; CHECK-NEXT: vsetvli a1, zero, e8, mf2, ta, ma
92 ; CHECK-NEXT: vminu.vx v8, v8, a0
94 %head = insertelement <vscale x 4 x i8> poison, i8 %b, i32 0
95 %splat = shufflevector <vscale x 4 x i8> %head, <vscale x 4 x i8> poison, <vscale x 4 x i32> zeroinitializer
96 %cmp = icmp ult <vscale x 4 x i8> %va, %splat
97 %vc = select <vscale x 4 x i1> %cmp, <vscale x 4 x i8> %va, <vscale x 4 x i8> %splat
98 ret <vscale x 4 x i8> %vc
101 define <vscale x 4 x i8> @vmin_vi_nxv4i8_0(<vscale x 4 x i8> %va) {
102 ; CHECK-LABEL: vmin_vi_nxv4i8_0:
104 ; CHECK-NEXT: li a0, -3
105 ; CHECK-NEXT: vsetvli a1, zero, e8, mf2, ta, ma
106 ; CHECK-NEXT: vminu.vx v8, v8, a0
108 %cmp = icmp ult <vscale x 4 x i8> %va, splat (i8 -3)
109 %vc = select <vscale x 4 x i1> %cmp, <vscale x 4 x i8> %va, <vscale x 4 x i8> splat (i8 -3)
110 ret <vscale x 4 x i8> %vc
113 define <vscale x 8 x i8> @vmin_vv_nxv8i8(<vscale x 8 x i8> %va, <vscale x 8 x i8> %vb) {
114 ; CHECK-LABEL: vmin_vv_nxv8i8:
116 ; CHECK-NEXT: vsetvli a0, zero, e8, m1, ta, ma
117 ; CHECK-NEXT: vminu.vv v8, v8, v9
119 %cmp = icmp ult <vscale x 8 x i8> %va, %vb
120 %vc = select <vscale x 8 x i1> %cmp, <vscale x 8 x i8> %va, <vscale x 8 x i8> %vb
121 ret <vscale x 8 x i8> %vc
124 define <vscale x 8 x i8> @vmin_vx_nxv8i8(<vscale x 8 x i8> %va, i8 signext %b) {
125 ; CHECK-LABEL: vmin_vx_nxv8i8:
127 ; CHECK-NEXT: vsetvli a1, zero, e8, m1, ta, ma
128 ; CHECK-NEXT: vminu.vx v8, v8, a0
130 %head = insertelement <vscale x 8 x i8> poison, i8 %b, i32 0
131 %splat = shufflevector <vscale x 8 x i8> %head, <vscale x 8 x i8> poison, <vscale x 8 x i32> zeroinitializer
132 %cmp = icmp ult <vscale x 8 x i8> %va, %splat
133 %vc = select <vscale x 8 x i1> %cmp, <vscale x 8 x i8> %va, <vscale x 8 x i8> %splat
134 ret <vscale x 8 x i8> %vc
137 define <vscale x 8 x i8> @vmin_vi_nxv8i8_0(<vscale x 8 x i8> %va) {
138 ; CHECK-LABEL: vmin_vi_nxv8i8_0:
140 ; CHECK-NEXT: li a0, -3
141 ; CHECK-NEXT: vsetvli a1, zero, e8, m1, ta, ma
142 ; CHECK-NEXT: vminu.vx v8, v8, a0
144 %cmp = icmp ult <vscale x 8 x i8> %va, splat (i8 -3)
145 %vc = select <vscale x 8 x i1> %cmp, <vscale x 8 x i8> %va, <vscale x 8 x i8> splat (i8 -3)
146 ret <vscale x 8 x i8> %vc
149 define <vscale x 16 x i8> @vmin_vv_nxv16i8(<vscale x 16 x i8> %va, <vscale x 16 x i8> %vb) {
150 ; CHECK-LABEL: vmin_vv_nxv16i8:
152 ; CHECK-NEXT: vsetvli a0, zero, e8, m2, ta, ma
153 ; CHECK-NEXT: vminu.vv v8, v8, v10
155 %cmp = icmp ult <vscale x 16 x i8> %va, %vb
156 %vc = select <vscale x 16 x i1> %cmp, <vscale x 16 x i8> %va, <vscale x 16 x i8> %vb
157 ret <vscale x 16 x i8> %vc
160 define <vscale x 16 x i8> @vmin_vx_nxv16i8(<vscale x 16 x i8> %va, i8 signext %b) {
161 ; CHECK-LABEL: vmin_vx_nxv16i8:
163 ; CHECK-NEXT: vsetvli a1, zero, e8, m2, ta, ma
164 ; CHECK-NEXT: vminu.vx v8, v8, a0
166 %head = insertelement <vscale x 16 x i8> poison, i8 %b, i32 0
167 %splat = shufflevector <vscale x 16 x i8> %head, <vscale x 16 x i8> poison, <vscale x 16 x i32> zeroinitializer
168 %cmp = icmp ult <vscale x 16 x i8> %va, %splat
169 %vc = select <vscale x 16 x i1> %cmp, <vscale x 16 x i8> %va, <vscale x 16 x i8> %splat
170 ret <vscale x 16 x i8> %vc
173 define <vscale x 16 x i8> @vmin_vi_nxv16i8_0(<vscale x 16 x i8> %va) {
174 ; CHECK-LABEL: vmin_vi_nxv16i8_0:
176 ; CHECK-NEXT: li a0, -3
177 ; CHECK-NEXT: vsetvli a1, zero, e8, m2, ta, ma
178 ; CHECK-NEXT: vminu.vx v8, v8, a0
180 %cmp = icmp ult <vscale x 16 x i8> %va, splat (i8 -3)
181 %vc = select <vscale x 16 x i1> %cmp, <vscale x 16 x i8> %va, <vscale x 16 x i8> splat (i8 -3)
182 ret <vscale x 16 x i8> %vc
185 define <vscale x 32 x i8> @vmin_vv_nxv32i8(<vscale x 32 x i8> %va, <vscale x 32 x i8> %vb) {
186 ; CHECK-LABEL: vmin_vv_nxv32i8:
188 ; CHECK-NEXT: vsetvli a0, zero, e8, m4, ta, ma
189 ; CHECK-NEXT: vminu.vv v8, v8, v12
191 %cmp = icmp ult <vscale x 32 x i8> %va, %vb
192 %vc = select <vscale x 32 x i1> %cmp, <vscale x 32 x i8> %va, <vscale x 32 x i8> %vb
193 ret <vscale x 32 x i8> %vc
196 define <vscale x 32 x i8> @vmin_vx_nxv32i8(<vscale x 32 x i8> %va, i8 signext %b) {
197 ; CHECK-LABEL: vmin_vx_nxv32i8:
199 ; CHECK-NEXT: vsetvli a1, zero, e8, m4, ta, ma
200 ; CHECK-NEXT: vminu.vx v8, v8, a0
202 %head = insertelement <vscale x 32 x i8> poison, i8 %b, i32 0
203 %splat = shufflevector <vscale x 32 x i8> %head, <vscale x 32 x i8> poison, <vscale x 32 x i32> zeroinitializer
204 %cmp = icmp ult <vscale x 32 x i8> %va, %splat
205 %vc = select <vscale x 32 x i1> %cmp, <vscale x 32 x i8> %va, <vscale x 32 x i8> %splat
206 ret <vscale x 32 x i8> %vc
209 define <vscale x 32 x i8> @vmin_vi_nxv32i8_0(<vscale x 32 x i8> %va) {
210 ; CHECK-LABEL: vmin_vi_nxv32i8_0:
212 ; CHECK-NEXT: li a0, -3
213 ; CHECK-NEXT: vsetvli a1, zero, e8, m4, ta, ma
214 ; CHECK-NEXT: vminu.vx v8, v8, a0
216 %cmp = icmp ult <vscale x 32 x i8> %va, splat (i8 -3)
217 %vc = select <vscale x 32 x i1> %cmp, <vscale x 32 x i8> %va, <vscale x 32 x i8> splat (i8 -3)
218 ret <vscale x 32 x i8> %vc
221 define <vscale x 64 x i8> @vmin_vv_nxv64i8(<vscale x 64 x i8> %va, <vscale x 64 x i8> %vb) {
222 ; CHECK-LABEL: vmin_vv_nxv64i8:
224 ; CHECK-NEXT: vsetvli a0, zero, e8, m8, ta, ma
225 ; CHECK-NEXT: vminu.vv v8, v8, v16
227 %cmp = icmp ult <vscale x 64 x i8> %va, %vb
228 %vc = select <vscale x 64 x i1> %cmp, <vscale x 64 x i8> %va, <vscale x 64 x i8> %vb
229 ret <vscale x 64 x i8> %vc
232 define <vscale x 64 x i8> @vmin_vx_nxv64i8(<vscale x 64 x i8> %va, i8 signext %b) {
233 ; CHECK-LABEL: vmin_vx_nxv64i8:
235 ; CHECK-NEXT: vsetvli a1, zero, e8, m8, ta, ma
236 ; CHECK-NEXT: vminu.vx v8, v8, a0
238 %head = insertelement <vscale x 64 x i8> poison, i8 %b, i32 0
239 %splat = shufflevector <vscale x 64 x i8> %head, <vscale x 64 x i8> poison, <vscale x 64 x i32> zeroinitializer
240 %cmp = icmp ult <vscale x 64 x i8> %va, %splat
241 %vc = select <vscale x 64 x i1> %cmp, <vscale x 64 x i8> %va, <vscale x 64 x i8> %splat
242 ret <vscale x 64 x i8> %vc
245 define <vscale x 64 x i8> @vmin_vi_nxv64i8_0(<vscale x 64 x i8> %va) {
246 ; CHECK-LABEL: vmin_vi_nxv64i8_0:
248 ; CHECK-NEXT: li a0, -3
249 ; CHECK-NEXT: vsetvli a1, zero, e8, m8, ta, ma
250 ; CHECK-NEXT: vminu.vx v8, v8, a0
252 %cmp = icmp ult <vscale x 64 x i8> %va, splat (i8 -3)
253 %vc = select <vscale x 64 x i1> %cmp, <vscale x 64 x i8> %va, <vscale x 64 x i8> splat (i8 -3)
254 ret <vscale x 64 x i8> %vc
257 define <vscale x 1 x i16> @vmin_vv_nxv1i16(<vscale x 1 x i16> %va, <vscale x 1 x i16> %vb) {
258 ; CHECK-LABEL: vmin_vv_nxv1i16:
260 ; CHECK-NEXT: vsetvli a0, zero, e16, mf4, ta, ma
261 ; CHECK-NEXT: vminu.vv v8, v8, v9
263 %cmp = icmp ult <vscale x 1 x i16> %va, %vb
264 %vc = select <vscale x 1 x i1> %cmp, <vscale x 1 x i16> %va, <vscale x 1 x i16> %vb
265 ret <vscale x 1 x i16> %vc
268 define <vscale x 1 x i16> @vmin_vx_nxv1i16(<vscale x 1 x i16> %va, i16 signext %b) {
269 ; CHECK-LABEL: vmin_vx_nxv1i16:
271 ; CHECK-NEXT: vsetvli a1, zero, e16, mf4, ta, ma
272 ; CHECK-NEXT: vminu.vx v8, v8, a0
274 %head = insertelement <vscale x 1 x i16> poison, i16 %b, i32 0
275 %splat = shufflevector <vscale x 1 x i16> %head, <vscale x 1 x i16> poison, <vscale x 1 x i32> zeroinitializer
276 %cmp = icmp ult <vscale x 1 x i16> %va, %splat
277 %vc = select <vscale x 1 x i1> %cmp, <vscale x 1 x i16> %va, <vscale x 1 x i16> %splat
278 ret <vscale x 1 x i16> %vc
281 define <vscale x 1 x i16> @vmin_vi_nxv1i16_0(<vscale x 1 x i16> %va) {
282 ; CHECK-LABEL: vmin_vi_nxv1i16_0:
284 ; CHECK-NEXT: li a0, -3
285 ; CHECK-NEXT: vsetvli a1, zero, e16, mf4, ta, ma
286 ; CHECK-NEXT: vminu.vx v8, v8, a0
288 %cmp = icmp ult <vscale x 1 x i16> %va, splat (i16 -3)
289 %vc = select <vscale x 1 x i1> %cmp, <vscale x 1 x i16> %va, <vscale x 1 x i16> splat (i16 -3)
290 ret <vscale x 1 x i16> %vc
293 define <vscale x 2 x i16> @vmin_vv_nxv2i16(<vscale x 2 x i16> %va, <vscale x 2 x i16> %vb) {
294 ; CHECK-LABEL: vmin_vv_nxv2i16:
296 ; CHECK-NEXT: vsetvli a0, zero, e16, mf2, ta, ma
297 ; CHECK-NEXT: vminu.vv v8, v8, v9
299 %cmp = icmp ult <vscale x 2 x i16> %va, %vb
300 %vc = select <vscale x 2 x i1> %cmp, <vscale x 2 x i16> %va, <vscale x 2 x i16> %vb
301 ret <vscale x 2 x i16> %vc
304 define <vscale x 2 x i16> @vmin_vx_nxv2i16(<vscale x 2 x i16> %va, i16 signext %b) {
305 ; CHECK-LABEL: vmin_vx_nxv2i16:
307 ; CHECK-NEXT: vsetvli a1, zero, e16, mf2, ta, ma
308 ; CHECK-NEXT: vminu.vx v8, v8, a0
310 %head = insertelement <vscale x 2 x i16> poison, i16 %b, i32 0
311 %splat = shufflevector <vscale x 2 x i16> %head, <vscale x 2 x i16> poison, <vscale x 2 x i32> zeroinitializer
312 %cmp = icmp ult <vscale x 2 x i16> %va, %splat
313 %vc = select <vscale x 2 x i1> %cmp, <vscale x 2 x i16> %va, <vscale x 2 x i16> %splat
314 ret <vscale x 2 x i16> %vc
317 define <vscale x 2 x i16> @vmin_vi_nxv2i16_0(<vscale x 2 x i16> %va) {
318 ; CHECK-LABEL: vmin_vi_nxv2i16_0:
320 ; CHECK-NEXT: li a0, -3
321 ; CHECK-NEXT: vsetvli a1, zero, e16, mf2, ta, ma
322 ; CHECK-NEXT: vminu.vx v8, v8, a0
324 %cmp = icmp ult <vscale x 2 x i16> %va, splat (i16 -3)
325 %vc = select <vscale x 2 x i1> %cmp, <vscale x 2 x i16> %va, <vscale x 2 x i16> splat (i16 -3)
326 ret <vscale x 2 x i16> %vc
329 define <vscale x 4 x i16> @vmin_vv_nxv4i16(<vscale x 4 x i16> %va, <vscale x 4 x i16> %vb) {
330 ; CHECK-LABEL: vmin_vv_nxv4i16:
332 ; CHECK-NEXT: vsetvli a0, zero, e16, m1, ta, ma
333 ; CHECK-NEXT: vminu.vv v8, v8, v9
335 %cmp = icmp ult <vscale x 4 x i16> %va, %vb
336 %vc = select <vscale x 4 x i1> %cmp, <vscale x 4 x i16> %va, <vscale x 4 x i16> %vb
337 ret <vscale x 4 x i16> %vc
340 define <vscale x 4 x i16> @vmin_vx_nxv4i16(<vscale x 4 x i16> %va, i16 signext %b) {
341 ; CHECK-LABEL: vmin_vx_nxv4i16:
343 ; CHECK-NEXT: vsetvli a1, zero, e16, m1, ta, ma
344 ; CHECK-NEXT: vminu.vx v8, v8, a0
346 %head = insertelement <vscale x 4 x i16> poison, i16 %b, i32 0
347 %splat = shufflevector <vscale x 4 x i16> %head, <vscale x 4 x i16> poison, <vscale x 4 x i32> zeroinitializer
348 %cmp = icmp ult <vscale x 4 x i16> %va, %splat
349 %vc = select <vscale x 4 x i1> %cmp, <vscale x 4 x i16> %va, <vscale x 4 x i16> %splat
350 ret <vscale x 4 x i16> %vc
353 define <vscale x 4 x i16> @vmin_vi_nxv4i16_0(<vscale x 4 x i16> %va) {
354 ; CHECK-LABEL: vmin_vi_nxv4i16_0:
356 ; CHECK-NEXT: li a0, -3
357 ; CHECK-NEXT: vsetvli a1, zero, e16, m1, ta, ma
358 ; CHECK-NEXT: vminu.vx v8, v8, a0
360 %cmp = icmp ult <vscale x 4 x i16> %va, splat (i16 -3)
361 %vc = select <vscale x 4 x i1> %cmp, <vscale x 4 x i16> %va, <vscale x 4 x i16> splat (i16 -3)
362 ret <vscale x 4 x i16> %vc
365 define <vscale x 8 x i16> @vmin_vv_nxv8i16(<vscale x 8 x i16> %va, <vscale x 8 x i16> %vb) {
366 ; CHECK-LABEL: vmin_vv_nxv8i16:
368 ; CHECK-NEXT: vsetvli a0, zero, e16, m2, ta, ma
369 ; CHECK-NEXT: vminu.vv v8, v8, v10
371 %cmp = icmp ult <vscale x 8 x i16> %va, %vb
372 %vc = select <vscale x 8 x i1> %cmp, <vscale x 8 x i16> %va, <vscale x 8 x i16> %vb
373 ret <vscale x 8 x i16> %vc
376 define <vscale x 8 x i16> @vmin_vx_nxv8i16(<vscale x 8 x i16> %va, i16 signext %b) {
377 ; CHECK-LABEL: vmin_vx_nxv8i16:
379 ; CHECK-NEXT: vsetvli a1, zero, e16, m2, ta, ma
380 ; CHECK-NEXT: vminu.vx v8, v8, a0
382 %head = insertelement <vscale x 8 x i16> poison, i16 %b, i32 0
383 %splat = shufflevector <vscale x 8 x i16> %head, <vscale x 8 x i16> poison, <vscale x 8 x i32> zeroinitializer
384 %cmp = icmp ult <vscale x 8 x i16> %va, %splat
385 %vc = select <vscale x 8 x i1> %cmp, <vscale x 8 x i16> %va, <vscale x 8 x i16> %splat
386 ret <vscale x 8 x i16> %vc
389 define <vscale x 8 x i16> @vmin_vi_nxv8i16_0(<vscale x 8 x i16> %va) {
390 ; CHECK-LABEL: vmin_vi_nxv8i16_0:
392 ; CHECK-NEXT: li a0, -3
393 ; CHECK-NEXT: vsetvli a1, zero, e16, m2, ta, ma
394 ; CHECK-NEXT: vminu.vx v8, v8, a0
396 %cmp = icmp ult <vscale x 8 x i16> %va, splat (i16 -3)
397 %vc = select <vscale x 8 x i1> %cmp, <vscale x 8 x i16> %va, <vscale x 8 x i16> splat (i16 -3)
398 ret <vscale x 8 x i16> %vc
401 define <vscale x 16 x i16> @vmin_vv_nxv16i16(<vscale x 16 x i16> %va, <vscale x 16 x i16> %vb) {
402 ; CHECK-LABEL: vmin_vv_nxv16i16:
404 ; CHECK-NEXT: vsetvli a0, zero, e16, m4, ta, ma
405 ; CHECK-NEXT: vminu.vv v8, v8, v12
407 %cmp = icmp ult <vscale x 16 x i16> %va, %vb
408 %vc = select <vscale x 16 x i1> %cmp, <vscale x 16 x i16> %va, <vscale x 16 x i16> %vb
409 ret <vscale x 16 x i16> %vc
412 define <vscale x 16 x i16> @vmin_vx_nxv16i16(<vscale x 16 x i16> %va, i16 signext %b) {
413 ; CHECK-LABEL: vmin_vx_nxv16i16:
415 ; CHECK-NEXT: vsetvli a1, zero, e16, m4, ta, ma
416 ; CHECK-NEXT: vminu.vx v8, v8, a0
418 %head = insertelement <vscale x 16 x i16> poison, i16 %b, i32 0
419 %splat = shufflevector <vscale x 16 x i16> %head, <vscale x 16 x i16> poison, <vscale x 16 x i32> zeroinitializer
420 %cmp = icmp ult <vscale x 16 x i16> %va, %splat
421 %vc = select <vscale x 16 x i1> %cmp, <vscale x 16 x i16> %va, <vscale x 16 x i16> %splat
422 ret <vscale x 16 x i16> %vc
425 define <vscale x 16 x i16> @vmin_vi_nxv16i16_0(<vscale x 16 x i16> %va) {
426 ; CHECK-LABEL: vmin_vi_nxv16i16_0:
428 ; CHECK-NEXT: li a0, -3
429 ; CHECK-NEXT: vsetvli a1, zero, e16, m4, ta, ma
430 ; CHECK-NEXT: vminu.vx v8, v8, a0
432 %cmp = icmp ult <vscale x 16 x i16> %va, splat (i16 -3)
433 %vc = select <vscale x 16 x i1> %cmp, <vscale x 16 x i16> %va, <vscale x 16 x i16> splat (i16 -3)
434 ret <vscale x 16 x i16> %vc
437 define <vscale x 32 x i16> @vmin_vv_nxv32i16(<vscale x 32 x i16> %va, <vscale x 32 x i16> %vb) {
438 ; CHECK-LABEL: vmin_vv_nxv32i16:
440 ; CHECK-NEXT: vsetvli a0, zero, e16, m8, ta, ma
441 ; CHECK-NEXT: vminu.vv v8, v8, v16
443 %cmp = icmp ult <vscale x 32 x i16> %va, %vb
444 %vc = select <vscale x 32 x i1> %cmp, <vscale x 32 x i16> %va, <vscale x 32 x i16> %vb
445 ret <vscale x 32 x i16> %vc
448 define <vscale x 32 x i16> @vmin_vx_nxv32i16(<vscale x 32 x i16> %va, i16 signext %b) {
449 ; CHECK-LABEL: vmin_vx_nxv32i16:
451 ; CHECK-NEXT: vsetvli a1, zero, e16, m8, ta, ma
452 ; CHECK-NEXT: vminu.vx v8, v8, a0
454 %head = insertelement <vscale x 32 x i16> poison, i16 %b, i32 0
455 %splat = shufflevector <vscale x 32 x i16> %head, <vscale x 32 x i16> poison, <vscale x 32 x i32> zeroinitializer
456 %cmp = icmp ult <vscale x 32 x i16> %va, %splat
457 %vc = select <vscale x 32 x i1> %cmp, <vscale x 32 x i16> %va, <vscale x 32 x i16> %splat
458 ret <vscale x 32 x i16> %vc
461 define <vscale x 32 x i16> @vmin_vi_nxv32i16_0(<vscale x 32 x i16> %va) {
462 ; CHECK-LABEL: vmin_vi_nxv32i16_0:
464 ; CHECK-NEXT: li a0, -3
465 ; CHECK-NEXT: vsetvli a1, zero, e16, m8, ta, ma
466 ; CHECK-NEXT: vminu.vx v8, v8, a0
468 %cmp = icmp ult <vscale x 32 x i16> %va, splat (i16 -3)
469 %vc = select <vscale x 32 x i1> %cmp, <vscale x 32 x i16> %va, <vscale x 32 x i16> splat (i16 -3)
470 ret <vscale x 32 x i16> %vc
473 define <vscale x 1 x i32> @vmin_vv_nxv1i32(<vscale x 1 x i32> %va, <vscale x 1 x i32> %vb) {
474 ; CHECK-LABEL: vmin_vv_nxv1i32:
476 ; CHECK-NEXT: vsetvli a0, zero, e32, mf2, ta, ma
477 ; CHECK-NEXT: vminu.vv v8, v8, v9
479 %cmp = icmp ult <vscale x 1 x i32> %va, %vb
480 %vc = select <vscale x 1 x i1> %cmp, <vscale x 1 x i32> %va, <vscale x 1 x i32> %vb
481 ret <vscale x 1 x i32> %vc
484 define <vscale x 1 x i32> @vmin_vx_nxv1i32(<vscale x 1 x i32> %va, i32 signext %b) {
485 ; CHECK-LABEL: vmin_vx_nxv1i32:
487 ; CHECK-NEXT: vsetvli a1, zero, e32, mf2, ta, ma
488 ; CHECK-NEXT: vminu.vx v8, v8, a0
490 %head = insertelement <vscale x 1 x i32> poison, i32 %b, i32 0
491 %splat = shufflevector <vscale x 1 x i32> %head, <vscale x 1 x i32> poison, <vscale x 1 x i32> zeroinitializer
492 %cmp = icmp ult <vscale x 1 x i32> %va, %splat
493 %vc = select <vscale x 1 x i1> %cmp, <vscale x 1 x i32> %va, <vscale x 1 x i32> %splat
494 ret <vscale x 1 x i32> %vc
497 define <vscale x 1 x i32> @vmin_vi_nxv1i32_0(<vscale x 1 x i32> %va) {
498 ; CHECK-LABEL: vmin_vi_nxv1i32_0:
500 ; CHECK-NEXT: li a0, -3
501 ; CHECK-NEXT: vsetvli a1, zero, e32, mf2, ta, ma
502 ; CHECK-NEXT: vminu.vx v8, v8, a0
504 %cmp = icmp ult <vscale x 1 x i32> %va, splat (i32 -3)
505 %vc = select <vscale x 1 x i1> %cmp, <vscale x 1 x i32> %va, <vscale x 1 x i32> splat (i32 -3)
506 ret <vscale x 1 x i32> %vc
509 define <vscale x 2 x i32> @vmin_vv_nxv2i32(<vscale x 2 x i32> %va, <vscale x 2 x i32> %vb) {
510 ; CHECK-LABEL: vmin_vv_nxv2i32:
512 ; CHECK-NEXT: vsetvli a0, zero, e32, m1, ta, ma
513 ; CHECK-NEXT: vminu.vv v8, v8, v9
515 %cmp = icmp ult <vscale x 2 x i32> %va, %vb
516 %vc = select <vscale x 2 x i1> %cmp, <vscale x 2 x i32> %va, <vscale x 2 x i32> %vb
517 ret <vscale x 2 x i32> %vc
520 define <vscale x 2 x i32> @vmin_vx_nxv2i32(<vscale x 2 x i32> %va, i32 signext %b) {
521 ; CHECK-LABEL: vmin_vx_nxv2i32:
523 ; CHECK-NEXT: vsetvli a1, zero, e32, m1, ta, ma
524 ; CHECK-NEXT: vminu.vx v8, v8, a0
526 %head = insertelement <vscale x 2 x i32> poison, i32 %b, i32 0
527 %splat = shufflevector <vscale x 2 x i32> %head, <vscale x 2 x i32> poison, <vscale x 2 x i32> zeroinitializer
528 %cmp = icmp ult <vscale x 2 x i32> %va, %splat
529 %vc = select <vscale x 2 x i1> %cmp, <vscale x 2 x i32> %va, <vscale x 2 x i32> %splat
530 ret <vscale x 2 x i32> %vc
533 define <vscale x 2 x i32> @vmin_vi_nxv2i32_0(<vscale x 2 x i32> %va) {
534 ; CHECK-LABEL: vmin_vi_nxv2i32_0:
536 ; CHECK-NEXT: li a0, -3
537 ; CHECK-NEXT: vsetvli a1, zero, e32, m1, ta, ma
538 ; CHECK-NEXT: vminu.vx v8, v8, a0
540 %cmp = icmp ult <vscale x 2 x i32> %va, splat (i32 -3)
541 %vc = select <vscale x 2 x i1> %cmp, <vscale x 2 x i32> %va, <vscale x 2 x i32> splat (i32 -3)
542 ret <vscale x 2 x i32> %vc
545 define <vscale x 4 x i32> @vmin_vv_nxv4i32(<vscale x 4 x i32> %va, <vscale x 4 x i32> %vb) {
546 ; CHECK-LABEL: vmin_vv_nxv4i32:
548 ; CHECK-NEXT: vsetvli a0, zero, e32, m2, ta, ma
549 ; CHECK-NEXT: vminu.vv v8, v8, v10
551 %cmp = icmp ult <vscale x 4 x i32> %va, %vb
552 %vc = select <vscale x 4 x i1> %cmp, <vscale x 4 x i32> %va, <vscale x 4 x i32> %vb
553 ret <vscale x 4 x i32> %vc
556 define <vscale x 4 x i32> @vmin_vx_nxv4i32(<vscale x 4 x i32> %va, i32 signext %b) {
557 ; CHECK-LABEL: vmin_vx_nxv4i32:
559 ; CHECK-NEXT: vsetvli a1, zero, e32, m2, ta, ma
560 ; CHECK-NEXT: vminu.vx v8, v8, a0
562 %head = insertelement <vscale x 4 x i32> poison, i32 %b, i32 0
563 %splat = shufflevector <vscale x 4 x i32> %head, <vscale x 4 x i32> poison, <vscale x 4 x i32> zeroinitializer
564 %cmp = icmp ult <vscale x 4 x i32> %va, %splat
565 %vc = select <vscale x 4 x i1> %cmp, <vscale x 4 x i32> %va, <vscale x 4 x i32> %splat
566 ret <vscale x 4 x i32> %vc
569 define <vscale x 4 x i32> @vmin_vi_nxv4i32_0(<vscale x 4 x i32> %va) {
570 ; CHECK-LABEL: vmin_vi_nxv4i32_0:
572 ; CHECK-NEXT: li a0, -3
573 ; CHECK-NEXT: vsetvli a1, zero, e32, m2, ta, ma
574 ; CHECK-NEXT: vminu.vx v8, v8, a0
576 %cmp = icmp ult <vscale x 4 x i32> %va, splat (i32 -3)
577 %vc = select <vscale x 4 x i1> %cmp, <vscale x 4 x i32> %va, <vscale x 4 x i32> splat (i32 -3)
578 ret <vscale x 4 x i32> %vc
581 define <vscale x 8 x i32> @vmin_vv_nxv8i32(<vscale x 8 x i32> %va, <vscale x 8 x i32> %vb) {
582 ; CHECK-LABEL: vmin_vv_nxv8i32:
584 ; CHECK-NEXT: vsetvli a0, zero, e32, m4, ta, ma
585 ; CHECK-NEXT: vminu.vv v8, v8, v12
587 %cmp = icmp ult <vscale x 8 x i32> %va, %vb
588 %vc = select <vscale x 8 x i1> %cmp, <vscale x 8 x i32> %va, <vscale x 8 x i32> %vb
589 ret <vscale x 8 x i32> %vc
592 define <vscale x 8 x i32> @vmin_vx_nxv8i32(<vscale x 8 x i32> %va, i32 signext %b) {
593 ; CHECK-LABEL: vmin_vx_nxv8i32:
595 ; CHECK-NEXT: vsetvli a1, zero, e32, m4, ta, ma
596 ; CHECK-NEXT: vminu.vx v8, v8, a0
598 %head = insertelement <vscale x 8 x i32> poison, i32 %b, i32 0
599 %splat = shufflevector <vscale x 8 x i32> %head, <vscale x 8 x i32> poison, <vscale x 8 x i32> zeroinitializer
600 %cmp = icmp ult <vscale x 8 x i32> %va, %splat
601 %vc = select <vscale x 8 x i1> %cmp, <vscale x 8 x i32> %va, <vscale x 8 x i32> %splat
602 ret <vscale x 8 x i32> %vc
605 define <vscale x 8 x i32> @vmin_vi_nxv8i32_0(<vscale x 8 x i32> %va) {
606 ; CHECK-LABEL: vmin_vi_nxv8i32_0:
608 ; CHECK-NEXT: li a0, -3
609 ; CHECK-NEXT: vsetvli a1, zero, e32, m4, ta, ma
610 ; CHECK-NEXT: vminu.vx v8, v8, a0
612 %cmp = icmp ult <vscale x 8 x i32> %va, splat (i32 -3)
613 %vc = select <vscale x 8 x i1> %cmp, <vscale x 8 x i32> %va, <vscale x 8 x i32> splat (i32 -3)
614 ret <vscale x 8 x i32> %vc
617 define <vscale x 16 x i32> @vmin_vv_nxv16i32(<vscale x 16 x i32> %va, <vscale x 16 x i32> %vb) {
618 ; CHECK-LABEL: vmin_vv_nxv16i32:
620 ; CHECK-NEXT: vsetvli a0, zero, e32, m8, ta, ma
621 ; CHECK-NEXT: vminu.vv v8, v8, v16
623 %cmp = icmp ult <vscale x 16 x i32> %va, %vb
624 %vc = select <vscale x 16 x i1> %cmp, <vscale x 16 x i32> %va, <vscale x 16 x i32> %vb
625 ret <vscale x 16 x i32> %vc
628 define <vscale x 16 x i32> @vmin_vx_nxv16i32(<vscale x 16 x i32> %va, i32 signext %b) {
629 ; CHECK-LABEL: vmin_vx_nxv16i32:
631 ; CHECK-NEXT: vsetvli a1, zero, e32, m8, ta, ma
632 ; CHECK-NEXT: vminu.vx v8, v8, a0
634 %head = insertelement <vscale x 16 x i32> poison, i32 %b, i32 0
635 %splat = shufflevector <vscale x 16 x i32> %head, <vscale x 16 x i32> poison, <vscale x 16 x i32> zeroinitializer
636 %cmp = icmp ult <vscale x 16 x i32> %va, %splat
637 %vc = select <vscale x 16 x i1> %cmp, <vscale x 16 x i32> %va, <vscale x 16 x i32> %splat
638 ret <vscale x 16 x i32> %vc
641 define <vscale x 16 x i32> @vmin_vi_nxv16i32_0(<vscale x 16 x i32> %va) {
642 ; CHECK-LABEL: vmin_vi_nxv16i32_0:
644 ; CHECK-NEXT: li a0, -3
645 ; CHECK-NEXT: vsetvli a1, zero, e32, m8, ta, ma
646 ; CHECK-NEXT: vminu.vx v8, v8, a0
648 %cmp = icmp ult <vscale x 16 x i32> %va, splat (i32 -3)
649 %vc = select <vscale x 16 x i1> %cmp, <vscale x 16 x i32> %va, <vscale x 16 x i32> splat (i32 -3)
650 ret <vscale x 16 x i32> %vc
653 define <vscale x 1 x i64> @vmin_vv_nxv1i64(<vscale x 1 x i64> %va, <vscale x 1 x i64> %vb) {
654 ; CHECK-LABEL: vmin_vv_nxv1i64:
656 ; CHECK-NEXT: vsetvli a0, zero, e64, m1, ta, ma
657 ; CHECK-NEXT: vminu.vv v8, v8, v9
659 %cmp = icmp ult <vscale x 1 x i64> %va, %vb
660 %vc = select <vscale x 1 x i1> %cmp, <vscale x 1 x i64> %va, <vscale x 1 x i64> %vb
661 ret <vscale x 1 x i64> %vc
664 define <vscale x 1 x i64> @vmin_vx_nxv1i64(<vscale x 1 x i64> %va, i64 %b) {
665 ; RV32-LABEL: vmin_vx_nxv1i64:
667 ; RV32-NEXT: addi sp, sp, -16
668 ; RV32-NEXT: .cfi_def_cfa_offset 16
669 ; RV32-NEXT: sw a1, 12(sp)
670 ; RV32-NEXT: sw a0, 8(sp)
671 ; RV32-NEXT: addi a0, sp, 8
672 ; RV32-NEXT: vsetvli a1, zero, e64, m1, ta, ma
673 ; RV32-NEXT: vlse64.v v9, (a0), zero
674 ; RV32-NEXT: vminu.vv v8, v8, v9
675 ; RV32-NEXT: addi sp, sp, 16
678 ; RV64-LABEL: vmin_vx_nxv1i64:
680 ; RV64-NEXT: vsetvli a1, zero, e64, m1, ta, ma
681 ; RV64-NEXT: vminu.vx v8, v8, a0
683 %head = insertelement <vscale x 1 x i64> poison, i64 %b, i32 0
684 %splat = shufflevector <vscale x 1 x i64> %head, <vscale x 1 x i64> poison, <vscale x 1 x i32> zeroinitializer
685 %cmp = icmp ult <vscale x 1 x i64> %va, %splat
686 %vc = select <vscale x 1 x i1> %cmp, <vscale x 1 x i64> %va, <vscale x 1 x i64> %splat
687 ret <vscale x 1 x i64> %vc
690 define <vscale x 1 x i64> @vmin_vi_nxv1i64_0(<vscale x 1 x i64> %va) {
691 ; CHECK-LABEL: vmin_vi_nxv1i64_0:
693 ; CHECK-NEXT: li a0, -3
694 ; CHECK-NEXT: vsetvli a1, zero, e64, m1, ta, ma
695 ; CHECK-NEXT: vminu.vx v8, v8, a0
697 %cmp = icmp ult <vscale x 1 x i64> %va, splat (i64 -3)
698 %vc = select <vscale x 1 x i1> %cmp, <vscale x 1 x i64> %va, <vscale x 1 x i64> splat (i64 -3)
699 ret <vscale x 1 x i64> %vc
702 define <vscale x 2 x i64> @vmin_vv_nxv2i64(<vscale x 2 x i64> %va, <vscale x 2 x i64> %vb) {
703 ; CHECK-LABEL: vmin_vv_nxv2i64:
705 ; CHECK-NEXT: vsetvli a0, zero, e64, m2, ta, ma
706 ; CHECK-NEXT: vminu.vv v8, v8, v10
708 %cmp = icmp ult <vscale x 2 x i64> %va, %vb
709 %vc = select <vscale x 2 x i1> %cmp, <vscale x 2 x i64> %va, <vscale x 2 x i64> %vb
710 ret <vscale x 2 x i64> %vc
713 define <vscale x 2 x i64> @vmin_vx_nxv2i64(<vscale x 2 x i64> %va, i64 %b) {
714 ; RV32-LABEL: vmin_vx_nxv2i64:
716 ; RV32-NEXT: addi sp, sp, -16
717 ; RV32-NEXT: .cfi_def_cfa_offset 16
718 ; RV32-NEXT: sw a1, 12(sp)
719 ; RV32-NEXT: sw a0, 8(sp)
720 ; RV32-NEXT: addi a0, sp, 8
721 ; RV32-NEXT: vsetvli a1, zero, e64, m2, ta, ma
722 ; RV32-NEXT: vlse64.v v10, (a0), zero
723 ; RV32-NEXT: vminu.vv v8, v8, v10
724 ; RV32-NEXT: addi sp, sp, 16
727 ; RV64-LABEL: vmin_vx_nxv2i64:
729 ; RV64-NEXT: vsetvli a1, zero, e64, m2, ta, ma
730 ; RV64-NEXT: vminu.vx v8, v8, a0
732 %head = insertelement <vscale x 2 x i64> poison, i64 %b, i32 0
733 %splat = shufflevector <vscale x 2 x i64> %head, <vscale x 2 x i64> poison, <vscale x 2 x i32> zeroinitializer
734 %cmp = icmp ult <vscale x 2 x i64> %va, %splat
735 %vc = select <vscale x 2 x i1> %cmp, <vscale x 2 x i64> %va, <vscale x 2 x i64> %splat
736 ret <vscale x 2 x i64> %vc
739 define <vscale x 2 x i64> @vmin_vi_nxv2i64_0(<vscale x 2 x i64> %va) {
740 ; CHECK-LABEL: vmin_vi_nxv2i64_0:
742 ; CHECK-NEXT: li a0, -3
743 ; CHECK-NEXT: vsetvli a1, zero, e64, m2, ta, ma
744 ; CHECK-NEXT: vminu.vx v8, v8, a0
746 %cmp = icmp ult <vscale x 2 x i64> %va, splat (i64 -3)
747 %vc = select <vscale x 2 x i1> %cmp, <vscale x 2 x i64> %va, <vscale x 2 x i64> splat (i64 -3)
748 ret <vscale x 2 x i64> %vc
751 define <vscale x 4 x i64> @vmin_vv_nxv4i64(<vscale x 4 x i64> %va, <vscale x 4 x i64> %vb) {
752 ; CHECK-LABEL: vmin_vv_nxv4i64:
754 ; CHECK-NEXT: vsetvli a0, zero, e64, m4, ta, ma
755 ; CHECK-NEXT: vminu.vv v8, v8, v12
757 %cmp = icmp ult <vscale x 4 x i64> %va, %vb
758 %vc = select <vscale x 4 x i1> %cmp, <vscale x 4 x i64> %va, <vscale x 4 x i64> %vb
759 ret <vscale x 4 x i64> %vc
762 define <vscale x 4 x i64> @vmin_vx_nxv4i64(<vscale x 4 x i64> %va, i64 %b) {
763 ; RV32-LABEL: vmin_vx_nxv4i64:
765 ; RV32-NEXT: addi sp, sp, -16
766 ; RV32-NEXT: .cfi_def_cfa_offset 16
767 ; RV32-NEXT: sw a1, 12(sp)
768 ; RV32-NEXT: sw a0, 8(sp)
769 ; RV32-NEXT: addi a0, sp, 8
770 ; RV32-NEXT: vsetvli a1, zero, e64, m4, ta, ma
771 ; RV32-NEXT: vlse64.v v12, (a0), zero
772 ; RV32-NEXT: vminu.vv v8, v8, v12
773 ; RV32-NEXT: addi sp, sp, 16
776 ; RV64-LABEL: vmin_vx_nxv4i64:
778 ; RV64-NEXT: vsetvli a1, zero, e64, m4, ta, ma
779 ; RV64-NEXT: vminu.vx v8, v8, a0
781 %head = insertelement <vscale x 4 x i64> poison, i64 %b, i32 0
782 %splat = shufflevector <vscale x 4 x i64> %head, <vscale x 4 x i64> poison, <vscale x 4 x i32> zeroinitializer
783 %cmp = icmp ult <vscale x 4 x i64> %va, %splat
784 %vc = select <vscale x 4 x i1> %cmp, <vscale x 4 x i64> %va, <vscale x 4 x i64> %splat
785 ret <vscale x 4 x i64> %vc
788 define <vscale x 4 x i64> @vmin_vi_nxv4i64_0(<vscale x 4 x i64> %va) {
789 ; CHECK-LABEL: vmin_vi_nxv4i64_0:
791 ; CHECK-NEXT: li a0, -3
792 ; CHECK-NEXT: vsetvli a1, zero, e64, m4, ta, ma
793 ; CHECK-NEXT: vminu.vx v8, v8, a0
795 %cmp = icmp ult <vscale x 4 x i64> %va, splat (i64 -3)
796 %vc = select <vscale x 4 x i1> %cmp, <vscale x 4 x i64> %va, <vscale x 4 x i64> splat (i64 -3)
797 ret <vscale x 4 x i64> %vc
800 define <vscale x 8 x i64> @vmin_vv_nxv8i64(<vscale x 8 x i64> %va, <vscale x 8 x i64> %vb) {
801 ; CHECK-LABEL: vmin_vv_nxv8i64:
803 ; CHECK-NEXT: vsetvli a0, zero, e64, m8, ta, ma
804 ; CHECK-NEXT: vminu.vv v8, v8, v16
806 %cmp = icmp ult <vscale x 8 x i64> %va, %vb
807 %vc = select <vscale x 8 x i1> %cmp, <vscale x 8 x i64> %va, <vscale x 8 x i64> %vb
808 ret <vscale x 8 x i64> %vc
811 define <vscale x 8 x i64> @vmin_vx_nxv8i64(<vscale x 8 x i64> %va, i64 %b) {
812 ; RV32-LABEL: vmin_vx_nxv8i64:
814 ; RV32-NEXT: addi sp, sp, -16
815 ; RV32-NEXT: .cfi_def_cfa_offset 16
816 ; RV32-NEXT: sw a1, 12(sp)
817 ; RV32-NEXT: sw a0, 8(sp)
818 ; RV32-NEXT: addi a0, sp, 8
819 ; RV32-NEXT: vsetvli a1, zero, e64, m8, ta, ma
820 ; RV32-NEXT: vlse64.v v16, (a0), zero
821 ; RV32-NEXT: vminu.vv v8, v8, v16
822 ; RV32-NEXT: addi sp, sp, 16
825 ; RV64-LABEL: vmin_vx_nxv8i64:
827 ; RV64-NEXT: vsetvli a1, zero, e64, m8, ta, ma
828 ; RV64-NEXT: vminu.vx v8, v8, a0
830 %head = insertelement <vscale x 8 x i64> poison, i64 %b, i32 0
831 %splat = shufflevector <vscale x 8 x i64> %head, <vscale x 8 x i64> poison, <vscale x 8 x i32> zeroinitializer
832 %cmp = icmp ult <vscale x 8 x i64> %va, %splat
833 %vc = select <vscale x 8 x i1> %cmp, <vscale x 8 x i64> %va, <vscale x 8 x i64> %splat
834 ret <vscale x 8 x i64> %vc
837 define <vscale x 8 x i64> @vmin_vi_nxv8i64_0(<vscale x 8 x i64> %va) {
838 ; CHECK-LABEL: vmin_vi_nxv8i64_0:
840 ; CHECK-NEXT: li a0, -3
841 ; CHECK-NEXT: vsetvli a1, zero, e64, m8, ta, ma
842 ; CHECK-NEXT: vminu.vx v8, v8, a0
844 %cmp = icmp ult <vscale x 8 x i64> %va, splat (i64 -3)
845 %vc = select <vscale x 8 x i1> %cmp, <vscale x 8 x i64> %va, <vscale x 8 x i64> splat (i64 -3)
846 ret <vscale x 8 x i64> %vc
849 define <vscale x 8 x i32> @vmin_vv_mask_nxv8i32(<vscale x 8 x i32> %va, <vscale x 8 x i32> %vb, <vscale x 8 x i1> %mask) {
850 ; CHECK-LABEL: vmin_vv_mask_nxv8i32:
852 ; CHECK-NEXT: vsetvli a0, zero, e32, m4, ta, ma
853 ; CHECK-NEXT: vmv.v.i v16, -1
854 ; CHECK-NEXT: vmerge.vvm v12, v16, v12, v0
855 ; CHECK-NEXT: vminu.vv v8, v8, v12
857 %vs = select <vscale x 8 x i1> %mask, <vscale x 8 x i32> %vb, <vscale x 8 x i32> splat (i32 -1)
858 %cmp = icmp ult <vscale x 8 x i32> %va, %vs
859 %vc = select <vscale x 8 x i1> %cmp, <vscale x 8 x i32> %va, <vscale x 8 x i32> %vs
860 ret <vscale x 8 x i32> %vc
863 define <vscale x 8 x i32> @vmin_vx_mask_nxv8i32(<vscale x 8 x i32> %va, i32 signext %b, <vscale x 8 x i1> %mask) {
864 ; CHECK-LABEL: vmin_vx_mask_nxv8i32:
866 ; CHECK-NEXT: vsetvli a1, zero, e32, m4, ta, ma
867 ; CHECK-NEXT: vmv.v.i v12, -1
868 ; CHECK-NEXT: vmerge.vxm v12, v12, a0, v0
869 ; CHECK-NEXT: vminu.vv v8, v8, v12
871 %head1 = insertelement <vscale x 8 x i32> poison, i32 %b, i32 0
872 %splat = shufflevector <vscale x 8 x i32> %head1, <vscale x 8 x i32> poison, <vscale x 8 x i32> zeroinitializer
873 %vs = select <vscale x 8 x i1> %mask, <vscale x 8 x i32> %splat, <vscale x 8 x i32> splat (i32 -1)
874 %cmp = icmp ult <vscale x 8 x i32> %va, %vs
875 %vc = select <vscale x 8 x i1> %cmp, <vscale x 8 x i32> %va, <vscale x 8 x i32> %vs
876 ret <vscale x 8 x i32> %vc
879 define <vscale x 8 x i32> @vmin_vi_mask_nxv8i32(<vscale x 8 x i32> %va, <vscale x 8 x i1> %mask) {
880 ; CHECK-LABEL: vmin_vi_mask_nxv8i32:
882 ; CHECK-NEXT: vsetvli a0, zero, e32, m4, ta, ma
883 ; CHECK-NEXT: vmv.v.i v12, -1
884 ; CHECK-NEXT: vmerge.vim v12, v12, -3, v0
885 ; CHECK-NEXT: vminu.vv v8, v8, v12
887 %vs = select <vscale x 8 x i1> %mask, <vscale x 8 x i32> splat (i32 -3), <vscale x 8 x i32> splat (i32 -1)
888 %cmp = icmp ult <vscale x 8 x i32> %va, %vs
889 %vc = select <vscale x 8 x i1> %cmp, <vscale x 8 x i32> %va, <vscale x 8 x i32> %vs
890 ret <vscale x 8 x i32> %vc