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> @vmax_vv_nxv1i8(<vscale x 1 x i8> %va, <vscale x 1 x i8> %vb) {
6 ; CHECK-LABEL: vmax_vv_nxv1i8:
8 ; CHECK-NEXT: vsetvli a0, zero, e8, mf8, ta, ma
9 ; CHECK-NEXT: vmax.vv v8, v8, v9
11 %cmp = icmp sgt <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> @vmax_vx_nxv1i8(<vscale x 1 x i8> %va, i8 signext %b) {
17 ; CHECK-LABEL: vmax_vx_nxv1i8:
19 ; CHECK-NEXT: vsetvli a1, zero, e8, mf8, ta, ma
20 ; CHECK-NEXT: vmax.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 sgt <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> @vmax_vi_nxv1i8_0(<vscale x 1 x i8> %va) {
30 ; CHECK-LABEL: vmax_vi_nxv1i8_0:
32 ; CHECK-NEXT: li a0, -3
33 ; CHECK-NEXT: vsetvli a1, zero, e8, mf8, ta, ma
34 ; CHECK-NEXT: vmax.vx v8, v8, a0
36 %head = insertelement <vscale x 1 x i8> poison, i8 -3, i32 0
37 %splat = shufflevector <vscale x 1 x i8> %head, <vscale x 1 x i8> poison, <vscale x 1 x i32> zeroinitializer
38 %cmp = icmp sgt <vscale x 1 x i8> %va, %splat
39 %vc = select <vscale x 1 x i1> %cmp, <vscale x 1 x i8> %va, <vscale x 1 x i8> %splat
40 ret <vscale x 1 x i8> %vc
43 define <vscale x 2 x i8> @vmax_vv_nxv2i8(<vscale x 2 x i8> %va, <vscale x 2 x i8> %vb) {
44 ; CHECK-LABEL: vmax_vv_nxv2i8:
46 ; CHECK-NEXT: vsetvli a0, zero, e8, mf4, ta, ma
47 ; CHECK-NEXT: vmax.vv v8, v8, v9
49 %cmp = icmp sgt <vscale x 2 x i8> %va, %vb
50 %vc = select <vscale x 2 x i1> %cmp, <vscale x 2 x i8> %va, <vscale x 2 x i8> %vb
51 ret <vscale x 2 x i8> %vc
54 define <vscale x 2 x i8> @vmax_vx_nxv2i8(<vscale x 2 x i8> %va, i8 signext %b) {
55 ; CHECK-LABEL: vmax_vx_nxv2i8:
57 ; CHECK-NEXT: vsetvli a1, zero, e8, mf4, ta, ma
58 ; CHECK-NEXT: vmax.vx v8, v8, a0
60 %head = insertelement <vscale x 2 x i8> poison, i8 %b, i32 0
61 %splat = shufflevector <vscale x 2 x i8> %head, <vscale x 2 x i8> poison, <vscale x 2 x i32> zeroinitializer
62 %cmp = icmp sgt <vscale x 2 x i8> %va, %splat
63 %vc = select <vscale x 2 x i1> %cmp, <vscale x 2 x i8> %va, <vscale x 2 x i8> %splat
64 ret <vscale x 2 x i8> %vc
67 define <vscale x 2 x i8> @vmax_vi_nxv2i8_0(<vscale x 2 x i8> %va) {
68 ; CHECK-LABEL: vmax_vi_nxv2i8_0:
70 ; CHECK-NEXT: li a0, -3
71 ; CHECK-NEXT: vsetvli a1, zero, e8, mf4, ta, ma
72 ; CHECK-NEXT: vmax.vx v8, v8, a0
74 %head = insertelement <vscale x 2 x i8> poison, i8 -3, i32 0
75 %splat = shufflevector <vscale x 2 x i8> %head, <vscale x 2 x i8> poison, <vscale x 2 x i32> zeroinitializer
76 %cmp = icmp sgt <vscale x 2 x i8> %va, %splat
77 %vc = select <vscale x 2 x i1> %cmp, <vscale x 2 x i8> %va, <vscale x 2 x i8> %splat
78 ret <vscale x 2 x i8> %vc
81 define <vscale x 4 x i8> @vmax_vv_nxv4i8(<vscale x 4 x i8> %va, <vscale x 4 x i8> %vb) {
82 ; CHECK-LABEL: vmax_vv_nxv4i8:
84 ; CHECK-NEXT: vsetvli a0, zero, e8, mf2, ta, ma
85 ; CHECK-NEXT: vmax.vv v8, v8, v9
87 %cmp = icmp sgt <vscale x 4 x i8> %va, %vb
88 %vc = select <vscale x 4 x i1> %cmp, <vscale x 4 x i8> %va, <vscale x 4 x i8> %vb
89 ret <vscale x 4 x i8> %vc
92 define <vscale x 4 x i8> @vmax_vx_nxv4i8(<vscale x 4 x i8> %va, i8 signext %b) {
93 ; CHECK-LABEL: vmax_vx_nxv4i8:
95 ; CHECK-NEXT: vsetvli a1, zero, e8, mf2, ta, ma
96 ; CHECK-NEXT: vmax.vx v8, v8, a0
98 %head = insertelement <vscale x 4 x i8> poison, i8 %b, i32 0
99 %splat = shufflevector <vscale x 4 x i8> %head, <vscale x 4 x i8> poison, <vscale x 4 x i32> zeroinitializer
100 %cmp = icmp sgt <vscale x 4 x i8> %va, %splat
101 %vc = select <vscale x 4 x i1> %cmp, <vscale x 4 x i8> %va, <vscale x 4 x i8> %splat
102 ret <vscale x 4 x i8> %vc
105 define <vscale x 4 x i8> @vmax_vi_nxv4i8_0(<vscale x 4 x i8> %va) {
106 ; CHECK-LABEL: vmax_vi_nxv4i8_0:
108 ; CHECK-NEXT: li a0, -3
109 ; CHECK-NEXT: vsetvli a1, zero, e8, mf2, ta, ma
110 ; CHECK-NEXT: vmax.vx v8, v8, a0
112 %head = insertelement <vscale x 4 x i8> poison, i8 -3, i32 0
113 %splat = shufflevector <vscale x 4 x i8> %head, <vscale x 4 x i8> poison, <vscale x 4 x i32> zeroinitializer
114 %cmp = icmp sgt <vscale x 4 x i8> %va, %splat
115 %vc = select <vscale x 4 x i1> %cmp, <vscale x 4 x i8> %va, <vscale x 4 x i8> %splat
116 ret <vscale x 4 x i8> %vc
119 define <vscale x 8 x i8> @vmax_vv_nxv8i8(<vscale x 8 x i8> %va, <vscale x 8 x i8> %vb) {
120 ; CHECK-LABEL: vmax_vv_nxv8i8:
122 ; CHECK-NEXT: vsetvli a0, zero, e8, m1, ta, ma
123 ; CHECK-NEXT: vmax.vv v8, v8, v9
125 %cmp = icmp sgt <vscale x 8 x i8> %va, %vb
126 %vc = select <vscale x 8 x i1> %cmp, <vscale x 8 x i8> %va, <vscale x 8 x i8> %vb
127 ret <vscale x 8 x i8> %vc
130 define <vscale x 8 x i8> @vmax_vx_nxv8i8(<vscale x 8 x i8> %va, i8 signext %b) {
131 ; CHECK-LABEL: vmax_vx_nxv8i8:
133 ; CHECK-NEXT: vsetvli a1, zero, e8, m1, ta, ma
134 ; CHECK-NEXT: vmax.vx v8, v8, a0
136 %head = insertelement <vscale x 8 x i8> poison, i8 %b, i32 0
137 %splat = shufflevector <vscale x 8 x i8> %head, <vscale x 8 x i8> poison, <vscale x 8 x i32> zeroinitializer
138 %cmp = icmp sgt <vscale x 8 x i8> %va, %splat
139 %vc = select <vscale x 8 x i1> %cmp, <vscale x 8 x i8> %va, <vscale x 8 x i8> %splat
140 ret <vscale x 8 x i8> %vc
143 define <vscale x 8 x i8> @vmax_vi_nxv8i8_0(<vscale x 8 x i8> %va) {
144 ; CHECK-LABEL: vmax_vi_nxv8i8_0:
146 ; CHECK-NEXT: li a0, -3
147 ; CHECK-NEXT: vsetvli a1, zero, e8, m1, ta, ma
148 ; CHECK-NEXT: vmax.vx v8, v8, a0
150 %head = insertelement <vscale x 8 x i8> poison, i8 -3, i32 0
151 %splat = shufflevector <vscale x 8 x i8> %head, <vscale x 8 x i8> poison, <vscale x 8 x i32> zeroinitializer
152 %cmp = icmp sgt <vscale x 8 x i8> %va, %splat
153 %vc = select <vscale x 8 x i1> %cmp, <vscale x 8 x i8> %va, <vscale x 8 x i8> %splat
154 ret <vscale x 8 x i8> %vc
157 define <vscale x 16 x i8> @vmax_vv_nxv16i8(<vscale x 16 x i8> %va, <vscale x 16 x i8> %vb) {
158 ; CHECK-LABEL: vmax_vv_nxv16i8:
160 ; CHECK-NEXT: vsetvli a0, zero, e8, m2, ta, ma
161 ; CHECK-NEXT: vmax.vv v8, v8, v10
163 %cmp = icmp sgt <vscale x 16 x i8> %va, %vb
164 %vc = select <vscale x 16 x i1> %cmp, <vscale x 16 x i8> %va, <vscale x 16 x i8> %vb
165 ret <vscale x 16 x i8> %vc
168 define <vscale x 16 x i8> @vmax_vx_nxv16i8(<vscale x 16 x i8> %va, i8 signext %b) {
169 ; CHECK-LABEL: vmax_vx_nxv16i8:
171 ; CHECK-NEXT: vsetvli a1, zero, e8, m2, ta, ma
172 ; CHECK-NEXT: vmax.vx v8, v8, a0
174 %head = insertelement <vscale x 16 x i8> poison, i8 %b, i32 0
175 %splat = shufflevector <vscale x 16 x i8> %head, <vscale x 16 x i8> poison, <vscale x 16 x i32> zeroinitializer
176 %cmp = icmp sgt <vscale x 16 x i8> %va, %splat
177 %vc = select <vscale x 16 x i1> %cmp, <vscale x 16 x i8> %va, <vscale x 16 x i8> %splat
178 ret <vscale x 16 x i8> %vc
181 define <vscale x 16 x i8> @vmax_vi_nxv16i8_0(<vscale x 16 x i8> %va) {
182 ; CHECK-LABEL: vmax_vi_nxv16i8_0:
184 ; CHECK-NEXT: li a0, -3
185 ; CHECK-NEXT: vsetvli a1, zero, e8, m2, ta, ma
186 ; CHECK-NEXT: vmax.vx v8, v8, a0
188 %head = insertelement <vscale x 16 x i8> poison, i8 -3, i32 0
189 %splat = shufflevector <vscale x 16 x i8> %head, <vscale x 16 x i8> poison, <vscale x 16 x i32> zeroinitializer
190 %cmp = icmp sgt <vscale x 16 x i8> %va, %splat
191 %vc = select <vscale x 16 x i1> %cmp, <vscale x 16 x i8> %va, <vscale x 16 x i8> %splat
192 ret <vscale x 16 x i8> %vc
195 define <vscale x 32 x i8> @vmax_vv_nxv32i8(<vscale x 32 x i8> %va, <vscale x 32 x i8> %vb) {
196 ; CHECK-LABEL: vmax_vv_nxv32i8:
198 ; CHECK-NEXT: vsetvli a0, zero, e8, m4, ta, ma
199 ; CHECK-NEXT: vmax.vv v8, v8, v12
201 %cmp = icmp sgt <vscale x 32 x i8> %va, %vb
202 %vc = select <vscale x 32 x i1> %cmp, <vscale x 32 x i8> %va, <vscale x 32 x i8> %vb
203 ret <vscale x 32 x i8> %vc
206 define <vscale x 32 x i8> @vmax_vx_nxv32i8(<vscale x 32 x i8> %va, i8 signext %b) {
207 ; CHECK-LABEL: vmax_vx_nxv32i8:
209 ; CHECK-NEXT: vsetvli a1, zero, e8, m4, ta, ma
210 ; CHECK-NEXT: vmax.vx v8, v8, a0
212 %head = insertelement <vscale x 32 x i8> poison, i8 %b, i32 0
213 %splat = shufflevector <vscale x 32 x i8> %head, <vscale x 32 x i8> poison, <vscale x 32 x i32> zeroinitializer
214 %cmp = icmp sgt <vscale x 32 x i8> %va, %splat
215 %vc = select <vscale x 32 x i1> %cmp, <vscale x 32 x i8> %va, <vscale x 32 x i8> %splat
216 ret <vscale x 32 x i8> %vc
219 define <vscale x 32 x i8> @vmax_vi_nxv32i8_0(<vscale x 32 x i8> %va) {
220 ; CHECK-LABEL: vmax_vi_nxv32i8_0:
222 ; CHECK-NEXT: li a0, -3
223 ; CHECK-NEXT: vsetvli a1, zero, e8, m4, ta, ma
224 ; CHECK-NEXT: vmax.vx v8, v8, a0
226 %head = insertelement <vscale x 32 x i8> poison, i8 -3, i32 0
227 %splat = shufflevector <vscale x 32 x i8> %head, <vscale x 32 x i8> poison, <vscale x 32 x i32> zeroinitializer
228 %cmp = icmp sgt <vscale x 32 x i8> %va, %splat
229 %vc = select <vscale x 32 x i1> %cmp, <vscale x 32 x i8> %va, <vscale x 32 x i8> %splat
230 ret <vscale x 32 x i8> %vc
233 define <vscale x 64 x i8> @vmax_vv_nxv64i8(<vscale x 64 x i8> %va, <vscale x 64 x i8> %vb) {
234 ; CHECK-LABEL: vmax_vv_nxv64i8:
236 ; CHECK-NEXT: vsetvli a0, zero, e8, m8, ta, ma
237 ; CHECK-NEXT: vmax.vv v8, v8, v16
239 %cmp = icmp sgt <vscale x 64 x i8> %va, %vb
240 %vc = select <vscale x 64 x i1> %cmp, <vscale x 64 x i8> %va, <vscale x 64 x i8> %vb
241 ret <vscale x 64 x i8> %vc
244 define <vscale x 64 x i8> @vmax_vx_nxv64i8(<vscale x 64 x i8> %va, i8 signext %b) {
245 ; CHECK-LABEL: vmax_vx_nxv64i8:
247 ; CHECK-NEXT: vsetvli a1, zero, e8, m8, ta, ma
248 ; CHECK-NEXT: vmax.vx v8, v8, a0
250 %head = insertelement <vscale x 64 x i8> poison, i8 %b, i32 0
251 %splat = shufflevector <vscale x 64 x i8> %head, <vscale x 64 x i8> poison, <vscale x 64 x i32> zeroinitializer
252 %cmp = icmp sgt <vscale x 64 x i8> %va, %splat
253 %vc = select <vscale x 64 x i1> %cmp, <vscale x 64 x i8> %va, <vscale x 64 x i8> %splat
254 ret <vscale x 64 x i8> %vc
257 define <vscale x 64 x i8> @vmax_vi_nxv64i8_0(<vscale x 64 x i8> %va) {
258 ; CHECK-LABEL: vmax_vi_nxv64i8_0:
260 ; CHECK-NEXT: li a0, -3
261 ; CHECK-NEXT: vsetvli a1, zero, e8, m8, ta, ma
262 ; CHECK-NEXT: vmax.vx v8, v8, a0
264 %head = insertelement <vscale x 64 x i8> poison, i8 -3, i32 0
265 %splat = shufflevector <vscale x 64 x i8> %head, <vscale x 64 x i8> poison, <vscale x 64 x i32> zeroinitializer
266 %cmp = icmp sgt <vscale x 64 x i8> %va, %splat
267 %vc = select <vscale x 64 x i1> %cmp, <vscale x 64 x i8> %va, <vscale x 64 x i8> %splat
268 ret <vscale x 64 x i8> %vc
271 define <vscale x 1 x i16> @vmax_vv_nxv1i16(<vscale x 1 x i16> %va, <vscale x 1 x i16> %vb) {
272 ; CHECK-LABEL: vmax_vv_nxv1i16:
274 ; CHECK-NEXT: vsetvli a0, zero, e16, mf4, ta, ma
275 ; CHECK-NEXT: vmax.vv v8, v8, v9
277 %cmp = icmp sgt <vscale x 1 x i16> %va, %vb
278 %vc = select <vscale x 1 x i1> %cmp, <vscale x 1 x i16> %va, <vscale x 1 x i16> %vb
279 ret <vscale x 1 x i16> %vc
282 define <vscale x 1 x i16> @vmax_vx_nxv1i16(<vscale x 1 x i16> %va, i16 signext %b) {
283 ; CHECK-LABEL: vmax_vx_nxv1i16:
285 ; CHECK-NEXT: vsetvli a1, zero, e16, mf4, ta, ma
286 ; CHECK-NEXT: vmax.vx v8, v8, a0
288 %head = insertelement <vscale x 1 x i16> poison, i16 %b, i32 0
289 %splat = shufflevector <vscale x 1 x i16> %head, <vscale x 1 x i16> poison, <vscale x 1 x i32> zeroinitializer
290 %cmp = icmp sgt <vscale x 1 x i16> %va, %splat
291 %vc = select <vscale x 1 x i1> %cmp, <vscale x 1 x i16> %va, <vscale x 1 x i16> %splat
292 ret <vscale x 1 x i16> %vc
295 define <vscale x 1 x i16> @vmax_vi_nxv1i16_0(<vscale x 1 x i16> %va) {
296 ; CHECK-LABEL: vmax_vi_nxv1i16_0:
298 ; CHECK-NEXT: li a0, -3
299 ; CHECK-NEXT: vsetvli a1, zero, e16, mf4, ta, ma
300 ; CHECK-NEXT: vmax.vx v8, v8, a0
302 %head = insertelement <vscale x 1 x i16> poison, i16 -3, i32 0
303 %splat = shufflevector <vscale x 1 x i16> %head, <vscale x 1 x i16> poison, <vscale x 1 x i32> zeroinitializer
304 %cmp = icmp sgt <vscale x 1 x i16> %va, %splat
305 %vc = select <vscale x 1 x i1> %cmp, <vscale x 1 x i16> %va, <vscale x 1 x i16> %splat
306 ret <vscale x 1 x i16> %vc
309 define <vscale x 2 x i16> @vmax_vv_nxv2i16(<vscale x 2 x i16> %va, <vscale x 2 x i16> %vb) {
310 ; CHECK-LABEL: vmax_vv_nxv2i16:
312 ; CHECK-NEXT: vsetvli a0, zero, e16, mf2, ta, ma
313 ; CHECK-NEXT: vmax.vv v8, v8, v9
315 %cmp = icmp sgt <vscale x 2 x i16> %va, %vb
316 %vc = select <vscale x 2 x i1> %cmp, <vscale x 2 x i16> %va, <vscale x 2 x i16> %vb
317 ret <vscale x 2 x i16> %vc
320 define <vscale x 2 x i16> @vmax_vx_nxv2i16(<vscale x 2 x i16> %va, i16 signext %b) {
321 ; CHECK-LABEL: vmax_vx_nxv2i16:
323 ; CHECK-NEXT: vsetvli a1, zero, e16, mf2, ta, ma
324 ; CHECK-NEXT: vmax.vx v8, v8, a0
326 %head = insertelement <vscale x 2 x i16> poison, i16 %b, i32 0
327 %splat = shufflevector <vscale x 2 x i16> %head, <vscale x 2 x i16> poison, <vscale x 2 x i32> zeroinitializer
328 %cmp = icmp sgt <vscale x 2 x i16> %va, %splat
329 %vc = select <vscale x 2 x i1> %cmp, <vscale x 2 x i16> %va, <vscale x 2 x i16> %splat
330 ret <vscale x 2 x i16> %vc
333 define <vscale x 2 x i16> @vmax_vi_nxv2i16_0(<vscale x 2 x i16> %va) {
334 ; CHECK-LABEL: vmax_vi_nxv2i16_0:
336 ; CHECK-NEXT: li a0, -3
337 ; CHECK-NEXT: vsetvli a1, zero, e16, mf2, ta, ma
338 ; CHECK-NEXT: vmax.vx v8, v8, a0
340 %head = insertelement <vscale x 2 x i16> poison, i16 -3, i32 0
341 %splat = shufflevector <vscale x 2 x i16> %head, <vscale x 2 x i16> poison, <vscale x 2 x i32> zeroinitializer
342 %cmp = icmp sgt <vscale x 2 x i16> %va, %splat
343 %vc = select <vscale x 2 x i1> %cmp, <vscale x 2 x i16> %va, <vscale x 2 x i16> %splat
344 ret <vscale x 2 x i16> %vc
347 define <vscale x 4 x i16> @vmax_vv_nxv4i16(<vscale x 4 x i16> %va, <vscale x 4 x i16> %vb) {
348 ; CHECK-LABEL: vmax_vv_nxv4i16:
350 ; CHECK-NEXT: vsetvli a0, zero, e16, m1, ta, ma
351 ; CHECK-NEXT: vmax.vv v8, v8, v9
353 %cmp = icmp sgt <vscale x 4 x i16> %va, %vb
354 %vc = select <vscale x 4 x i1> %cmp, <vscale x 4 x i16> %va, <vscale x 4 x i16> %vb
355 ret <vscale x 4 x i16> %vc
358 define <vscale x 4 x i16> @vmax_vx_nxv4i16(<vscale x 4 x i16> %va, i16 signext %b) {
359 ; CHECK-LABEL: vmax_vx_nxv4i16:
361 ; CHECK-NEXT: vsetvli a1, zero, e16, m1, ta, ma
362 ; CHECK-NEXT: vmax.vx v8, v8, a0
364 %head = insertelement <vscale x 4 x i16> poison, i16 %b, i32 0
365 %splat = shufflevector <vscale x 4 x i16> %head, <vscale x 4 x i16> poison, <vscale x 4 x i32> zeroinitializer
366 %cmp = icmp sgt <vscale x 4 x i16> %va, %splat
367 %vc = select <vscale x 4 x i1> %cmp, <vscale x 4 x i16> %va, <vscale x 4 x i16> %splat
368 ret <vscale x 4 x i16> %vc
371 define <vscale x 4 x i16> @vmax_vi_nxv4i16_0(<vscale x 4 x i16> %va) {
372 ; CHECK-LABEL: vmax_vi_nxv4i16_0:
374 ; CHECK-NEXT: li a0, -3
375 ; CHECK-NEXT: vsetvli a1, zero, e16, m1, ta, ma
376 ; CHECK-NEXT: vmax.vx v8, v8, a0
378 %head = insertelement <vscale x 4 x i16> poison, i16 -3, i32 0
379 %splat = shufflevector <vscale x 4 x i16> %head, <vscale x 4 x i16> poison, <vscale x 4 x i32> zeroinitializer
380 %cmp = icmp sgt <vscale x 4 x i16> %va, %splat
381 %vc = select <vscale x 4 x i1> %cmp, <vscale x 4 x i16> %va, <vscale x 4 x i16> %splat
382 ret <vscale x 4 x i16> %vc
385 define <vscale x 8 x i16> @vmax_vv_nxv8i16(<vscale x 8 x i16> %va, <vscale x 8 x i16> %vb) {
386 ; CHECK-LABEL: vmax_vv_nxv8i16:
388 ; CHECK-NEXT: vsetvli a0, zero, e16, m2, ta, ma
389 ; CHECK-NEXT: vmax.vv v8, v8, v10
391 %cmp = icmp sgt <vscale x 8 x i16> %va, %vb
392 %vc = select <vscale x 8 x i1> %cmp, <vscale x 8 x i16> %va, <vscale x 8 x i16> %vb
393 ret <vscale x 8 x i16> %vc
396 define <vscale x 8 x i16> @vmax_vx_nxv8i16(<vscale x 8 x i16> %va, i16 signext %b) {
397 ; CHECK-LABEL: vmax_vx_nxv8i16:
399 ; CHECK-NEXT: vsetvli a1, zero, e16, m2, ta, ma
400 ; CHECK-NEXT: vmax.vx v8, v8, a0
402 %head = insertelement <vscale x 8 x i16> poison, i16 %b, i32 0
403 %splat = shufflevector <vscale x 8 x i16> %head, <vscale x 8 x i16> poison, <vscale x 8 x i32> zeroinitializer
404 %cmp = icmp sgt <vscale x 8 x i16> %va, %splat
405 %vc = select <vscale x 8 x i1> %cmp, <vscale x 8 x i16> %va, <vscale x 8 x i16> %splat
406 ret <vscale x 8 x i16> %vc
409 define <vscale x 8 x i16> @vmax_vi_nxv8i16_0(<vscale x 8 x i16> %va) {
410 ; CHECK-LABEL: vmax_vi_nxv8i16_0:
412 ; CHECK-NEXT: li a0, -3
413 ; CHECK-NEXT: vsetvli a1, zero, e16, m2, ta, ma
414 ; CHECK-NEXT: vmax.vx v8, v8, a0
416 %head = insertelement <vscale x 8 x i16> poison, i16 -3, i32 0
417 %splat = shufflevector <vscale x 8 x i16> %head, <vscale x 8 x i16> poison, <vscale x 8 x i32> zeroinitializer
418 %cmp = icmp sgt <vscale x 8 x i16> %va, %splat
419 %vc = select <vscale x 8 x i1> %cmp, <vscale x 8 x i16> %va, <vscale x 8 x i16> %splat
420 ret <vscale x 8 x i16> %vc
423 define <vscale x 16 x i16> @vmax_vv_nxv16i16(<vscale x 16 x i16> %va, <vscale x 16 x i16> %vb) {
424 ; CHECK-LABEL: vmax_vv_nxv16i16:
426 ; CHECK-NEXT: vsetvli a0, zero, e16, m4, ta, ma
427 ; CHECK-NEXT: vmax.vv v8, v8, v12
429 %cmp = icmp sgt <vscale x 16 x i16> %va, %vb
430 %vc = select <vscale x 16 x i1> %cmp, <vscale x 16 x i16> %va, <vscale x 16 x i16> %vb
431 ret <vscale x 16 x i16> %vc
434 define <vscale x 16 x i16> @vmax_vx_nxv16i16(<vscale x 16 x i16> %va, i16 signext %b) {
435 ; CHECK-LABEL: vmax_vx_nxv16i16:
437 ; CHECK-NEXT: vsetvli a1, zero, e16, m4, ta, ma
438 ; CHECK-NEXT: vmax.vx v8, v8, a0
440 %head = insertelement <vscale x 16 x i16> poison, i16 %b, i32 0
441 %splat = shufflevector <vscale x 16 x i16> %head, <vscale x 16 x i16> poison, <vscale x 16 x i32> zeroinitializer
442 %cmp = icmp sgt <vscale x 16 x i16> %va, %splat
443 %vc = select <vscale x 16 x i1> %cmp, <vscale x 16 x i16> %va, <vscale x 16 x i16> %splat
444 ret <vscale x 16 x i16> %vc
447 define <vscale x 16 x i16> @vmax_vi_nxv16i16_0(<vscale x 16 x i16> %va) {
448 ; CHECK-LABEL: vmax_vi_nxv16i16_0:
450 ; CHECK-NEXT: li a0, -3
451 ; CHECK-NEXT: vsetvli a1, zero, e16, m4, ta, ma
452 ; CHECK-NEXT: vmax.vx v8, v8, a0
454 %head = insertelement <vscale x 16 x i16> poison, i16 -3, i32 0
455 %splat = shufflevector <vscale x 16 x i16> %head, <vscale x 16 x i16> poison, <vscale x 16 x i32> zeroinitializer
456 %cmp = icmp sgt <vscale x 16 x i16> %va, %splat
457 %vc = select <vscale x 16 x i1> %cmp, <vscale x 16 x i16> %va, <vscale x 16 x i16> %splat
458 ret <vscale x 16 x i16> %vc
461 define <vscale x 32 x i16> @vmax_vv_nxv32i16(<vscale x 32 x i16> %va, <vscale x 32 x i16> %vb) {
462 ; CHECK-LABEL: vmax_vv_nxv32i16:
464 ; CHECK-NEXT: vsetvli a0, zero, e16, m8, ta, ma
465 ; CHECK-NEXT: vmax.vv v8, v8, v16
467 %cmp = icmp sgt <vscale x 32 x i16> %va, %vb
468 %vc = select <vscale x 32 x i1> %cmp, <vscale x 32 x i16> %va, <vscale x 32 x i16> %vb
469 ret <vscale x 32 x i16> %vc
472 define <vscale x 32 x i16> @vmax_vx_nxv32i16(<vscale x 32 x i16> %va, i16 signext %b) {
473 ; CHECK-LABEL: vmax_vx_nxv32i16:
475 ; CHECK-NEXT: vsetvli a1, zero, e16, m8, ta, ma
476 ; CHECK-NEXT: vmax.vx v8, v8, a0
478 %head = insertelement <vscale x 32 x i16> poison, i16 %b, i32 0
479 %splat = shufflevector <vscale x 32 x i16> %head, <vscale x 32 x i16> poison, <vscale x 32 x i32> zeroinitializer
480 %cmp = icmp sgt <vscale x 32 x i16> %va, %splat
481 %vc = select <vscale x 32 x i1> %cmp, <vscale x 32 x i16> %va, <vscale x 32 x i16> %splat
482 ret <vscale x 32 x i16> %vc
485 define <vscale x 32 x i16> @vmax_vi_nxv32i16_0(<vscale x 32 x i16> %va) {
486 ; CHECK-LABEL: vmax_vi_nxv32i16_0:
488 ; CHECK-NEXT: li a0, -3
489 ; CHECK-NEXT: vsetvli a1, zero, e16, m8, ta, ma
490 ; CHECK-NEXT: vmax.vx v8, v8, a0
492 %head = insertelement <vscale x 32 x i16> poison, i16 -3, i32 0
493 %splat = shufflevector <vscale x 32 x i16> %head, <vscale x 32 x i16> poison, <vscale x 32 x i32> zeroinitializer
494 %cmp = icmp sgt <vscale x 32 x i16> %va, %splat
495 %vc = select <vscale x 32 x i1> %cmp, <vscale x 32 x i16> %va, <vscale x 32 x i16> %splat
496 ret <vscale x 32 x i16> %vc
499 define <vscale x 1 x i32> @vmax_vv_nxv1i32(<vscale x 1 x i32> %va, <vscale x 1 x i32> %vb) {
500 ; CHECK-LABEL: vmax_vv_nxv1i32:
502 ; CHECK-NEXT: vsetvli a0, zero, e32, mf2, ta, ma
503 ; CHECK-NEXT: vmax.vv v8, v8, v9
505 %cmp = icmp sgt <vscale x 1 x i32> %va, %vb
506 %vc = select <vscale x 1 x i1> %cmp, <vscale x 1 x i32> %va, <vscale x 1 x i32> %vb
507 ret <vscale x 1 x i32> %vc
510 define <vscale x 1 x i32> @vmax_vx_nxv1i32(<vscale x 1 x i32> %va, i32 signext %b) {
511 ; CHECK-LABEL: vmax_vx_nxv1i32:
513 ; CHECK-NEXT: vsetvli a1, zero, e32, mf2, ta, ma
514 ; CHECK-NEXT: vmax.vx v8, v8, a0
516 %head = insertelement <vscale x 1 x i32> poison, i32 %b, i32 0
517 %splat = shufflevector <vscale x 1 x i32> %head, <vscale x 1 x i32> poison, <vscale x 1 x i32> zeroinitializer
518 %cmp = icmp sgt <vscale x 1 x i32> %va, %splat
519 %vc = select <vscale x 1 x i1> %cmp, <vscale x 1 x i32> %va, <vscale x 1 x i32> %splat
520 ret <vscale x 1 x i32> %vc
523 define <vscale x 1 x i32> @vmax_vi_nxv1i32_0(<vscale x 1 x i32> %va) {
524 ; CHECK-LABEL: vmax_vi_nxv1i32_0:
526 ; CHECK-NEXT: li a0, -3
527 ; CHECK-NEXT: vsetvli a1, zero, e32, mf2, ta, ma
528 ; CHECK-NEXT: vmax.vx v8, v8, a0
530 %head = insertelement <vscale x 1 x i32> poison, i32 -3, i32 0
531 %splat = shufflevector <vscale x 1 x i32> %head, <vscale x 1 x i32> poison, <vscale x 1 x i32> zeroinitializer
532 %cmp = icmp sgt <vscale x 1 x i32> %va, %splat
533 %vc = select <vscale x 1 x i1> %cmp, <vscale x 1 x i32> %va, <vscale x 1 x i32> %splat
534 ret <vscale x 1 x i32> %vc
537 define <vscale x 2 x i32> @vmax_vv_nxv2i32(<vscale x 2 x i32> %va, <vscale x 2 x i32> %vb) {
538 ; CHECK-LABEL: vmax_vv_nxv2i32:
540 ; CHECK-NEXT: vsetvli a0, zero, e32, m1, ta, ma
541 ; CHECK-NEXT: vmax.vv v8, v8, v9
543 %cmp = icmp sgt <vscale x 2 x i32> %va, %vb
544 %vc = select <vscale x 2 x i1> %cmp, <vscale x 2 x i32> %va, <vscale x 2 x i32> %vb
545 ret <vscale x 2 x i32> %vc
548 define <vscale x 2 x i32> @vmax_vx_nxv2i32(<vscale x 2 x i32> %va, i32 signext %b) {
549 ; CHECK-LABEL: vmax_vx_nxv2i32:
551 ; CHECK-NEXT: vsetvli a1, zero, e32, m1, ta, ma
552 ; CHECK-NEXT: vmax.vx v8, v8, a0
554 %head = insertelement <vscale x 2 x i32> poison, i32 %b, i32 0
555 %splat = shufflevector <vscale x 2 x i32> %head, <vscale x 2 x i32> poison, <vscale x 2 x i32> zeroinitializer
556 %cmp = icmp sgt <vscale x 2 x i32> %va, %splat
557 %vc = select <vscale x 2 x i1> %cmp, <vscale x 2 x i32> %va, <vscale x 2 x i32> %splat
558 ret <vscale x 2 x i32> %vc
561 define <vscale x 2 x i32> @vmax_vi_nxv2i32_0(<vscale x 2 x i32> %va) {
562 ; CHECK-LABEL: vmax_vi_nxv2i32_0:
564 ; CHECK-NEXT: li a0, -3
565 ; CHECK-NEXT: vsetvli a1, zero, e32, m1, ta, ma
566 ; CHECK-NEXT: vmax.vx v8, v8, a0
568 %head = insertelement <vscale x 2 x i32> poison, i32 -3, i32 0
569 %splat = shufflevector <vscale x 2 x i32> %head, <vscale x 2 x i32> poison, <vscale x 2 x i32> zeroinitializer
570 %cmp = icmp sgt <vscale x 2 x i32> %va, %splat
571 %vc = select <vscale x 2 x i1> %cmp, <vscale x 2 x i32> %va, <vscale x 2 x i32> %splat
572 ret <vscale x 2 x i32> %vc
575 define <vscale x 4 x i32> @vmax_vv_nxv4i32(<vscale x 4 x i32> %va, <vscale x 4 x i32> %vb) {
576 ; CHECK-LABEL: vmax_vv_nxv4i32:
578 ; CHECK-NEXT: vsetvli a0, zero, e32, m2, ta, ma
579 ; CHECK-NEXT: vmax.vv v8, v8, v10
581 %cmp = icmp sgt <vscale x 4 x i32> %va, %vb
582 %vc = select <vscale x 4 x i1> %cmp, <vscale x 4 x i32> %va, <vscale x 4 x i32> %vb
583 ret <vscale x 4 x i32> %vc
586 define <vscale x 4 x i32> @vmax_vx_nxv4i32(<vscale x 4 x i32> %va, i32 signext %b) {
587 ; CHECK-LABEL: vmax_vx_nxv4i32:
589 ; CHECK-NEXT: vsetvli a1, zero, e32, m2, ta, ma
590 ; CHECK-NEXT: vmax.vx v8, v8, a0
592 %head = insertelement <vscale x 4 x i32> poison, i32 %b, i32 0
593 %splat = shufflevector <vscale x 4 x i32> %head, <vscale x 4 x i32> poison, <vscale x 4 x i32> zeroinitializer
594 %cmp = icmp sgt <vscale x 4 x i32> %va, %splat
595 %vc = select <vscale x 4 x i1> %cmp, <vscale x 4 x i32> %va, <vscale x 4 x i32> %splat
596 ret <vscale x 4 x i32> %vc
599 define <vscale x 4 x i32> @vmax_vi_nxv4i32_0(<vscale x 4 x i32> %va) {
600 ; CHECK-LABEL: vmax_vi_nxv4i32_0:
602 ; CHECK-NEXT: li a0, -3
603 ; CHECK-NEXT: vsetvli a1, zero, e32, m2, ta, ma
604 ; CHECK-NEXT: vmax.vx v8, v8, a0
606 %head = insertelement <vscale x 4 x i32> poison, i32 -3, i32 0
607 %splat = shufflevector <vscale x 4 x i32> %head, <vscale x 4 x i32> poison, <vscale x 4 x i32> zeroinitializer
608 %cmp = icmp sgt <vscale x 4 x i32> %va, %splat
609 %vc = select <vscale x 4 x i1> %cmp, <vscale x 4 x i32> %va, <vscale x 4 x i32> %splat
610 ret <vscale x 4 x i32> %vc
613 define <vscale x 8 x i32> @vmax_vv_nxv8i32(<vscale x 8 x i32> %va, <vscale x 8 x i32> %vb) {
614 ; CHECK-LABEL: vmax_vv_nxv8i32:
616 ; CHECK-NEXT: vsetvli a0, zero, e32, m4, ta, ma
617 ; CHECK-NEXT: vmax.vv v8, v8, v12
619 %cmp = icmp sgt <vscale x 8 x i32> %va, %vb
620 %vc = select <vscale x 8 x i1> %cmp, <vscale x 8 x i32> %va, <vscale x 8 x i32> %vb
621 ret <vscale x 8 x i32> %vc
624 define <vscale x 8 x i32> @vmax_vx_nxv8i32(<vscale x 8 x i32> %va, i32 signext %b) {
625 ; CHECK-LABEL: vmax_vx_nxv8i32:
627 ; CHECK-NEXT: vsetvli a1, zero, e32, m4, ta, ma
628 ; CHECK-NEXT: vmax.vx v8, v8, a0
630 %head = insertelement <vscale x 8 x i32> poison, i32 %b, i32 0
631 %splat = shufflevector <vscale x 8 x i32> %head, <vscale x 8 x i32> poison, <vscale x 8 x i32> zeroinitializer
632 %cmp = icmp sgt <vscale x 8 x i32> %va, %splat
633 %vc = select <vscale x 8 x i1> %cmp, <vscale x 8 x i32> %va, <vscale x 8 x i32> %splat
634 ret <vscale x 8 x i32> %vc
637 define <vscale x 8 x i32> @vmax_vi_nxv8i32_0(<vscale x 8 x i32> %va) {
638 ; CHECK-LABEL: vmax_vi_nxv8i32_0:
640 ; CHECK-NEXT: li a0, -3
641 ; CHECK-NEXT: vsetvli a1, zero, e32, m4, ta, ma
642 ; CHECK-NEXT: vmax.vx v8, v8, a0
644 %head = insertelement <vscale x 8 x i32> poison, i32 -3, i32 0
645 %splat = shufflevector <vscale x 8 x i32> %head, <vscale x 8 x i32> poison, <vscale x 8 x i32> zeroinitializer
646 %cmp = icmp sgt <vscale x 8 x i32> %va, %splat
647 %vc = select <vscale x 8 x i1> %cmp, <vscale x 8 x i32> %va, <vscale x 8 x i32> %splat
648 ret <vscale x 8 x i32> %vc
651 define <vscale x 16 x i32> @vmax_vv_nxv16i32(<vscale x 16 x i32> %va, <vscale x 16 x i32> %vb) {
652 ; CHECK-LABEL: vmax_vv_nxv16i32:
654 ; CHECK-NEXT: vsetvli a0, zero, e32, m8, ta, ma
655 ; CHECK-NEXT: vmax.vv v8, v8, v16
657 %cmp = icmp sgt <vscale x 16 x i32> %va, %vb
658 %vc = select <vscale x 16 x i1> %cmp, <vscale x 16 x i32> %va, <vscale x 16 x i32> %vb
659 ret <vscale x 16 x i32> %vc
662 define <vscale x 16 x i32> @vmax_vx_nxv16i32(<vscale x 16 x i32> %va, i32 signext %b) {
663 ; CHECK-LABEL: vmax_vx_nxv16i32:
665 ; CHECK-NEXT: vsetvli a1, zero, e32, m8, ta, ma
666 ; CHECK-NEXT: vmax.vx v8, v8, a0
668 %head = insertelement <vscale x 16 x i32> poison, i32 %b, i32 0
669 %splat = shufflevector <vscale x 16 x i32> %head, <vscale x 16 x i32> poison, <vscale x 16 x i32> zeroinitializer
670 %cmp = icmp sgt <vscale x 16 x i32> %va, %splat
671 %vc = select <vscale x 16 x i1> %cmp, <vscale x 16 x i32> %va, <vscale x 16 x i32> %splat
672 ret <vscale x 16 x i32> %vc
675 define <vscale x 16 x i32> @vmax_vi_nxv16i32_0(<vscale x 16 x i32> %va) {
676 ; CHECK-LABEL: vmax_vi_nxv16i32_0:
678 ; CHECK-NEXT: li a0, -3
679 ; CHECK-NEXT: vsetvli a1, zero, e32, m8, ta, ma
680 ; CHECK-NEXT: vmax.vx v8, v8, a0
682 %head = insertelement <vscale x 16 x i32> poison, i32 -3, i32 0
683 %splat = shufflevector <vscale x 16 x i32> %head, <vscale x 16 x i32> poison, <vscale x 16 x i32> zeroinitializer
684 %cmp = icmp sgt <vscale x 16 x i32> %va, %splat
685 %vc = select <vscale x 16 x i1> %cmp, <vscale x 16 x i32> %va, <vscale x 16 x i32> %splat
686 ret <vscale x 16 x i32> %vc
689 define <vscale x 1 x i64> @vmax_vv_nxv1i64(<vscale x 1 x i64> %va, <vscale x 1 x i64> %vb) {
690 ; CHECK-LABEL: vmax_vv_nxv1i64:
692 ; CHECK-NEXT: vsetvli a0, zero, e64, m1, ta, ma
693 ; CHECK-NEXT: vmax.vv v8, v8, v9
695 %cmp = icmp sgt <vscale x 1 x i64> %va, %vb
696 %vc = select <vscale x 1 x i1> %cmp, <vscale x 1 x i64> %va, <vscale x 1 x i64> %vb
697 ret <vscale x 1 x i64> %vc
700 define <vscale x 1 x i64> @vmax_vx_nxv1i64(<vscale x 1 x i64> %va, i64 %b) {
701 ; RV32-LABEL: vmax_vx_nxv1i64:
703 ; RV32-NEXT: addi sp, sp, -16
704 ; RV32-NEXT: .cfi_def_cfa_offset 16
705 ; RV32-NEXT: sw a1, 12(sp)
706 ; RV32-NEXT: sw a0, 8(sp)
707 ; RV32-NEXT: addi a0, sp, 8
708 ; RV32-NEXT: vsetvli a1, zero, e64, m1, ta, ma
709 ; RV32-NEXT: vlse64.v v9, (a0), zero
710 ; RV32-NEXT: vmax.vv v8, v8, v9
711 ; RV32-NEXT: addi sp, sp, 16
714 ; RV64-LABEL: vmax_vx_nxv1i64:
716 ; RV64-NEXT: vsetvli a1, zero, e64, m1, ta, ma
717 ; RV64-NEXT: vmax.vx v8, v8, a0
719 %head = insertelement <vscale x 1 x i64> poison, i64 %b, i32 0
720 %splat = shufflevector <vscale x 1 x i64> %head, <vscale x 1 x i64> poison, <vscale x 1 x i32> zeroinitializer
721 %cmp = icmp sgt <vscale x 1 x i64> %va, %splat
722 %vc = select <vscale x 1 x i1> %cmp, <vscale x 1 x i64> %va, <vscale x 1 x i64> %splat
723 ret <vscale x 1 x i64> %vc
726 define <vscale x 1 x i64> @vmax_vi_nxv1i64_0(<vscale x 1 x i64> %va) {
727 ; CHECK-LABEL: vmax_vi_nxv1i64_0:
729 ; CHECK-NEXT: li a0, -3
730 ; CHECK-NEXT: vsetvli a1, zero, e64, m1, ta, ma
731 ; CHECK-NEXT: vmax.vx v8, v8, a0
733 %head = insertelement <vscale x 1 x i64> poison, i64 -3, i32 0
734 %splat = shufflevector <vscale x 1 x i64> %head, <vscale x 1 x i64> poison, <vscale x 1 x i32> zeroinitializer
735 %cmp = icmp sgt <vscale x 1 x i64> %va, %splat
736 %vc = select <vscale x 1 x i1> %cmp, <vscale x 1 x i64> %va, <vscale x 1 x i64> %splat
737 ret <vscale x 1 x i64> %vc
740 define <vscale x 2 x i64> @vmax_vv_nxv2i64(<vscale x 2 x i64> %va, <vscale x 2 x i64> %vb) {
741 ; CHECK-LABEL: vmax_vv_nxv2i64:
743 ; CHECK-NEXT: vsetvli a0, zero, e64, m2, ta, ma
744 ; CHECK-NEXT: vmax.vv v8, v8, v10
746 %cmp = icmp sgt <vscale x 2 x i64> %va, %vb
747 %vc = select <vscale x 2 x i1> %cmp, <vscale x 2 x i64> %va, <vscale x 2 x i64> %vb
748 ret <vscale x 2 x i64> %vc
751 define <vscale x 2 x i64> @vmax_vx_nxv2i64(<vscale x 2 x i64> %va, i64 %b) {
752 ; RV32-LABEL: vmax_vx_nxv2i64:
754 ; RV32-NEXT: addi sp, sp, -16
755 ; RV32-NEXT: .cfi_def_cfa_offset 16
756 ; RV32-NEXT: sw a1, 12(sp)
757 ; RV32-NEXT: sw a0, 8(sp)
758 ; RV32-NEXT: addi a0, sp, 8
759 ; RV32-NEXT: vsetvli a1, zero, e64, m2, ta, ma
760 ; RV32-NEXT: vlse64.v v10, (a0), zero
761 ; RV32-NEXT: vmax.vv v8, v8, v10
762 ; RV32-NEXT: addi sp, sp, 16
765 ; RV64-LABEL: vmax_vx_nxv2i64:
767 ; RV64-NEXT: vsetvli a1, zero, e64, m2, ta, ma
768 ; RV64-NEXT: vmax.vx v8, v8, a0
770 %head = insertelement <vscale x 2 x i64> poison, i64 %b, i32 0
771 %splat = shufflevector <vscale x 2 x i64> %head, <vscale x 2 x i64> poison, <vscale x 2 x i32> zeroinitializer
772 %cmp = icmp sgt <vscale x 2 x i64> %va, %splat
773 %vc = select <vscale x 2 x i1> %cmp, <vscale x 2 x i64> %va, <vscale x 2 x i64> %splat
774 ret <vscale x 2 x i64> %vc
777 define <vscale x 2 x i64> @vmax_vi_nxv2i64_0(<vscale x 2 x i64> %va) {
778 ; CHECK-LABEL: vmax_vi_nxv2i64_0:
780 ; CHECK-NEXT: li a0, -3
781 ; CHECK-NEXT: vsetvli a1, zero, e64, m2, ta, ma
782 ; CHECK-NEXT: vmax.vx v8, v8, a0
784 %head = insertelement <vscale x 2 x i64> poison, i64 -3, i32 0
785 %splat = shufflevector <vscale x 2 x i64> %head, <vscale x 2 x i64> poison, <vscale x 2 x i32> zeroinitializer
786 %cmp = icmp sgt <vscale x 2 x i64> %va, %splat
787 %vc = select <vscale x 2 x i1> %cmp, <vscale x 2 x i64> %va, <vscale x 2 x i64> %splat
788 ret <vscale x 2 x i64> %vc
791 define <vscale x 4 x i64> @vmax_vv_nxv4i64(<vscale x 4 x i64> %va, <vscale x 4 x i64> %vb) {
792 ; CHECK-LABEL: vmax_vv_nxv4i64:
794 ; CHECK-NEXT: vsetvli a0, zero, e64, m4, ta, ma
795 ; CHECK-NEXT: vmax.vv v8, v8, v12
797 %cmp = icmp sgt <vscale x 4 x i64> %va, %vb
798 %vc = select <vscale x 4 x i1> %cmp, <vscale x 4 x i64> %va, <vscale x 4 x i64> %vb
799 ret <vscale x 4 x i64> %vc
802 define <vscale x 4 x i64> @vmax_vx_nxv4i64(<vscale x 4 x i64> %va, i64 %b) {
803 ; RV32-LABEL: vmax_vx_nxv4i64:
805 ; RV32-NEXT: addi sp, sp, -16
806 ; RV32-NEXT: .cfi_def_cfa_offset 16
807 ; RV32-NEXT: sw a1, 12(sp)
808 ; RV32-NEXT: sw a0, 8(sp)
809 ; RV32-NEXT: addi a0, sp, 8
810 ; RV32-NEXT: vsetvli a1, zero, e64, m4, ta, ma
811 ; RV32-NEXT: vlse64.v v12, (a0), zero
812 ; RV32-NEXT: vmax.vv v8, v8, v12
813 ; RV32-NEXT: addi sp, sp, 16
816 ; RV64-LABEL: vmax_vx_nxv4i64:
818 ; RV64-NEXT: vsetvli a1, zero, e64, m4, ta, ma
819 ; RV64-NEXT: vmax.vx v8, v8, a0
821 %head = insertelement <vscale x 4 x i64> poison, i64 %b, i32 0
822 %splat = shufflevector <vscale x 4 x i64> %head, <vscale x 4 x i64> poison, <vscale x 4 x i32> zeroinitializer
823 %cmp = icmp sgt <vscale x 4 x i64> %va, %splat
824 %vc = select <vscale x 4 x i1> %cmp, <vscale x 4 x i64> %va, <vscale x 4 x i64> %splat
825 ret <vscale x 4 x i64> %vc
828 define <vscale x 4 x i64> @vmax_vi_nxv4i64_0(<vscale x 4 x i64> %va) {
829 ; CHECK-LABEL: vmax_vi_nxv4i64_0:
831 ; CHECK-NEXT: li a0, -3
832 ; CHECK-NEXT: vsetvli a1, zero, e64, m4, ta, ma
833 ; CHECK-NEXT: vmax.vx v8, v8, a0
835 %head = insertelement <vscale x 4 x i64> poison, i64 -3, i32 0
836 %splat = shufflevector <vscale x 4 x i64> %head, <vscale x 4 x i64> poison, <vscale x 4 x i32> zeroinitializer
837 %cmp = icmp sgt <vscale x 4 x i64> %va, %splat
838 %vc = select <vscale x 4 x i1> %cmp, <vscale x 4 x i64> %va, <vscale x 4 x i64> %splat
839 ret <vscale x 4 x i64> %vc
842 define <vscale x 8 x i64> @vmax_vv_nxv8i64(<vscale x 8 x i64> %va, <vscale x 8 x i64> %vb) {
843 ; CHECK-LABEL: vmax_vv_nxv8i64:
845 ; CHECK-NEXT: vsetvli a0, zero, e64, m8, ta, ma
846 ; CHECK-NEXT: vmax.vv v8, v8, v16
848 %cmp = icmp sgt <vscale x 8 x i64> %va, %vb
849 %vc = select <vscale x 8 x i1> %cmp, <vscale x 8 x i64> %va, <vscale x 8 x i64> %vb
850 ret <vscale x 8 x i64> %vc
853 define <vscale x 8 x i64> @vmax_vx_nxv8i64(<vscale x 8 x i64> %va, i64 %b) {
854 ; RV32-LABEL: vmax_vx_nxv8i64:
856 ; RV32-NEXT: addi sp, sp, -16
857 ; RV32-NEXT: .cfi_def_cfa_offset 16
858 ; RV32-NEXT: sw a1, 12(sp)
859 ; RV32-NEXT: sw a0, 8(sp)
860 ; RV32-NEXT: addi a0, sp, 8
861 ; RV32-NEXT: vsetvli a1, zero, e64, m8, ta, ma
862 ; RV32-NEXT: vlse64.v v16, (a0), zero
863 ; RV32-NEXT: vmax.vv v8, v8, v16
864 ; RV32-NEXT: addi sp, sp, 16
867 ; RV64-LABEL: vmax_vx_nxv8i64:
869 ; RV64-NEXT: vsetvli a1, zero, e64, m8, ta, ma
870 ; RV64-NEXT: vmax.vx v8, v8, a0
872 %head = insertelement <vscale x 8 x i64> poison, i64 %b, i32 0
873 %splat = shufflevector <vscale x 8 x i64> %head, <vscale x 8 x i64> poison, <vscale x 8 x i32> zeroinitializer
874 %cmp = icmp sgt <vscale x 8 x i64> %va, %splat
875 %vc = select <vscale x 8 x i1> %cmp, <vscale x 8 x i64> %va, <vscale x 8 x i64> %splat
876 ret <vscale x 8 x i64> %vc
879 define <vscale x 8 x i64> @vmax_vi_nxv8i64_0(<vscale x 8 x i64> %va) {
880 ; CHECK-LABEL: vmax_vi_nxv8i64_0:
882 ; CHECK-NEXT: li a0, -3
883 ; CHECK-NEXT: vsetvli a1, zero, e64, m8, ta, ma
884 ; CHECK-NEXT: vmax.vx v8, v8, a0
886 %head = insertelement <vscale x 8 x i64> poison, i64 -3, i32 0
887 %splat = shufflevector <vscale x 8 x i64> %head, <vscale x 8 x i64> poison, <vscale x 8 x i32> zeroinitializer
888 %cmp = icmp sgt <vscale x 8 x i64> %va, %splat
889 %vc = select <vscale x 8 x i1> %cmp, <vscale x 8 x i64> %va, <vscale x 8 x i64> %splat
890 ret <vscale x 8 x i64> %vc