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 <vscale x 8 x i7> @llvm.vp.smax.nxv8i7(<vscale x 8 x i7>, <vscale x 8 x i7>, <vscale x 8 x i1>, i32)
9 define <vscale x 8 x i7> @vmax_vx_nxv8i7(<vscale x 8 x i7> %a, i7 signext %b, <vscale x 8 x i1> %mask, i32 zeroext %evl) {
10 ; CHECK-LABEL: vmax_vx_nxv8i7:
12 ; CHECK-NEXT: vsetvli a2, zero, e8, m1, ta, ma
13 ; CHECK-NEXT: vadd.vv v8, v8, v8
14 ; CHECK-NEXT: vsra.vi v8, v8, 1
15 ; CHECK-NEXT: vsetvli zero, a1, e8, m1, ta, ma
16 ; CHECK-NEXT: vmax.vx v8, v8, a0, v0.t
18 %elt.head = insertelement <vscale x 8 x i7> poison, i7 %b, i32 0
19 %vb = shufflevector <vscale x 8 x i7> %elt.head, <vscale x 8 x i7> poison, <vscale x 8 x i32> zeroinitializer
20 %v = call <vscale x 8 x i7> @llvm.vp.smax.nxv8i7(<vscale x 8 x i7> %a, <vscale x 8 x i7> %vb, <vscale x 8 x i1> %mask, i32 %evl)
21 ret <vscale x 8 x i7> %v
24 declare <vscale x 1 x i8> @llvm.vp.smax.nxv1i8(<vscale x 1 x i8>, <vscale x 1 x i8>, <vscale x 1 x i1>, i32)
26 define <vscale x 1 x i8> @vmax_vv_nxv1i8(<vscale x 1 x i8> %va, <vscale x 1 x i8> %b, <vscale x 1 x i1> %m, i32 zeroext %evl) {
27 ; CHECK-LABEL: vmax_vv_nxv1i8:
29 ; CHECK-NEXT: vsetvli zero, a0, e8, mf8, ta, ma
30 ; CHECK-NEXT: vmax.vv v8, v8, v9, v0.t
32 %v = call <vscale x 1 x i8> @llvm.vp.smax.nxv1i8(<vscale x 1 x i8> %va, <vscale x 1 x i8> %b, <vscale x 1 x i1> %m, i32 %evl)
33 ret <vscale x 1 x i8> %v
36 define <vscale x 1 x i8> @vmax_vv_nxv1i8_unmasked(<vscale x 1 x i8> %va, <vscale x 1 x i8> %b, i32 zeroext %evl) {
37 ; CHECK-LABEL: vmax_vv_nxv1i8_unmasked:
39 ; CHECK-NEXT: vsetvli zero, a0, e8, mf8, ta, ma
40 ; CHECK-NEXT: vmax.vv v8, v8, v9
42 %head = insertelement <vscale x 1 x i1> poison, i1 true, i32 0
43 %m = shufflevector <vscale x 1 x i1> %head, <vscale x 1 x i1> poison, <vscale x 1 x i32> zeroinitializer
44 %v = call <vscale x 1 x i8> @llvm.vp.smax.nxv1i8(<vscale x 1 x i8> %va, <vscale x 1 x i8> %b, <vscale x 1 x i1> %m, i32 %evl)
45 ret <vscale x 1 x i8> %v
48 define <vscale x 1 x i8> @vmax_vx_nxv1i8(<vscale x 1 x i8> %va, i8 %b, <vscale x 1 x i1> %m, i32 zeroext %evl) {
49 ; CHECK-LABEL: vmax_vx_nxv1i8:
51 ; CHECK-NEXT: vsetvli zero, a1, e8, mf8, ta, ma
52 ; CHECK-NEXT: vmax.vx v8, v8, a0, v0.t
54 %elt.head = insertelement <vscale x 1 x i8> poison, i8 %b, i32 0
55 %vb = shufflevector <vscale x 1 x i8> %elt.head, <vscale x 1 x i8> poison, <vscale x 1 x i32> zeroinitializer
56 %v = call <vscale x 1 x i8> @llvm.vp.smax.nxv1i8(<vscale x 1 x i8> %va, <vscale x 1 x i8> %vb, <vscale x 1 x i1> %m, i32 %evl)
57 ret <vscale x 1 x i8> %v
60 define <vscale x 1 x i8> @vmax_vx_nxv1i8_commute(<vscale x 1 x i8> %va, i8 %b, <vscale x 1 x i1> %m, i32 zeroext %evl) {
61 ; CHECK-LABEL: vmax_vx_nxv1i8_commute:
63 ; CHECK-NEXT: vsetvli zero, a1, e8, mf8, ta, ma
64 ; CHECK-NEXT: vmax.vx v8, v8, a0, v0.t
66 %elt.head = insertelement <vscale x 1 x i8> poison, i8 %b, i32 0
67 %vb = shufflevector <vscale x 1 x i8> %elt.head, <vscale x 1 x i8> poison, <vscale x 1 x i32> zeroinitializer
68 %v = call <vscale x 1 x i8> @llvm.vp.smax.nxv1i8(<vscale x 1 x i8> %vb, <vscale x 1 x i8> %va, <vscale x 1 x i1> %m, i32 %evl)
69 ret <vscale x 1 x i8> %v
72 define <vscale x 1 x i8> @vmax_vx_nxv1i8_unmasked(<vscale x 1 x i8> %va, i8 %b, i32 zeroext %evl) {
73 ; CHECK-LABEL: vmax_vx_nxv1i8_unmasked:
75 ; CHECK-NEXT: vsetvli zero, a1, e8, mf8, ta, ma
76 ; CHECK-NEXT: vmax.vx v8, v8, a0
78 %elt.head = insertelement <vscale x 1 x i8> poison, i8 %b, i32 0
79 %vb = shufflevector <vscale x 1 x i8> %elt.head, <vscale x 1 x i8> poison, <vscale x 1 x i32> zeroinitializer
80 %head = insertelement <vscale x 1 x i1> poison, i1 true, i32 0
81 %m = shufflevector <vscale x 1 x i1> %head, <vscale x 1 x i1> poison, <vscale x 1 x i32> zeroinitializer
82 %v = call <vscale x 1 x i8> @llvm.vp.smax.nxv1i8(<vscale x 1 x i8> %va, <vscale x 1 x i8> %vb, <vscale x 1 x i1> %m, i32 %evl)
83 ret <vscale x 1 x i8> %v
86 declare <vscale x 2 x i8> @llvm.vp.smax.nxv2i8(<vscale x 2 x i8>, <vscale x 2 x i8>, <vscale x 2 x i1>, i32)
88 define <vscale x 2 x i8> @vmax_vv_nxv2i8(<vscale x 2 x i8> %va, <vscale x 2 x i8> %b, <vscale x 2 x i1> %m, i32 zeroext %evl) {
89 ; CHECK-LABEL: vmax_vv_nxv2i8:
91 ; CHECK-NEXT: vsetvli zero, a0, e8, mf4, ta, ma
92 ; CHECK-NEXT: vmax.vv v8, v8, v9, v0.t
94 %v = call <vscale x 2 x i8> @llvm.vp.smax.nxv2i8(<vscale x 2 x i8> %va, <vscale x 2 x i8> %b, <vscale x 2 x i1> %m, i32 %evl)
95 ret <vscale x 2 x i8> %v
98 define <vscale x 2 x i8> @vmax_vv_nxv2i8_unmasked(<vscale x 2 x i8> %va, <vscale x 2 x i8> %b, i32 zeroext %evl) {
99 ; CHECK-LABEL: vmax_vv_nxv2i8_unmasked:
101 ; CHECK-NEXT: vsetvli zero, a0, e8, mf4, ta, ma
102 ; CHECK-NEXT: vmax.vv v8, v8, v9
104 %head = insertelement <vscale x 2 x i1> poison, i1 true, i32 0
105 %m = shufflevector <vscale x 2 x i1> %head, <vscale x 2 x i1> poison, <vscale x 2 x i32> zeroinitializer
106 %v = call <vscale x 2 x i8> @llvm.vp.smax.nxv2i8(<vscale x 2 x i8> %va, <vscale x 2 x i8> %b, <vscale x 2 x i1> %m, i32 %evl)
107 ret <vscale x 2 x i8> %v
110 define <vscale x 2 x i8> @vmax_vx_nxv2i8(<vscale x 2 x i8> %va, i8 %b, <vscale x 2 x i1> %m, i32 zeroext %evl) {
111 ; CHECK-LABEL: vmax_vx_nxv2i8:
113 ; CHECK-NEXT: vsetvli zero, a1, e8, mf4, ta, ma
114 ; CHECK-NEXT: vmax.vx v8, v8, a0, v0.t
116 %elt.head = insertelement <vscale x 2 x i8> poison, i8 %b, i32 0
117 %vb = shufflevector <vscale x 2 x i8> %elt.head, <vscale x 2 x i8> poison, <vscale x 2 x i32> zeroinitializer
118 %v = call <vscale x 2 x i8> @llvm.vp.smax.nxv2i8(<vscale x 2 x i8> %va, <vscale x 2 x i8> %vb, <vscale x 2 x i1> %m, i32 %evl)
119 ret <vscale x 2 x i8> %v
122 define <vscale x 2 x i8> @vmax_vx_nxv2i8_unmasked(<vscale x 2 x i8> %va, i8 %b, i32 zeroext %evl) {
123 ; CHECK-LABEL: vmax_vx_nxv2i8_unmasked:
125 ; CHECK-NEXT: vsetvli zero, a1, e8, mf4, ta, ma
126 ; CHECK-NEXT: vmax.vx v8, v8, a0
128 %elt.head = insertelement <vscale x 2 x i8> poison, i8 %b, i32 0
129 %vb = shufflevector <vscale x 2 x i8> %elt.head, <vscale x 2 x i8> poison, <vscale x 2 x i32> zeroinitializer
130 %head = insertelement <vscale x 2 x i1> poison, i1 true, i32 0
131 %m = shufflevector <vscale x 2 x i1> %head, <vscale x 2 x i1> poison, <vscale x 2 x i32> zeroinitializer
132 %v = call <vscale x 2 x i8> @llvm.vp.smax.nxv2i8(<vscale x 2 x i8> %va, <vscale x 2 x i8> %vb, <vscale x 2 x i1> %m, i32 %evl)
133 ret <vscale x 2 x i8> %v
136 declare <vscale x 3 x i8> @llvm.vp.smax.nxv3i8(<vscale x 3 x i8>, <vscale x 3 x i8>, <vscale x 3 x i1>, i32)
138 define <vscale x 3 x i8> @vmax_vv_nxv3i8(<vscale x 3 x i8> %va, <vscale x 3 x i8> %b, <vscale x 3 x i1> %m, i32 zeroext %evl) {
139 ; CHECK-LABEL: vmax_vv_nxv3i8:
141 ; CHECK-NEXT: vsetvli zero, a0, e8, mf2, ta, ma
142 ; CHECK-NEXT: vmax.vv v8, v8, v9, v0.t
144 %v = call <vscale x 3 x i8> @llvm.vp.smax.nxv3i8(<vscale x 3 x i8> %va, <vscale x 3 x i8> %b, <vscale x 3 x i1> %m, i32 %evl)
145 ret <vscale x 3 x i8> %v
148 define <vscale x 3 x i8> @vmax_vv_nxv3i8_unmasked(<vscale x 3 x i8> %va, <vscale x 3 x i8> %b, i32 zeroext %evl) {
149 ; CHECK-LABEL: vmax_vv_nxv3i8_unmasked:
151 ; CHECK-NEXT: vsetvli zero, a0, e8, mf2, ta, ma
152 ; CHECK-NEXT: vmax.vv v8, v8, v9
154 %head = insertelement <vscale x 3 x i1> poison, i1 true, i32 0
155 %m = shufflevector <vscale x 3 x i1> %head, <vscale x 3 x i1> poison, <vscale x 3 x i32> zeroinitializer
156 %v = call <vscale x 3 x i8> @llvm.vp.smax.nxv3i8(<vscale x 3 x i8> %va, <vscale x 3 x i8> %b, <vscale x 3 x i1> %m, i32 %evl)
157 ret <vscale x 3 x i8> %v
160 define <vscale x 3 x i8> @vmax_vx_nxv3i8(<vscale x 3 x i8> %va, i8 %b, <vscale x 3 x i1> %m, i32 zeroext %evl) {
161 ; CHECK-LABEL: vmax_vx_nxv3i8:
163 ; CHECK-NEXT: vsetvli zero, a1, e8, mf2, ta, ma
164 ; CHECK-NEXT: vmax.vx v8, v8, a0, v0.t
166 %elt.head = insertelement <vscale x 3 x i8> poison, i8 %b, i32 0
167 %vb = shufflevector <vscale x 3 x i8> %elt.head, <vscale x 3 x i8> poison, <vscale x 3 x i32> zeroinitializer
168 %v = call <vscale x 3 x i8> @llvm.vp.smax.nxv3i8(<vscale x 3 x i8> %va, <vscale x 3 x i8> %vb, <vscale x 3 x i1> %m, i32 %evl)
169 ret <vscale x 3 x i8> %v
172 define <vscale x 3 x i8> @vmax_vx_nxv3i8_unmasked(<vscale x 3 x i8> %va, i8 %b, i32 zeroext %evl) {
173 ; CHECK-LABEL: vmax_vx_nxv3i8_unmasked:
175 ; CHECK-NEXT: vsetvli zero, a1, e8, mf2, ta, ma
176 ; CHECK-NEXT: vmax.vx v8, v8, a0
178 %elt.head = insertelement <vscale x 3 x i8> poison, i8 %b, i32 0
179 %vb = shufflevector <vscale x 3 x i8> %elt.head, <vscale x 3 x i8> poison, <vscale x 3 x i32> zeroinitializer
180 %head = insertelement <vscale x 3 x i1> poison, i1 true, i32 0
181 %m = shufflevector <vscale x 3 x i1> %head, <vscale x 3 x i1> poison, <vscale x 3 x i32> zeroinitializer
182 %v = call <vscale x 3 x i8> @llvm.vp.smax.nxv3i8(<vscale x 3 x i8> %va, <vscale x 3 x i8> %vb, <vscale x 3 x i1> %m, i32 %evl)
183 ret <vscale x 3 x i8> %v
186 declare <vscale x 4 x i8> @llvm.vp.smax.nxv4i8(<vscale x 4 x i8>, <vscale x 4 x i8>, <vscale x 4 x i1>, i32)
188 define <vscale x 4 x i8> @vmax_vv_nxv4i8(<vscale x 4 x i8> %va, <vscale x 4 x i8> %b, <vscale x 4 x i1> %m, i32 zeroext %evl) {
189 ; CHECK-LABEL: vmax_vv_nxv4i8:
191 ; CHECK-NEXT: vsetvli zero, a0, e8, mf2, ta, ma
192 ; CHECK-NEXT: vmax.vv v8, v8, v9, v0.t
194 %v = call <vscale x 4 x i8> @llvm.vp.smax.nxv4i8(<vscale x 4 x i8> %va, <vscale x 4 x i8> %b, <vscale x 4 x i1> %m, i32 %evl)
195 ret <vscale x 4 x i8> %v
198 define <vscale x 4 x i8> @vmax_vv_nxv4i8_unmasked(<vscale x 4 x i8> %va, <vscale x 4 x i8> %b, i32 zeroext %evl) {
199 ; CHECK-LABEL: vmax_vv_nxv4i8_unmasked:
201 ; CHECK-NEXT: vsetvli zero, a0, e8, mf2, ta, ma
202 ; CHECK-NEXT: vmax.vv v8, v8, v9
204 %head = insertelement <vscale x 4 x i1> poison, i1 true, i32 0
205 %m = shufflevector <vscale x 4 x i1> %head, <vscale x 4 x i1> poison, <vscale x 4 x i32> zeroinitializer
206 %v = call <vscale x 4 x i8> @llvm.vp.smax.nxv4i8(<vscale x 4 x i8> %va, <vscale x 4 x i8> %b, <vscale x 4 x i1> %m, i32 %evl)
207 ret <vscale x 4 x i8> %v
210 define <vscale x 4 x i8> @vmax_vx_nxv4i8(<vscale x 4 x i8> %va, i8 %b, <vscale x 4 x i1> %m, i32 zeroext %evl) {
211 ; CHECK-LABEL: vmax_vx_nxv4i8:
213 ; CHECK-NEXT: vsetvli zero, a1, e8, mf2, ta, ma
214 ; CHECK-NEXT: vmax.vx v8, v8, a0, v0.t
216 %elt.head = insertelement <vscale x 4 x i8> poison, i8 %b, i32 0
217 %vb = shufflevector <vscale x 4 x i8> %elt.head, <vscale x 4 x i8> poison, <vscale x 4 x i32> zeroinitializer
218 %v = call <vscale x 4 x i8> @llvm.vp.smax.nxv4i8(<vscale x 4 x i8> %va, <vscale x 4 x i8> %vb, <vscale x 4 x i1> %m, i32 %evl)
219 ret <vscale x 4 x i8> %v
222 define <vscale x 4 x i8> @vmax_vx_nxv4i8_unmasked(<vscale x 4 x i8> %va, i8 %b, i32 zeroext %evl) {
223 ; CHECK-LABEL: vmax_vx_nxv4i8_unmasked:
225 ; CHECK-NEXT: vsetvli zero, a1, e8, mf2, ta, ma
226 ; CHECK-NEXT: vmax.vx v8, v8, a0
228 %elt.head = insertelement <vscale x 4 x i8> poison, i8 %b, i32 0
229 %vb = shufflevector <vscale x 4 x i8> %elt.head, <vscale x 4 x i8> poison, <vscale x 4 x i32> zeroinitializer
230 %head = insertelement <vscale x 4 x i1> poison, i1 true, i32 0
231 %m = shufflevector <vscale x 4 x i1> %head, <vscale x 4 x i1> poison, <vscale x 4 x i32> zeroinitializer
232 %v = call <vscale x 4 x i8> @llvm.vp.smax.nxv4i8(<vscale x 4 x i8> %va, <vscale x 4 x i8> %vb, <vscale x 4 x i1> %m, i32 %evl)
233 ret <vscale x 4 x i8> %v
236 declare <vscale x 8 x i8> @llvm.vp.smax.nxv8i8(<vscale x 8 x i8>, <vscale x 8 x i8>, <vscale x 8 x i1>, i32)
238 define <vscale x 8 x i8> @vmax_vv_nxv8i8(<vscale x 8 x i8> %va, <vscale x 8 x i8> %b, <vscale x 8 x i1> %m, i32 zeroext %evl) {
239 ; CHECK-LABEL: vmax_vv_nxv8i8:
241 ; CHECK-NEXT: vsetvli zero, a0, e8, m1, ta, ma
242 ; CHECK-NEXT: vmax.vv v8, v8, v9, v0.t
244 %v = call <vscale x 8 x i8> @llvm.vp.smax.nxv8i8(<vscale x 8 x i8> %va, <vscale x 8 x i8> %b, <vscale x 8 x i1> %m, i32 %evl)
245 ret <vscale x 8 x i8> %v
248 define <vscale x 8 x i8> @vmax_vv_nxv8i8_unmasked(<vscale x 8 x i8> %va, <vscale x 8 x i8> %b, i32 zeroext %evl) {
249 ; CHECK-LABEL: vmax_vv_nxv8i8_unmasked:
251 ; CHECK-NEXT: vsetvli zero, a0, e8, m1, ta, ma
252 ; CHECK-NEXT: vmax.vv v8, v8, v9
254 %head = insertelement <vscale x 8 x i1> poison, i1 true, i32 0
255 %m = shufflevector <vscale x 8 x i1> %head, <vscale x 8 x i1> poison, <vscale x 8 x i32> zeroinitializer
256 %v = call <vscale x 8 x i8> @llvm.vp.smax.nxv8i8(<vscale x 8 x i8> %va, <vscale x 8 x i8> %b, <vscale x 8 x i1> %m, i32 %evl)
257 ret <vscale x 8 x i8> %v
260 define <vscale x 8 x i8> @vmax_vx_nxv8i8(<vscale x 8 x i8> %va, i8 %b, <vscale x 8 x i1> %m, i32 zeroext %evl) {
261 ; CHECK-LABEL: vmax_vx_nxv8i8:
263 ; CHECK-NEXT: vsetvli zero, a1, e8, m1, ta, ma
264 ; CHECK-NEXT: vmax.vx v8, v8, a0, v0.t
266 %elt.head = insertelement <vscale x 8 x i8> poison, i8 %b, i32 0
267 %vb = shufflevector <vscale x 8 x i8> %elt.head, <vscale x 8 x i8> poison, <vscale x 8 x i32> zeroinitializer
268 %v = call <vscale x 8 x i8> @llvm.vp.smax.nxv8i8(<vscale x 8 x i8> %va, <vscale x 8 x i8> %vb, <vscale x 8 x i1> %m, i32 %evl)
269 ret <vscale x 8 x i8> %v
272 define <vscale x 8 x i8> @vmax_vx_nxv8i8_unmasked(<vscale x 8 x i8> %va, i8 %b, i32 zeroext %evl) {
273 ; CHECK-LABEL: vmax_vx_nxv8i8_unmasked:
275 ; CHECK-NEXT: vsetvli zero, a1, e8, m1, ta, ma
276 ; CHECK-NEXT: vmax.vx v8, v8, a0
278 %elt.head = insertelement <vscale x 8 x i8> poison, i8 %b, i32 0
279 %vb = shufflevector <vscale x 8 x i8> %elt.head, <vscale x 8 x i8> poison, <vscale x 8 x i32> zeroinitializer
280 %head = insertelement <vscale x 8 x i1> poison, i1 true, i32 0
281 %m = shufflevector <vscale x 8 x i1> %head, <vscale x 8 x i1> poison, <vscale x 8 x i32> zeroinitializer
282 %v = call <vscale x 8 x i8> @llvm.vp.smax.nxv8i8(<vscale x 8 x i8> %va, <vscale x 8 x i8> %vb, <vscale x 8 x i1> %m, i32 %evl)
283 ret <vscale x 8 x i8> %v
286 declare <vscale x 16 x i8> @llvm.vp.smax.nxv16i8(<vscale x 16 x i8>, <vscale x 16 x i8>, <vscale x 16 x i1>, i32)
288 define <vscale x 16 x i8> @vmax_vv_nxv16i8(<vscale x 16 x i8> %va, <vscale x 16 x i8> %b, <vscale x 16 x i1> %m, i32 zeroext %evl) {
289 ; CHECK-LABEL: vmax_vv_nxv16i8:
291 ; CHECK-NEXT: vsetvli zero, a0, e8, m2, ta, ma
292 ; CHECK-NEXT: vmax.vv v8, v8, v10, v0.t
294 %v = call <vscale x 16 x i8> @llvm.vp.smax.nxv16i8(<vscale x 16 x i8> %va, <vscale x 16 x i8> %b, <vscale x 16 x i1> %m, i32 %evl)
295 ret <vscale x 16 x i8> %v
298 define <vscale x 16 x i8> @vmax_vv_nxv16i8_unmasked(<vscale x 16 x i8> %va, <vscale x 16 x i8> %b, i32 zeroext %evl) {
299 ; CHECK-LABEL: vmax_vv_nxv16i8_unmasked:
301 ; CHECK-NEXT: vsetvli zero, a0, e8, m2, ta, ma
302 ; CHECK-NEXT: vmax.vv v8, v8, v10
304 %head = insertelement <vscale x 16 x i1> poison, i1 true, i32 0
305 %m = shufflevector <vscale x 16 x i1> %head, <vscale x 16 x i1> poison, <vscale x 16 x i32> zeroinitializer
306 %v = call <vscale x 16 x i8> @llvm.vp.smax.nxv16i8(<vscale x 16 x i8> %va, <vscale x 16 x i8> %b, <vscale x 16 x i1> %m, i32 %evl)
307 ret <vscale x 16 x i8> %v
310 define <vscale x 16 x i8> @vmax_vx_nxv16i8(<vscale x 16 x i8> %va, i8 %b, <vscale x 16 x i1> %m, i32 zeroext %evl) {
311 ; CHECK-LABEL: vmax_vx_nxv16i8:
313 ; CHECK-NEXT: vsetvli zero, a1, e8, m2, ta, ma
314 ; CHECK-NEXT: vmax.vx v8, v8, a0, v0.t
316 %elt.head = insertelement <vscale x 16 x i8> poison, i8 %b, i32 0
317 %vb = shufflevector <vscale x 16 x i8> %elt.head, <vscale x 16 x i8> poison, <vscale x 16 x i32> zeroinitializer
318 %v = call <vscale x 16 x i8> @llvm.vp.smax.nxv16i8(<vscale x 16 x i8> %va, <vscale x 16 x i8> %vb, <vscale x 16 x i1> %m, i32 %evl)
319 ret <vscale x 16 x i8> %v
322 define <vscale x 16 x i8> @vmax_vx_nxv16i8_unmasked(<vscale x 16 x i8> %va, i8 %b, i32 zeroext %evl) {
323 ; CHECK-LABEL: vmax_vx_nxv16i8_unmasked:
325 ; CHECK-NEXT: vsetvli zero, a1, e8, m2, ta, ma
326 ; CHECK-NEXT: vmax.vx v8, v8, a0
328 %elt.head = insertelement <vscale x 16 x i8> poison, i8 %b, i32 0
329 %vb = shufflevector <vscale x 16 x i8> %elt.head, <vscale x 16 x i8> poison, <vscale x 16 x i32> zeroinitializer
330 %head = insertelement <vscale x 16 x i1> poison, i1 true, i32 0
331 %m = shufflevector <vscale x 16 x i1> %head, <vscale x 16 x i1> poison, <vscale x 16 x i32> zeroinitializer
332 %v = call <vscale x 16 x i8> @llvm.vp.smax.nxv16i8(<vscale x 16 x i8> %va, <vscale x 16 x i8> %vb, <vscale x 16 x i1> %m, i32 %evl)
333 ret <vscale x 16 x i8> %v
336 declare <vscale x 32 x i8> @llvm.vp.smax.nxv32i8(<vscale x 32 x i8>, <vscale x 32 x i8>, <vscale x 32 x i1>, i32)
338 define <vscale x 32 x i8> @vmax_vv_nxv32i8(<vscale x 32 x i8> %va, <vscale x 32 x i8> %b, <vscale x 32 x i1> %m, i32 zeroext %evl) {
339 ; CHECK-LABEL: vmax_vv_nxv32i8:
341 ; CHECK-NEXT: vsetvli zero, a0, e8, m4, ta, ma
342 ; CHECK-NEXT: vmax.vv v8, v8, v12, v0.t
344 %v = call <vscale x 32 x i8> @llvm.vp.smax.nxv32i8(<vscale x 32 x i8> %va, <vscale x 32 x i8> %b, <vscale x 32 x i1> %m, i32 %evl)
345 ret <vscale x 32 x i8> %v
348 define <vscale x 32 x i8> @vmax_vv_nxv32i8_unmasked(<vscale x 32 x i8> %va, <vscale x 32 x i8> %b, i32 zeroext %evl) {
349 ; CHECK-LABEL: vmax_vv_nxv32i8_unmasked:
351 ; CHECK-NEXT: vsetvli zero, a0, e8, m4, ta, ma
352 ; CHECK-NEXT: vmax.vv v8, v8, v12
354 %head = insertelement <vscale x 32 x i1> poison, i1 true, i32 0
355 %m = shufflevector <vscale x 32 x i1> %head, <vscale x 32 x i1> poison, <vscale x 32 x i32> zeroinitializer
356 %v = call <vscale x 32 x i8> @llvm.vp.smax.nxv32i8(<vscale x 32 x i8> %va, <vscale x 32 x i8> %b, <vscale x 32 x i1> %m, i32 %evl)
357 ret <vscale x 32 x i8> %v
360 define <vscale x 32 x i8> @vmax_vx_nxv32i8(<vscale x 32 x i8> %va, i8 %b, <vscale x 32 x i1> %m, i32 zeroext %evl) {
361 ; CHECK-LABEL: vmax_vx_nxv32i8:
363 ; CHECK-NEXT: vsetvli zero, a1, e8, m4, ta, ma
364 ; CHECK-NEXT: vmax.vx v8, v8, a0, v0.t
366 %elt.head = insertelement <vscale x 32 x i8> poison, i8 %b, i32 0
367 %vb = shufflevector <vscale x 32 x i8> %elt.head, <vscale x 32 x i8> poison, <vscale x 32 x i32> zeroinitializer
368 %v = call <vscale x 32 x i8> @llvm.vp.smax.nxv32i8(<vscale x 32 x i8> %va, <vscale x 32 x i8> %vb, <vscale x 32 x i1> %m, i32 %evl)
369 ret <vscale x 32 x i8> %v
372 define <vscale x 32 x i8> @vmax_vx_nxv32i8_unmasked(<vscale x 32 x i8> %va, i8 %b, i32 zeroext %evl) {
373 ; CHECK-LABEL: vmax_vx_nxv32i8_unmasked:
375 ; CHECK-NEXT: vsetvli zero, a1, e8, m4, ta, ma
376 ; CHECK-NEXT: vmax.vx v8, v8, a0
378 %elt.head = insertelement <vscale x 32 x i8> poison, i8 %b, i32 0
379 %vb = shufflevector <vscale x 32 x i8> %elt.head, <vscale x 32 x i8> poison, <vscale x 32 x i32> zeroinitializer
380 %head = insertelement <vscale x 32 x i1> poison, i1 true, i32 0
381 %m = shufflevector <vscale x 32 x i1> %head, <vscale x 32 x i1> poison, <vscale x 32 x i32> zeroinitializer
382 %v = call <vscale x 32 x i8> @llvm.vp.smax.nxv32i8(<vscale x 32 x i8> %va, <vscale x 32 x i8> %vb, <vscale x 32 x i1> %m, i32 %evl)
383 ret <vscale x 32 x i8> %v
386 declare <vscale x 64 x i8> @llvm.vp.smax.nxv64i8(<vscale x 64 x i8>, <vscale x 64 x i8>, <vscale x 64 x i1>, i32)
388 define <vscale x 64 x i8> @vmax_vv_nxv64i8(<vscale x 64 x i8> %va, <vscale x 64 x i8> %b, <vscale x 64 x i1> %m, i32 zeroext %evl) {
389 ; CHECK-LABEL: vmax_vv_nxv64i8:
391 ; CHECK-NEXT: vsetvli zero, a0, e8, m8, ta, ma
392 ; CHECK-NEXT: vmax.vv v8, v8, v16, v0.t
394 %v = call <vscale x 64 x i8> @llvm.vp.smax.nxv64i8(<vscale x 64 x i8> %va, <vscale x 64 x i8> %b, <vscale x 64 x i1> %m, i32 %evl)
395 ret <vscale x 64 x i8> %v
398 define <vscale x 64 x i8> @vmax_vv_nxv64i8_unmasked(<vscale x 64 x i8> %va, <vscale x 64 x i8> %b, i32 zeroext %evl) {
399 ; CHECK-LABEL: vmax_vv_nxv64i8_unmasked:
401 ; CHECK-NEXT: vsetvli zero, a0, e8, m8, ta, ma
402 ; CHECK-NEXT: vmax.vv v8, v8, v16
404 %head = insertelement <vscale x 64 x i1> poison, i1 true, i32 0
405 %m = shufflevector <vscale x 64 x i1> %head, <vscale x 64 x i1> poison, <vscale x 64 x i32> zeroinitializer
406 %v = call <vscale x 64 x i8> @llvm.vp.smax.nxv64i8(<vscale x 64 x i8> %va, <vscale x 64 x i8> %b, <vscale x 64 x i1> %m, i32 %evl)
407 ret <vscale x 64 x i8> %v
410 define <vscale x 64 x i8> @vmax_vx_nxv64i8(<vscale x 64 x i8> %va, i8 %b, <vscale x 64 x i1> %m, i32 zeroext %evl) {
411 ; CHECK-LABEL: vmax_vx_nxv64i8:
413 ; CHECK-NEXT: vsetvli zero, a1, e8, m8, ta, ma
414 ; CHECK-NEXT: vmax.vx v8, v8, a0, v0.t
416 %elt.head = insertelement <vscale x 64 x i8> poison, i8 %b, i32 0
417 %vb = shufflevector <vscale x 64 x i8> %elt.head, <vscale x 64 x i8> poison, <vscale x 64 x i32> zeroinitializer
418 %v = call <vscale x 64 x i8> @llvm.vp.smax.nxv64i8(<vscale x 64 x i8> %va, <vscale x 64 x i8> %vb, <vscale x 64 x i1> %m, i32 %evl)
419 ret <vscale x 64 x i8> %v
422 define <vscale x 64 x i8> @vmax_vx_nxv64i8_unmasked(<vscale x 64 x i8> %va, i8 %b, i32 zeroext %evl) {
423 ; CHECK-LABEL: vmax_vx_nxv64i8_unmasked:
425 ; CHECK-NEXT: vsetvli zero, a1, e8, m8, ta, ma
426 ; CHECK-NEXT: vmax.vx v8, v8, a0
428 %elt.head = insertelement <vscale x 64 x i8> poison, i8 %b, i32 0
429 %vb = shufflevector <vscale x 64 x i8> %elt.head, <vscale x 64 x i8> poison, <vscale x 64 x i32> zeroinitializer
430 %head = insertelement <vscale x 64 x i1> poison, i1 true, i32 0
431 %m = shufflevector <vscale x 64 x i1> %head, <vscale x 64 x i1> poison, <vscale x 64 x i32> zeroinitializer
432 %v = call <vscale x 64 x i8> @llvm.vp.smax.nxv64i8(<vscale x 64 x i8> %va, <vscale x 64 x i8> %vb, <vscale x 64 x i1> %m, i32 %evl)
433 ret <vscale x 64 x i8> %v
436 ; Test that split-legalization works when the mask itself needs splitting.
438 declare <vscale x 128 x i8> @llvm.vp.smax.nxv128i8(<vscale x 128 x i8>, <vscale x 128 x i8>, <vscale x 128 x i1>, i32)
440 define <vscale x 128 x i8> @vmax_vx_nxv128i8(<vscale x 128 x i8> %va, i8 %b, <vscale x 128 x i1> %m, i32 zeroext %evl) {
441 ; CHECK-LABEL: vmax_vx_nxv128i8:
443 ; CHECK-NEXT: vmv1r.v v24, v0
444 ; CHECK-NEXT: vsetvli a3, zero, e8, m8, ta, ma
445 ; CHECK-NEXT: vlm.v v0, (a1)
446 ; CHECK-NEXT: csrr a1, vlenb
447 ; CHECK-NEXT: slli a1, a1, 3
448 ; CHECK-NEXT: sub a3, a2, a1
449 ; CHECK-NEXT: sltu a4, a2, a3
450 ; CHECK-NEXT: addi a4, a4, -1
451 ; CHECK-NEXT: and a3, a4, a3
452 ; CHECK-NEXT: vsetvli zero, a3, e8, m8, ta, ma
453 ; CHECK-NEXT: vmax.vx v16, v16, a0, v0.t
454 ; CHECK-NEXT: bltu a2, a1, .LBB34_2
455 ; CHECK-NEXT: # %bb.1:
456 ; CHECK-NEXT: mv a2, a1
457 ; CHECK-NEXT: .LBB34_2:
458 ; CHECK-NEXT: vsetvli zero, a2, e8, m8, ta, ma
459 ; CHECK-NEXT: vmv1r.v v0, v24
460 ; CHECK-NEXT: vmax.vx v8, v8, a0, v0.t
462 %elt.head = insertelement <vscale x 128 x i8> poison, i8 %b, i32 0
463 %vb = shufflevector <vscale x 128 x i8> %elt.head, <vscale x 128 x i8> poison, <vscale x 128 x i32> zeroinitializer
464 %v = call <vscale x 128 x i8> @llvm.vp.smax.nxv128i8(<vscale x 128 x i8> %va, <vscale x 128 x i8> %vb, <vscale x 128 x i1> %m, i32 %evl)
465 ret <vscale x 128 x i8> %v
468 define <vscale x 128 x i8> @vmax_vx_nxv128i8_unmasked(<vscale x 128 x i8> %va, i8 %b, i32 zeroext %evl) {
469 ; CHECK-LABEL: vmax_vx_nxv128i8_unmasked:
471 ; CHECK-NEXT: csrr a2, vlenb
472 ; CHECK-NEXT: slli a2, a2, 3
473 ; CHECK-NEXT: sub a3, a1, a2
474 ; CHECK-NEXT: sltu a4, a1, a3
475 ; CHECK-NEXT: addi a4, a4, -1
476 ; CHECK-NEXT: and a3, a4, a3
477 ; CHECK-NEXT: vsetvli zero, a3, e8, m8, ta, ma
478 ; CHECK-NEXT: vmax.vx v16, v16, a0
479 ; CHECK-NEXT: bltu a1, a2, .LBB35_2
480 ; CHECK-NEXT: # %bb.1:
481 ; CHECK-NEXT: mv a1, a2
482 ; CHECK-NEXT: .LBB35_2:
483 ; CHECK-NEXT: vsetvli zero, a1, e8, m8, ta, ma
484 ; CHECK-NEXT: vmax.vx v8, v8, a0
486 %elt.head = insertelement <vscale x 128 x i8> poison, i8 %b, i32 0
487 %vb = shufflevector <vscale x 128 x i8> %elt.head, <vscale x 128 x i8> poison, <vscale x 128 x i32> zeroinitializer
488 %head = insertelement <vscale x 128 x i1> poison, i1 true, i32 0
489 %m = shufflevector <vscale x 128 x i1> %head, <vscale x 128 x i1> poison, <vscale x 128 x i32> zeroinitializer
490 %v = call <vscale x 128 x i8> @llvm.vp.smax.nxv128i8(<vscale x 128 x i8> %va, <vscale x 128 x i8> %vb, <vscale x 128 x i1> %m, i32 %evl)
491 ret <vscale x 128 x i8> %v
494 declare <vscale x 1 x i16> @llvm.vp.smax.nxv1i16(<vscale x 1 x i16>, <vscale x 1 x i16>, <vscale x 1 x i1>, i32)
496 define <vscale x 1 x i16> @vmax_vv_nxv1i16(<vscale x 1 x i16> %va, <vscale x 1 x i16> %b, <vscale x 1 x i1> %m, i32 zeroext %evl) {
497 ; CHECK-LABEL: vmax_vv_nxv1i16:
499 ; CHECK-NEXT: vsetvli zero, a0, e16, mf4, ta, ma
500 ; CHECK-NEXT: vmax.vv v8, v8, v9, v0.t
502 %v = call <vscale x 1 x i16> @llvm.vp.smax.nxv1i16(<vscale x 1 x i16> %va, <vscale x 1 x i16> %b, <vscale x 1 x i1> %m, i32 %evl)
503 ret <vscale x 1 x i16> %v
506 define <vscale x 1 x i16> @vmax_vv_nxv1i16_unmasked(<vscale x 1 x i16> %va, <vscale x 1 x i16> %b, i32 zeroext %evl) {
507 ; CHECK-LABEL: vmax_vv_nxv1i16_unmasked:
509 ; CHECK-NEXT: vsetvli zero, a0, e16, mf4, ta, ma
510 ; CHECK-NEXT: vmax.vv v8, v8, v9
512 %head = insertelement <vscale x 1 x i1> poison, i1 true, i32 0
513 %m = shufflevector <vscale x 1 x i1> %head, <vscale x 1 x i1> poison, <vscale x 1 x i32> zeroinitializer
514 %v = call <vscale x 1 x i16> @llvm.vp.smax.nxv1i16(<vscale x 1 x i16> %va, <vscale x 1 x i16> %b, <vscale x 1 x i1> %m, i32 %evl)
515 ret <vscale x 1 x i16> %v
518 define <vscale x 1 x i16> @vmax_vx_nxv1i16(<vscale x 1 x i16> %va, i16 %b, <vscale x 1 x i1> %m, i32 zeroext %evl) {
519 ; CHECK-LABEL: vmax_vx_nxv1i16:
521 ; CHECK-NEXT: vsetvli zero, a1, e16, mf4, ta, ma
522 ; CHECK-NEXT: vmax.vx v8, v8, a0, v0.t
524 %elt.head = insertelement <vscale x 1 x i16> poison, i16 %b, i32 0
525 %vb = shufflevector <vscale x 1 x i16> %elt.head, <vscale x 1 x i16> poison, <vscale x 1 x i32> zeroinitializer
526 %v = call <vscale x 1 x i16> @llvm.vp.smax.nxv1i16(<vscale x 1 x i16> %va, <vscale x 1 x i16> %vb, <vscale x 1 x i1> %m, i32 %evl)
527 ret <vscale x 1 x i16> %v
530 define <vscale x 1 x i16> @vmax_vx_nxv1i16_unmasked(<vscale x 1 x i16> %va, i16 %b, i32 zeroext %evl) {
531 ; CHECK-LABEL: vmax_vx_nxv1i16_unmasked:
533 ; CHECK-NEXT: vsetvli zero, a1, e16, mf4, ta, ma
534 ; CHECK-NEXT: vmax.vx v8, v8, a0
536 %elt.head = insertelement <vscale x 1 x i16> poison, i16 %b, i32 0
537 %vb = shufflevector <vscale x 1 x i16> %elt.head, <vscale x 1 x i16> poison, <vscale x 1 x i32> zeroinitializer
538 %head = insertelement <vscale x 1 x i1> poison, i1 true, i32 0
539 %m = shufflevector <vscale x 1 x i1> %head, <vscale x 1 x i1> poison, <vscale x 1 x i32> zeroinitializer
540 %v = call <vscale x 1 x i16> @llvm.vp.smax.nxv1i16(<vscale x 1 x i16> %va, <vscale x 1 x i16> %vb, <vscale x 1 x i1> %m, i32 %evl)
541 ret <vscale x 1 x i16> %v
544 declare <vscale x 2 x i16> @llvm.vp.smax.nxv2i16(<vscale x 2 x i16>, <vscale x 2 x i16>, <vscale x 2 x i1>, i32)
546 define <vscale x 2 x i16> @vmax_vv_nxv2i16(<vscale x 2 x i16> %va, <vscale x 2 x i16> %b, <vscale x 2 x i1> %m, i32 zeroext %evl) {
547 ; CHECK-LABEL: vmax_vv_nxv2i16:
549 ; CHECK-NEXT: vsetvli zero, a0, e16, mf2, ta, ma
550 ; CHECK-NEXT: vmax.vv v8, v8, v9, v0.t
552 %v = call <vscale x 2 x i16> @llvm.vp.smax.nxv2i16(<vscale x 2 x i16> %va, <vscale x 2 x i16> %b, <vscale x 2 x i1> %m, i32 %evl)
553 ret <vscale x 2 x i16> %v
556 define <vscale x 2 x i16> @vmax_vv_nxv2i16_unmasked(<vscale x 2 x i16> %va, <vscale x 2 x i16> %b, i32 zeroext %evl) {
557 ; CHECK-LABEL: vmax_vv_nxv2i16_unmasked:
559 ; CHECK-NEXT: vsetvli zero, a0, e16, mf2, ta, ma
560 ; CHECK-NEXT: vmax.vv v8, v8, v9
562 %head = insertelement <vscale x 2 x i1> poison, i1 true, i32 0
563 %m = shufflevector <vscale x 2 x i1> %head, <vscale x 2 x i1> poison, <vscale x 2 x i32> zeroinitializer
564 %v = call <vscale x 2 x i16> @llvm.vp.smax.nxv2i16(<vscale x 2 x i16> %va, <vscale x 2 x i16> %b, <vscale x 2 x i1> %m, i32 %evl)
565 ret <vscale x 2 x i16> %v
568 define <vscale x 2 x i16> @vmax_vx_nxv2i16(<vscale x 2 x i16> %va, i16 %b, <vscale x 2 x i1> %m, i32 zeroext %evl) {
569 ; CHECK-LABEL: vmax_vx_nxv2i16:
571 ; CHECK-NEXT: vsetvli zero, a1, e16, mf2, ta, ma
572 ; CHECK-NEXT: vmax.vx v8, v8, a0, v0.t
574 %elt.head = insertelement <vscale x 2 x i16> poison, i16 %b, i32 0
575 %vb = shufflevector <vscale x 2 x i16> %elt.head, <vscale x 2 x i16> poison, <vscale x 2 x i32> zeroinitializer
576 %v = call <vscale x 2 x i16> @llvm.vp.smax.nxv2i16(<vscale x 2 x i16> %va, <vscale x 2 x i16> %vb, <vscale x 2 x i1> %m, i32 %evl)
577 ret <vscale x 2 x i16> %v
580 define <vscale x 2 x i16> @vmax_vx_nxv2i16_unmasked(<vscale x 2 x i16> %va, i16 %b, i32 zeroext %evl) {
581 ; CHECK-LABEL: vmax_vx_nxv2i16_unmasked:
583 ; CHECK-NEXT: vsetvli zero, a1, e16, mf2, ta, ma
584 ; CHECK-NEXT: vmax.vx v8, v8, a0
586 %elt.head = insertelement <vscale x 2 x i16> poison, i16 %b, i32 0
587 %vb = shufflevector <vscale x 2 x i16> %elt.head, <vscale x 2 x i16> poison, <vscale x 2 x i32> zeroinitializer
588 %head = insertelement <vscale x 2 x i1> poison, i1 true, i32 0
589 %m = shufflevector <vscale x 2 x i1> %head, <vscale x 2 x i1> poison, <vscale x 2 x i32> zeroinitializer
590 %v = call <vscale x 2 x i16> @llvm.vp.smax.nxv2i16(<vscale x 2 x i16> %va, <vscale x 2 x i16> %vb, <vscale x 2 x i1> %m, i32 %evl)
591 ret <vscale x 2 x i16> %v
594 declare <vscale x 4 x i16> @llvm.vp.smax.nxv4i16(<vscale x 4 x i16>, <vscale x 4 x i16>, <vscale x 4 x i1>, i32)
596 define <vscale x 4 x i16> @vmax_vv_nxv4i16(<vscale x 4 x i16> %va, <vscale x 4 x i16> %b, <vscale x 4 x i1> %m, i32 zeroext %evl) {
597 ; CHECK-LABEL: vmax_vv_nxv4i16:
599 ; CHECK-NEXT: vsetvli zero, a0, e16, m1, ta, ma
600 ; CHECK-NEXT: vmax.vv v8, v8, v9, v0.t
602 %v = call <vscale x 4 x i16> @llvm.vp.smax.nxv4i16(<vscale x 4 x i16> %va, <vscale x 4 x i16> %b, <vscale x 4 x i1> %m, i32 %evl)
603 ret <vscale x 4 x i16> %v
606 define <vscale x 4 x i16> @vmax_vv_nxv4i16_unmasked(<vscale x 4 x i16> %va, <vscale x 4 x i16> %b, i32 zeroext %evl) {
607 ; CHECK-LABEL: vmax_vv_nxv4i16_unmasked:
609 ; CHECK-NEXT: vsetvli zero, a0, e16, m1, ta, ma
610 ; CHECK-NEXT: vmax.vv v8, v8, v9
612 %head = insertelement <vscale x 4 x i1> poison, i1 true, i32 0
613 %m = shufflevector <vscale x 4 x i1> %head, <vscale x 4 x i1> poison, <vscale x 4 x i32> zeroinitializer
614 %v = call <vscale x 4 x i16> @llvm.vp.smax.nxv4i16(<vscale x 4 x i16> %va, <vscale x 4 x i16> %b, <vscale x 4 x i1> %m, i32 %evl)
615 ret <vscale x 4 x i16> %v
618 define <vscale x 4 x i16> @vmax_vx_nxv4i16(<vscale x 4 x i16> %va, i16 %b, <vscale x 4 x i1> %m, i32 zeroext %evl) {
619 ; CHECK-LABEL: vmax_vx_nxv4i16:
621 ; CHECK-NEXT: vsetvli zero, a1, e16, m1, ta, ma
622 ; CHECK-NEXT: vmax.vx v8, v8, a0, v0.t
624 %elt.head = insertelement <vscale x 4 x i16> poison, i16 %b, i32 0
625 %vb = shufflevector <vscale x 4 x i16> %elt.head, <vscale x 4 x i16> poison, <vscale x 4 x i32> zeroinitializer
626 %v = call <vscale x 4 x i16> @llvm.vp.smax.nxv4i16(<vscale x 4 x i16> %va, <vscale x 4 x i16> %vb, <vscale x 4 x i1> %m, i32 %evl)
627 ret <vscale x 4 x i16> %v
630 define <vscale x 4 x i16> @vmax_vx_nxv4i16_unmasked(<vscale x 4 x i16> %va, i16 %b, i32 zeroext %evl) {
631 ; CHECK-LABEL: vmax_vx_nxv4i16_unmasked:
633 ; CHECK-NEXT: vsetvli zero, a1, e16, m1, ta, ma
634 ; CHECK-NEXT: vmax.vx v8, v8, a0
636 %elt.head = insertelement <vscale x 4 x i16> poison, i16 %b, i32 0
637 %vb = shufflevector <vscale x 4 x i16> %elt.head, <vscale x 4 x i16> poison, <vscale x 4 x i32> zeroinitializer
638 %head = insertelement <vscale x 4 x i1> poison, i1 true, i32 0
639 %m = shufflevector <vscale x 4 x i1> %head, <vscale x 4 x i1> poison, <vscale x 4 x i32> zeroinitializer
640 %v = call <vscale x 4 x i16> @llvm.vp.smax.nxv4i16(<vscale x 4 x i16> %va, <vscale x 4 x i16> %vb, <vscale x 4 x i1> %m, i32 %evl)
641 ret <vscale x 4 x i16> %v
644 declare <vscale x 8 x i16> @llvm.vp.smax.nxv8i16(<vscale x 8 x i16>, <vscale x 8 x i16>, <vscale x 8 x i1>, i32)
646 define <vscale x 8 x i16> @vmax_vv_nxv8i16(<vscale x 8 x i16> %va, <vscale x 8 x i16> %b, <vscale x 8 x i1> %m, i32 zeroext %evl) {
647 ; CHECK-LABEL: vmax_vv_nxv8i16:
649 ; CHECK-NEXT: vsetvli zero, a0, e16, m2, ta, ma
650 ; CHECK-NEXT: vmax.vv v8, v8, v10, v0.t
652 %v = call <vscale x 8 x i16> @llvm.vp.smax.nxv8i16(<vscale x 8 x i16> %va, <vscale x 8 x i16> %b, <vscale x 8 x i1> %m, i32 %evl)
653 ret <vscale x 8 x i16> %v
656 define <vscale x 8 x i16> @vmax_vv_nxv8i16_unmasked(<vscale x 8 x i16> %va, <vscale x 8 x i16> %b, i32 zeroext %evl) {
657 ; CHECK-LABEL: vmax_vv_nxv8i16_unmasked:
659 ; CHECK-NEXT: vsetvli zero, a0, e16, m2, ta, ma
660 ; CHECK-NEXT: vmax.vv v8, v8, v10
662 %head = insertelement <vscale x 8 x i1> poison, i1 true, i32 0
663 %m = shufflevector <vscale x 8 x i1> %head, <vscale x 8 x i1> poison, <vscale x 8 x i32> zeroinitializer
664 %v = call <vscale x 8 x i16> @llvm.vp.smax.nxv8i16(<vscale x 8 x i16> %va, <vscale x 8 x i16> %b, <vscale x 8 x i1> %m, i32 %evl)
665 ret <vscale x 8 x i16> %v
668 define <vscale x 8 x i16> @vmax_vx_nxv8i16(<vscale x 8 x i16> %va, i16 %b, <vscale x 8 x i1> %m, i32 zeroext %evl) {
669 ; CHECK-LABEL: vmax_vx_nxv8i16:
671 ; CHECK-NEXT: vsetvli zero, a1, e16, m2, ta, ma
672 ; CHECK-NEXT: vmax.vx v8, v8, a0, v0.t
674 %elt.head = insertelement <vscale x 8 x i16> poison, i16 %b, i32 0
675 %vb = shufflevector <vscale x 8 x i16> %elt.head, <vscale x 8 x i16> poison, <vscale x 8 x i32> zeroinitializer
676 %v = call <vscale x 8 x i16> @llvm.vp.smax.nxv8i16(<vscale x 8 x i16> %va, <vscale x 8 x i16> %vb, <vscale x 8 x i1> %m, i32 %evl)
677 ret <vscale x 8 x i16> %v
680 define <vscale x 8 x i16> @vmax_vx_nxv8i16_unmasked(<vscale x 8 x i16> %va, i16 %b, i32 zeroext %evl) {
681 ; CHECK-LABEL: vmax_vx_nxv8i16_unmasked:
683 ; CHECK-NEXT: vsetvli zero, a1, e16, m2, ta, ma
684 ; CHECK-NEXT: vmax.vx v8, v8, a0
686 %elt.head = insertelement <vscale x 8 x i16> poison, i16 %b, i32 0
687 %vb = shufflevector <vscale x 8 x i16> %elt.head, <vscale x 8 x i16> poison, <vscale x 8 x i32> zeroinitializer
688 %head = insertelement <vscale x 8 x i1> poison, i1 true, i32 0
689 %m = shufflevector <vscale x 8 x i1> %head, <vscale x 8 x i1> poison, <vscale x 8 x i32> zeroinitializer
690 %v = call <vscale x 8 x i16> @llvm.vp.smax.nxv8i16(<vscale x 8 x i16> %va, <vscale x 8 x i16> %vb, <vscale x 8 x i1> %m, i32 %evl)
691 ret <vscale x 8 x i16> %v
694 declare <vscale x 16 x i16> @llvm.vp.smax.nxv16i16(<vscale x 16 x i16>, <vscale x 16 x i16>, <vscale x 16 x i1>, i32)
696 define <vscale x 16 x i16> @vmax_vv_nxv16i16(<vscale x 16 x i16> %va, <vscale x 16 x i16> %b, <vscale x 16 x i1> %m, i32 zeroext %evl) {
697 ; CHECK-LABEL: vmax_vv_nxv16i16:
699 ; CHECK-NEXT: vsetvli zero, a0, e16, m4, ta, ma
700 ; CHECK-NEXT: vmax.vv v8, v8, v12, v0.t
702 %v = call <vscale x 16 x i16> @llvm.vp.smax.nxv16i16(<vscale x 16 x i16> %va, <vscale x 16 x i16> %b, <vscale x 16 x i1> %m, i32 %evl)
703 ret <vscale x 16 x i16> %v
706 define <vscale x 16 x i16> @vmax_vv_nxv16i16_unmasked(<vscale x 16 x i16> %va, <vscale x 16 x i16> %b, i32 zeroext %evl) {
707 ; CHECK-LABEL: vmax_vv_nxv16i16_unmasked:
709 ; CHECK-NEXT: vsetvli zero, a0, e16, m4, ta, ma
710 ; CHECK-NEXT: vmax.vv v8, v8, v12
712 %head = insertelement <vscale x 16 x i1> poison, i1 true, i32 0
713 %m = shufflevector <vscale x 16 x i1> %head, <vscale x 16 x i1> poison, <vscale x 16 x i32> zeroinitializer
714 %v = call <vscale x 16 x i16> @llvm.vp.smax.nxv16i16(<vscale x 16 x i16> %va, <vscale x 16 x i16> %b, <vscale x 16 x i1> %m, i32 %evl)
715 ret <vscale x 16 x i16> %v
718 define <vscale x 16 x i16> @vmax_vx_nxv16i16(<vscale x 16 x i16> %va, i16 %b, <vscale x 16 x i1> %m, i32 zeroext %evl) {
719 ; CHECK-LABEL: vmax_vx_nxv16i16:
721 ; CHECK-NEXT: vsetvli zero, a1, e16, m4, ta, ma
722 ; CHECK-NEXT: vmax.vx v8, v8, a0, v0.t
724 %elt.head = insertelement <vscale x 16 x i16> poison, i16 %b, i32 0
725 %vb = shufflevector <vscale x 16 x i16> %elt.head, <vscale x 16 x i16> poison, <vscale x 16 x i32> zeroinitializer
726 %v = call <vscale x 16 x i16> @llvm.vp.smax.nxv16i16(<vscale x 16 x i16> %va, <vscale x 16 x i16> %vb, <vscale x 16 x i1> %m, i32 %evl)
727 ret <vscale x 16 x i16> %v
730 define <vscale x 16 x i16> @vmax_vx_nxv16i16_unmasked(<vscale x 16 x i16> %va, i16 %b, i32 zeroext %evl) {
731 ; CHECK-LABEL: vmax_vx_nxv16i16_unmasked:
733 ; CHECK-NEXT: vsetvli zero, a1, e16, m4, ta, ma
734 ; CHECK-NEXT: vmax.vx v8, v8, a0
736 %elt.head = insertelement <vscale x 16 x i16> poison, i16 %b, i32 0
737 %vb = shufflevector <vscale x 16 x i16> %elt.head, <vscale x 16 x i16> poison, <vscale x 16 x i32> zeroinitializer
738 %head = insertelement <vscale x 16 x i1> poison, i1 true, i32 0
739 %m = shufflevector <vscale x 16 x i1> %head, <vscale x 16 x i1> poison, <vscale x 16 x i32> zeroinitializer
740 %v = call <vscale x 16 x i16> @llvm.vp.smax.nxv16i16(<vscale x 16 x i16> %va, <vscale x 16 x i16> %vb, <vscale x 16 x i1> %m, i32 %evl)
741 ret <vscale x 16 x i16> %v
744 declare <vscale x 32 x i16> @llvm.vp.smax.nxv32i16(<vscale x 32 x i16>, <vscale x 32 x i16>, <vscale x 32 x i1>, i32)
746 define <vscale x 32 x i16> @vmax_vv_nxv32i16(<vscale x 32 x i16> %va, <vscale x 32 x i16> %b, <vscale x 32 x i1> %m, i32 zeroext %evl) {
747 ; CHECK-LABEL: vmax_vv_nxv32i16:
749 ; CHECK-NEXT: vsetvli zero, a0, e16, m8, ta, ma
750 ; CHECK-NEXT: vmax.vv v8, v8, v16, v0.t
752 %v = call <vscale x 32 x i16> @llvm.vp.smax.nxv32i16(<vscale x 32 x i16> %va, <vscale x 32 x i16> %b, <vscale x 32 x i1> %m, i32 %evl)
753 ret <vscale x 32 x i16> %v
756 define <vscale x 32 x i16> @vmax_vv_nxv32i16_unmasked(<vscale x 32 x i16> %va, <vscale x 32 x i16> %b, i32 zeroext %evl) {
757 ; CHECK-LABEL: vmax_vv_nxv32i16_unmasked:
759 ; CHECK-NEXT: vsetvli zero, a0, e16, m8, ta, ma
760 ; CHECK-NEXT: vmax.vv v8, v8, v16
762 %head = insertelement <vscale x 32 x i1> poison, i1 true, i32 0
763 %m = shufflevector <vscale x 32 x i1> %head, <vscale x 32 x i1> poison, <vscale x 32 x i32> zeroinitializer
764 %v = call <vscale x 32 x i16> @llvm.vp.smax.nxv32i16(<vscale x 32 x i16> %va, <vscale x 32 x i16> %b, <vscale x 32 x i1> %m, i32 %evl)
765 ret <vscale x 32 x i16> %v
768 define <vscale x 32 x i16> @vmax_vx_nxv32i16(<vscale x 32 x i16> %va, i16 %b, <vscale x 32 x i1> %m, i32 zeroext %evl) {
769 ; CHECK-LABEL: vmax_vx_nxv32i16:
771 ; CHECK-NEXT: vsetvli zero, a1, e16, m8, ta, ma
772 ; CHECK-NEXT: vmax.vx v8, v8, a0, v0.t
774 %elt.head = insertelement <vscale x 32 x i16> poison, i16 %b, i32 0
775 %vb = shufflevector <vscale x 32 x i16> %elt.head, <vscale x 32 x i16> poison, <vscale x 32 x i32> zeroinitializer
776 %v = call <vscale x 32 x i16> @llvm.vp.smax.nxv32i16(<vscale x 32 x i16> %va, <vscale x 32 x i16> %vb, <vscale x 32 x i1> %m, i32 %evl)
777 ret <vscale x 32 x i16> %v
780 define <vscale x 32 x i16> @vmax_vx_nxv32i16_unmasked(<vscale x 32 x i16> %va, i16 %b, i32 zeroext %evl) {
781 ; CHECK-LABEL: vmax_vx_nxv32i16_unmasked:
783 ; CHECK-NEXT: vsetvli zero, a1, e16, m8, ta, ma
784 ; CHECK-NEXT: vmax.vx v8, v8, a0
786 %elt.head = insertelement <vscale x 32 x i16> poison, i16 %b, i32 0
787 %vb = shufflevector <vscale x 32 x i16> %elt.head, <vscale x 32 x i16> poison, <vscale x 32 x i32> zeroinitializer
788 %head = insertelement <vscale x 32 x i1> poison, i1 true, i32 0
789 %m = shufflevector <vscale x 32 x i1> %head, <vscale x 32 x i1> poison, <vscale x 32 x i32> zeroinitializer
790 %v = call <vscale x 32 x i16> @llvm.vp.smax.nxv32i16(<vscale x 32 x i16> %va, <vscale x 32 x i16> %vb, <vscale x 32 x i1> %m, i32 %evl)
791 ret <vscale x 32 x i16> %v
794 declare <vscale x 1 x i32> @llvm.vp.smax.nxv1i32(<vscale x 1 x i32>, <vscale x 1 x i32>, <vscale x 1 x i1>, i32)
796 define <vscale x 1 x i32> @vmax_vv_nxv1i32(<vscale x 1 x i32> %va, <vscale x 1 x i32> %b, <vscale x 1 x i1> %m, i32 zeroext %evl) {
797 ; CHECK-LABEL: vmax_vv_nxv1i32:
799 ; CHECK-NEXT: vsetvli zero, a0, e32, mf2, ta, ma
800 ; CHECK-NEXT: vmax.vv v8, v8, v9, v0.t
802 %v = call <vscale x 1 x i32> @llvm.vp.smax.nxv1i32(<vscale x 1 x i32> %va, <vscale x 1 x i32> %b, <vscale x 1 x i1> %m, i32 %evl)
803 ret <vscale x 1 x i32> %v
806 define <vscale x 1 x i32> @vmax_vv_nxv1i32_unmasked(<vscale x 1 x i32> %va, <vscale x 1 x i32> %b, i32 zeroext %evl) {
807 ; CHECK-LABEL: vmax_vv_nxv1i32_unmasked:
809 ; CHECK-NEXT: vsetvli zero, a0, e32, mf2, ta, ma
810 ; CHECK-NEXT: vmax.vv v8, v8, v9
812 %head = insertelement <vscale x 1 x i1> poison, i1 true, i32 0
813 %m = shufflevector <vscale x 1 x i1> %head, <vscale x 1 x i1> poison, <vscale x 1 x i32> zeroinitializer
814 %v = call <vscale x 1 x i32> @llvm.vp.smax.nxv1i32(<vscale x 1 x i32> %va, <vscale x 1 x i32> %b, <vscale x 1 x i1> %m, i32 %evl)
815 ret <vscale x 1 x i32> %v
818 define <vscale x 1 x i32> @vmax_vx_nxv1i32(<vscale x 1 x i32> %va, i32 %b, <vscale x 1 x i1> %m, i32 zeroext %evl) {
819 ; CHECK-LABEL: vmax_vx_nxv1i32:
821 ; CHECK-NEXT: vsetvli zero, a1, e32, mf2, ta, ma
822 ; CHECK-NEXT: vmax.vx v8, v8, a0, v0.t
824 %elt.head = insertelement <vscale x 1 x i32> poison, i32 %b, i32 0
825 %vb = shufflevector <vscale x 1 x i32> %elt.head, <vscale x 1 x i32> poison, <vscale x 1 x i32> zeroinitializer
826 %v = call <vscale x 1 x i32> @llvm.vp.smax.nxv1i32(<vscale x 1 x i32> %va, <vscale x 1 x i32> %vb, <vscale x 1 x i1> %m, i32 %evl)
827 ret <vscale x 1 x i32> %v
830 define <vscale x 1 x i32> @vmax_vx_nxv1i32_unmasked(<vscale x 1 x i32> %va, i32 %b, i32 zeroext %evl) {
831 ; CHECK-LABEL: vmax_vx_nxv1i32_unmasked:
833 ; CHECK-NEXT: vsetvli zero, a1, e32, mf2, ta, ma
834 ; CHECK-NEXT: vmax.vx v8, v8, a0
836 %elt.head = insertelement <vscale x 1 x i32> poison, i32 %b, i32 0
837 %vb = shufflevector <vscale x 1 x i32> %elt.head, <vscale x 1 x i32> poison, <vscale x 1 x i32> zeroinitializer
838 %head = insertelement <vscale x 1 x i1> poison, i1 true, i32 0
839 %m = shufflevector <vscale x 1 x i1> %head, <vscale x 1 x i1> poison, <vscale x 1 x i32> zeroinitializer
840 %v = call <vscale x 1 x i32> @llvm.vp.smax.nxv1i32(<vscale x 1 x i32> %va, <vscale x 1 x i32> %vb, <vscale x 1 x i1> %m, i32 %evl)
841 ret <vscale x 1 x i32> %v
844 declare <vscale x 2 x i32> @llvm.vp.smax.nxv2i32(<vscale x 2 x i32>, <vscale x 2 x i32>, <vscale x 2 x i1>, i32)
846 define <vscale x 2 x i32> @vmax_vv_nxv2i32(<vscale x 2 x i32> %va, <vscale x 2 x i32> %b, <vscale x 2 x i1> %m, i32 zeroext %evl) {
847 ; CHECK-LABEL: vmax_vv_nxv2i32:
849 ; CHECK-NEXT: vsetvli zero, a0, e32, m1, ta, ma
850 ; CHECK-NEXT: vmax.vv v8, v8, v9, v0.t
852 %v = call <vscale x 2 x i32> @llvm.vp.smax.nxv2i32(<vscale x 2 x i32> %va, <vscale x 2 x i32> %b, <vscale x 2 x i1> %m, i32 %evl)
853 ret <vscale x 2 x i32> %v
856 define <vscale x 2 x i32> @vmax_vv_nxv2i32_unmasked(<vscale x 2 x i32> %va, <vscale x 2 x i32> %b, i32 zeroext %evl) {
857 ; CHECK-LABEL: vmax_vv_nxv2i32_unmasked:
859 ; CHECK-NEXT: vsetvli zero, a0, e32, m1, ta, ma
860 ; CHECK-NEXT: vmax.vv v8, v8, v9
862 %head = insertelement <vscale x 2 x i1> poison, i1 true, i32 0
863 %m = shufflevector <vscale x 2 x i1> %head, <vscale x 2 x i1> poison, <vscale x 2 x i32> zeroinitializer
864 %v = call <vscale x 2 x i32> @llvm.vp.smax.nxv2i32(<vscale x 2 x i32> %va, <vscale x 2 x i32> %b, <vscale x 2 x i1> %m, i32 %evl)
865 ret <vscale x 2 x i32> %v
868 define <vscale x 2 x i32> @vmax_vx_nxv2i32(<vscale x 2 x i32> %va, i32 %b, <vscale x 2 x i1> %m, i32 zeroext %evl) {
869 ; CHECK-LABEL: vmax_vx_nxv2i32:
871 ; CHECK-NEXT: vsetvli zero, a1, e32, m1, ta, ma
872 ; CHECK-NEXT: vmax.vx v8, v8, a0, v0.t
874 %elt.head = insertelement <vscale x 2 x i32> poison, i32 %b, i32 0
875 %vb = shufflevector <vscale x 2 x i32> %elt.head, <vscale x 2 x i32> poison, <vscale x 2 x i32> zeroinitializer
876 %v = call <vscale x 2 x i32> @llvm.vp.smax.nxv2i32(<vscale x 2 x i32> %va, <vscale x 2 x i32> %vb, <vscale x 2 x i1> %m, i32 %evl)
877 ret <vscale x 2 x i32> %v
880 define <vscale x 2 x i32> @vmax_vx_nxv2i32_unmasked(<vscale x 2 x i32> %va, i32 %b, i32 zeroext %evl) {
881 ; CHECK-LABEL: vmax_vx_nxv2i32_unmasked:
883 ; CHECK-NEXT: vsetvli zero, a1, e32, m1, ta, ma
884 ; CHECK-NEXT: vmax.vx v8, v8, a0
886 %elt.head = insertelement <vscale x 2 x i32> poison, i32 %b, i32 0
887 %vb = shufflevector <vscale x 2 x i32> %elt.head, <vscale x 2 x i32> poison, <vscale x 2 x i32> zeroinitializer
888 %head = insertelement <vscale x 2 x i1> poison, i1 true, i32 0
889 %m = shufflevector <vscale x 2 x i1> %head, <vscale x 2 x i1> poison, <vscale x 2 x i32> zeroinitializer
890 %v = call <vscale x 2 x i32> @llvm.vp.smax.nxv2i32(<vscale x 2 x i32> %va, <vscale x 2 x i32> %vb, <vscale x 2 x i1> %m, i32 %evl)
891 ret <vscale x 2 x i32> %v
894 declare <vscale x 4 x i32> @llvm.vp.smax.nxv4i32(<vscale x 4 x i32>, <vscale x 4 x i32>, <vscale x 4 x i1>, i32)
896 define <vscale x 4 x i32> @vmax_vv_nxv4i32(<vscale x 4 x i32> %va, <vscale x 4 x i32> %b, <vscale x 4 x i1> %m, i32 zeroext %evl) {
897 ; CHECK-LABEL: vmax_vv_nxv4i32:
899 ; CHECK-NEXT: vsetvli zero, a0, e32, m2, ta, ma
900 ; CHECK-NEXT: vmax.vv v8, v8, v10, v0.t
902 %v = call <vscale x 4 x i32> @llvm.vp.smax.nxv4i32(<vscale x 4 x i32> %va, <vscale x 4 x i32> %b, <vscale x 4 x i1> %m, i32 %evl)
903 ret <vscale x 4 x i32> %v
906 define <vscale x 4 x i32> @vmax_vv_nxv4i32_unmasked(<vscale x 4 x i32> %va, <vscale x 4 x i32> %b, i32 zeroext %evl) {
907 ; CHECK-LABEL: vmax_vv_nxv4i32_unmasked:
909 ; CHECK-NEXT: vsetvli zero, a0, e32, m2, ta, ma
910 ; CHECK-NEXT: vmax.vv v8, v8, v10
912 %head = insertelement <vscale x 4 x i1> poison, i1 true, i32 0
913 %m = shufflevector <vscale x 4 x i1> %head, <vscale x 4 x i1> poison, <vscale x 4 x i32> zeroinitializer
914 %v = call <vscale x 4 x i32> @llvm.vp.smax.nxv4i32(<vscale x 4 x i32> %va, <vscale x 4 x i32> %b, <vscale x 4 x i1> %m, i32 %evl)
915 ret <vscale x 4 x i32> %v
918 define <vscale x 4 x i32> @vmax_vx_nxv4i32(<vscale x 4 x i32> %va, i32 %b, <vscale x 4 x i1> %m, i32 zeroext %evl) {
919 ; CHECK-LABEL: vmax_vx_nxv4i32:
921 ; CHECK-NEXT: vsetvli zero, a1, e32, m2, ta, ma
922 ; CHECK-NEXT: vmax.vx v8, v8, a0, v0.t
924 %elt.head = insertelement <vscale x 4 x i32> poison, i32 %b, i32 0
925 %vb = shufflevector <vscale x 4 x i32> %elt.head, <vscale x 4 x i32> poison, <vscale x 4 x i32> zeroinitializer
926 %v = call <vscale x 4 x i32> @llvm.vp.smax.nxv4i32(<vscale x 4 x i32> %va, <vscale x 4 x i32> %vb, <vscale x 4 x i1> %m, i32 %evl)
927 ret <vscale x 4 x i32> %v
930 define <vscale x 4 x i32> @vmax_vx_nxv4i32_unmasked(<vscale x 4 x i32> %va, i32 %b, i32 zeroext %evl) {
931 ; CHECK-LABEL: vmax_vx_nxv4i32_unmasked:
933 ; CHECK-NEXT: vsetvli zero, a1, e32, m2, ta, ma
934 ; CHECK-NEXT: vmax.vx v8, v8, a0
936 %elt.head = insertelement <vscale x 4 x i32> poison, i32 %b, i32 0
937 %vb = shufflevector <vscale x 4 x i32> %elt.head, <vscale x 4 x i32> poison, <vscale x 4 x i32> zeroinitializer
938 %head = insertelement <vscale x 4 x i1> poison, i1 true, i32 0
939 %m = shufflevector <vscale x 4 x i1> %head, <vscale x 4 x i1> poison, <vscale x 4 x i32> zeroinitializer
940 %v = call <vscale x 4 x i32> @llvm.vp.smax.nxv4i32(<vscale x 4 x i32> %va, <vscale x 4 x i32> %vb, <vscale x 4 x i1> %m, i32 %evl)
941 ret <vscale x 4 x i32> %v
944 declare <vscale x 8 x i32> @llvm.vp.smax.nxv8i32(<vscale x 8 x i32>, <vscale x 8 x i32>, <vscale x 8 x i1>, i32)
946 define <vscale x 8 x i32> @vmax_vv_nxv8i32(<vscale x 8 x i32> %va, <vscale x 8 x i32> %b, <vscale x 8 x i1> %m, i32 zeroext %evl) {
947 ; CHECK-LABEL: vmax_vv_nxv8i32:
949 ; CHECK-NEXT: vsetvli zero, a0, e32, m4, ta, ma
950 ; CHECK-NEXT: vmax.vv v8, v8, v12, v0.t
952 %v = call <vscale x 8 x i32> @llvm.vp.smax.nxv8i32(<vscale x 8 x i32> %va, <vscale x 8 x i32> %b, <vscale x 8 x i1> %m, i32 %evl)
953 ret <vscale x 8 x i32> %v
956 define <vscale x 8 x i32> @vmax_vv_nxv8i32_unmasked(<vscale x 8 x i32> %va, <vscale x 8 x i32> %b, i32 zeroext %evl) {
957 ; CHECK-LABEL: vmax_vv_nxv8i32_unmasked:
959 ; CHECK-NEXT: vsetvli zero, a0, e32, m4, ta, ma
960 ; CHECK-NEXT: vmax.vv v8, v8, v12
962 %head = insertelement <vscale x 8 x i1> poison, i1 true, i32 0
963 %m = shufflevector <vscale x 8 x i1> %head, <vscale x 8 x i1> poison, <vscale x 8 x i32> zeroinitializer
964 %v = call <vscale x 8 x i32> @llvm.vp.smax.nxv8i32(<vscale x 8 x i32> %va, <vscale x 8 x i32> %b, <vscale x 8 x i1> %m, i32 %evl)
965 ret <vscale x 8 x i32> %v
968 define <vscale x 8 x i32> @vmax_vx_nxv8i32(<vscale x 8 x i32> %va, i32 %b, <vscale x 8 x i1> %m, i32 zeroext %evl) {
969 ; CHECK-LABEL: vmax_vx_nxv8i32:
971 ; CHECK-NEXT: vsetvli zero, a1, e32, m4, ta, ma
972 ; CHECK-NEXT: vmax.vx v8, v8, a0, v0.t
974 %elt.head = insertelement <vscale x 8 x i32> poison, i32 %b, i32 0
975 %vb = shufflevector <vscale x 8 x i32> %elt.head, <vscale x 8 x i32> poison, <vscale x 8 x i32> zeroinitializer
976 %v = call <vscale x 8 x i32> @llvm.vp.smax.nxv8i32(<vscale x 8 x i32> %va, <vscale x 8 x i32> %vb, <vscale x 8 x i1> %m, i32 %evl)
977 ret <vscale x 8 x i32> %v
980 define <vscale x 8 x i32> @vmax_vx_nxv8i32_unmasked(<vscale x 8 x i32> %va, i32 %b, i32 zeroext %evl) {
981 ; CHECK-LABEL: vmax_vx_nxv8i32_unmasked:
983 ; CHECK-NEXT: vsetvli zero, a1, e32, m4, ta, ma
984 ; CHECK-NEXT: vmax.vx v8, v8, a0
986 %elt.head = insertelement <vscale x 8 x i32> poison, i32 %b, i32 0
987 %vb = shufflevector <vscale x 8 x i32> %elt.head, <vscale x 8 x i32> poison, <vscale x 8 x i32> zeroinitializer
988 %head = insertelement <vscale x 8 x i1> poison, i1 true, i32 0
989 %m = shufflevector <vscale x 8 x i1> %head, <vscale x 8 x i1> poison, <vscale x 8 x i32> zeroinitializer
990 %v = call <vscale x 8 x i32> @llvm.vp.smax.nxv8i32(<vscale x 8 x i32> %va, <vscale x 8 x i32> %vb, <vscale x 8 x i1> %m, i32 %evl)
991 ret <vscale x 8 x i32> %v
994 declare <vscale x 16 x i32> @llvm.vp.smax.nxv16i32(<vscale x 16 x i32>, <vscale x 16 x i32>, <vscale x 16 x i1>, i32)
996 define <vscale x 16 x i32> @vmax_vv_nxv16i32(<vscale x 16 x i32> %va, <vscale x 16 x i32> %b, <vscale x 16 x i1> %m, i32 zeroext %evl) {
997 ; CHECK-LABEL: vmax_vv_nxv16i32:
999 ; CHECK-NEXT: vsetvli zero, a0, e32, m8, ta, ma
1000 ; CHECK-NEXT: vmax.vv v8, v8, v16, v0.t
1002 %v = call <vscale x 16 x i32> @llvm.vp.smax.nxv16i32(<vscale x 16 x i32> %va, <vscale x 16 x i32> %b, <vscale x 16 x i1> %m, i32 %evl)
1003 ret <vscale x 16 x i32> %v
1006 define <vscale x 16 x i32> @vmax_vv_nxv16i32_unmasked(<vscale x 16 x i32> %va, <vscale x 16 x i32> %b, i32 zeroext %evl) {
1007 ; CHECK-LABEL: vmax_vv_nxv16i32_unmasked:
1009 ; CHECK-NEXT: vsetvli zero, a0, e32, m8, ta, ma
1010 ; CHECK-NEXT: vmax.vv v8, v8, v16
1012 %head = insertelement <vscale x 16 x i1> poison, i1 true, i32 0
1013 %m = shufflevector <vscale x 16 x i1> %head, <vscale x 16 x i1> poison, <vscale x 16 x i32> zeroinitializer
1014 %v = call <vscale x 16 x i32> @llvm.vp.smax.nxv16i32(<vscale x 16 x i32> %va, <vscale x 16 x i32> %b, <vscale x 16 x i1> %m, i32 %evl)
1015 ret <vscale x 16 x i32> %v
1018 define <vscale x 16 x i32> @vmax_vx_nxv16i32(<vscale x 16 x i32> %va, i32 %b, <vscale x 16 x i1> %m, i32 zeroext %evl) {
1019 ; CHECK-LABEL: vmax_vx_nxv16i32:
1021 ; CHECK-NEXT: vsetvli zero, a1, e32, m8, ta, ma
1022 ; CHECK-NEXT: vmax.vx v8, v8, a0, v0.t
1024 %elt.head = insertelement <vscale x 16 x i32> poison, i32 %b, i32 0
1025 %vb = shufflevector <vscale x 16 x i32> %elt.head, <vscale x 16 x i32> poison, <vscale x 16 x i32> zeroinitializer
1026 %v = call <vscale x 16 x i32> @llvm.vp.smax.nxv16i32(<vscale x 16 x i32> %va, <vscale x 16 x i32> %vb, <vscale x 16 x i1> %m, i32 %evl)
1027 ret <vscale x 16 x i32> %v
1030 define <vscale x 16 x i32> @vmax_vx_nxv16i32_unmasked(<vscale x 16 x i32> %va, i32 %b, i32 zeroext %evl) {
1031 ; CHECK-LABEL: vmax_vx_nxv16i32_unmasked:
1033 ; CHECK-NEXT: vsetvli zero, a1, e32, m8, ta, ma
1034 ; CHECK-NEXT: vmax.vx v8, v8, a0
1036 %elt.head = insertelement <vscale x 16 x i32> poison, i32 %b, i32 0
1037 %vb = shufflevector <vscale x 16 x i32> %elt.head, <vscale x 16 x i32> poison, <vscale x 16 x i32> zeroinitializer
1038 %head = insertelement <vscale x 16 x i1> poison, i1 true, i32 0
1039 %m = shufflevector <vscale x 16 x i1> %head, <vscale x 16 x i1> poison, <vscale x 16 x i32> zeroinitializer
1040 %v = call <vscale x 16 x i32> @llvm.vp.smax.nxv16i32(<vscale x 16 x i32> %va, <vscale x 16 x i32> %vb, <vscale x 16 x i1> %m, i32 %evl)
1041 ret <vscale x 16 x i32> %v
1044 ; Test that split-legalization works then the mask needs manual splitting.
1046 declare <vscale x 32 x i32> @llvm.vp.smax.nxv32i32(<vscale x 32 x i32>, <vscale x 32 x i32>, <vscale x 32 x i1>, i32)
1048 define <vscale x 32 x i32> @vmax_vx_nxv32i32(<vscale x 32 x i32> %va, i32 %b, <vscale x 32 x i1> %m, i32 zeroext %evl) {
1049 ; CHECK-LABEL: vmax_vx_nxv32i32:
1051 ; CHECK-NEXT: vmv1r.v v24, v0
1052 ; CHECK-NEXT: csrr a2, vlenb
1053 ; CHECK-NEXT: srli a3, a2, 2
1054 ; CHECK-NEXT: vsetvli a4, zero, e8, mf2, ta, ma
1055 ; CHECK-NEXT: vslidedown.vx v0, v0, a3
1056 ; CHECK-NEXT: slli a2, a2, 1
1057 ; CHECK-NEXT: sub a3, a1, a2
1058 ; CHECK-NEXT: sltu a4, a1, a3
1059 ; CHECK-NEXT: addi a4, a4, -1
1060 ; CHECK-NEXT: and a3, a4, a3
1061 ; CHECK-NEXT: vsetvli zero, a3, e32, m8, ta, ma
1062 ; CHECK-NEXT: vmax.vx v16, v16, a0, v0.t
1063 ; CHECK-NEXT: bltu a1, a2, .LBB80_2
1064 ; CHECK-NEXT: # %bb.1:
1065 ; CHECK-NEXT: mv a1, a2
1066 ; CHECK-NEXT: .LBB80_2:
1067 ; CHECK-NEXT: vsetvli zero, a1, e32, m8, ta, ma
1068 ; CHECK-NEXT: vmv1r.v v0, v24
1069 ; CHECK-NEXT: vmax.vx v8, v8, a0, v0.t
1071 %elt.head = insertelement <vscale x 32 x i32> poison, i32 %b, i32 0
1072 %vb = shufflevector <vscale x 32 x i32> %elt.head, <vscale x 32 x i32> poison, <vscale x 32 x i32> zeroinitializer
1073 %v = call <vscale x 32 x i32> @llvm.vp.smax.nxv32i32(<vscale x 32 x i32> %va, <vscale x 32 x i32> %vb, <vscale x 32 x i1> %m, i32 %evl)
1074 ret <vscale x 32 x i32> %v
1077 define <vscale x 32 x i32> @vmax_vx_nxv32i32_unmasked(<vscale x 32 x i32> %va, i32 %b, i32 zeroext %evl) {
1078 ; CHECK-LABEL: vmax_vx_nxv32i32_unmasked:
1080 ; CHECK-NEXT: csrr a2, vlenb
1081 ; CHECK-NEXT: slli a2, a2, 1
1082 ; CHECK-NEXT: sub a3, a1, a2
1083 ; CHECK-NEXT: sltu a4, a1, a3
1084 ; CHECK-NEXT: addi a4, a4, -1
1085 ; CHECK-NEXT: and a3, a4, a3
1086 ; CHECK-NEXT: vsetvli zero, a3, e32, m8, ta, ma
1087 ; CHECK-NEXT: vmax.vx v16, v16, a0
1088 ; CHECK-NEXT: bltu a1, a2, .LBB81_2
1089 ; CHECK-NEXT: # %bb.1:
1090 ; CHECK-NEXT: mv a1, a2
1091 ; CHECK-NEXT: .LBB81_2:
1092 ; CHECK-NEXT: vsetvli zero, a1, e32, m8, ta, ma
1093 ; CHECK-NEXT: vmax.vx v8, v8, a0
1095 %elt.head = insertelement <vscale x 32 x i32> poison, i32 %b, i32 0
1096 %vb = shufflevector <vscale x 32 x i32> %elt.head, <vscale x 32 x i32> poison, <vscale x 32 x i32> zeroinitializer
1097 %head = insertelement <vscale x 32 x i1> poison, i1 true, i32 0
1098 %m = shufflevector <vscale x 32 x i1> %head, <vscale x 32 x i1> poison, <vscale x 32 x i32> zeroinitializer
1099 %v = call <vscale x 32 x i32> @llvm.vp.smax.nxv32i32(<vscale x 32 x i32> %va, <vscale x 32 x i32> %vb, <vscale x 32 x i1> %m, i32 %evl)
1100 ret <vscale x 32 x i32> %v
1103 ; Test splitting when the %evl is a constant (albeit an unknown one).
1105 declare i32 @llvm.vscale.i32()
1107 ; FIXME: The upper half of the operation is doing nothing.
1108 ; FIXME: The branches comparing vscale vs. vscale should be constant-foldable.
1110 define <vscale x 32 x i32> @vmax_vx_nxv32i32_evl_nx8(<vscale x 32 x i32> %va, i32 %b, <vscale x 32 x i1> %m) {
1111 ; CHECK-LABEL: vmax_vx_nxv32i32_evl_nx8:
1113 ; CHECK-NEXT: vmv1r.v v24, v0
1114 ; CHECK-NEXT: csrr a1, vlenb
1115 ; CHECK-NEXT: srli a2, a1, 2
1116 ; CHECK-NEXT: vsetvli a3, zero, e8, mf2, ta, ma
1117 ; CHECK-NEXT: vslidedown.vx v0, v0, a2
1118 ; CHECK-NEXT: slli a2, a1, 1
1119 ; CHECK-NEXT: sub a3, a1, a2
1120 ; CHECK-NEXT: sltu a4, a1, a3
1121 ; CHECK-NEXT: addi a4, a4, -1
1122 ; CHECK-NEXT: and a3, a4, a3
1123 ; CHECK-NEXT: vsetvli zero, a3, e32, m8, ta, ma
1124 ; CHECK-NEXT: vmax.vx v16, v16, a0, v0.t
1125 ; CHECK-NEXT: bltu a1, a2, .LBB82_2
1126 ; CHECK-NEXT: # %bb.1:
1127 ; CHECK-NEXT: mv a1, a2
1128 ; CHECK-NEXT: .LBB82_2:
1129 ; CHECK-NEXT: vsetvli zero, a1, e32, m8, ta, ma
1130 ; CHECK-NEXT: vmv1r.v v0, v24
1131 ; CHECK-NEXT: vmax.vx v8, v8, a0, v0.t
1133 %elt.head = insertelement <vscale x 32 x i32> poison, i32 %b, i32 0
1134 %vb = shufflevector <vscale x 32 x i32> %elt.head, <vscale x 32 x i32> poison, <vscale x 32 x i32> zeroinitializer
1135 %evl = call i32 @llvm.vscale.i32()
1136 %evl0 = mul i32 %evl, 8
1137 %v = call <vscale x 32 x i32> @llvm.vp.smax.nxv32i32(<vscale x 32 x i32> %va, <vscale x 32 x i32> %vb, <vscale x 32 x i1> %m, i32 %evl0)
1138 ret <vscale x 32 x i32> %v
1141 ; FIXME: The first vmax.vx should be able to infer that its AVL is equivalent to VLMAX.
1142 ; FIXME: The upper half of the operation is doing nothing but we don't catch
1143 ; that on RV64; we issue a usubsat(and (vscale x 16), 0xffffffff, vscale x 16)
1144 ; (the "original" %evl is the "and", due to known-bits issues with legalizing
1145 ; the i32 %evl to i64) and this isn't detected as 0.
1146 ; This could be resolved in the future with more detailed KnownBits analysis
1149 define <vscale x 32 x i32> @vmax_vx_nxv32i32_evl_nx16(<vscale x 32 x i32> %va, i32 %b, <vscale x 32 x i1> %m) {
1150 ; RV32-LABEL: vmax_vx_nxv32i32_evl_nx16:
1152 ; RV32-NEXT: csrr a1, vlenb
1153 ; RV32-NEXT: slli a1, a1, 1
1154 ; RV32-NEXT: vsetvli zero, a1, e32, m8, ta, ma
1155 ; RV32-NEXT: vmax.vx v8, v8, a0, v0.t
1158 ; RV64-LABEL: vmax_vx_nxv32i32_evl_nx16:
1160 ; RV64-NEXT: csrr a1, vlenb
1161 ; RV64-NEXT: srli a2, a1, 2
1162 ; RV64-NEXT: vsetvli a3, zero, e8, mf2, ta, ma
1163 ; RV64-NEXT: vslidedown.vx v24, v0, a2
1164 ; RV64-NEXT: slli a1, a1, 1
1165 ; RV64-NEXT: vsetvli zero, a1, e32, m8, ta, ma
1166 ; RV64-NEXT: vmax.vx v8, v8, a0, v0.t
1167 ; RV64-NEXT: vsetivli zero, 0, e32, m8, ta, ma
1168 ; RV64-NEXT: vmv1r.v v0, v24
1169 ; RV64-NEXT: vmax.vx v16, v16, a0, v0.t
1171 %elt.head = insertelement <vscale x 32 x i32> poison, i32 %b, i32 0
1172 %vb = shufflevector <vscale x 32 x i32> %elt.head, <vscale x 32 x i32> poison, <vscale x 32 x i32> zeroinitializer
1173 %evl = call i32 @llvm.vscale.i32()
1174 %evl0 = mul i32 %evl, 16
1175 %v = call <vscale x 32 x i32> @llvm.vp.smax.nxv32i32(<vscale x 32 x i32> %va, <vscale x 32 x i32> %vb, <vscale x 32 x i1> %m, i32 %evl0)
1176 ret <vscale x 32 x i32> %v
1179 declare <vscale x 1 x i64> @llvm.vp.smax.nxv1i64(<vscale x 1 x i64>, <vscale x 1 x i64>, <vscale x 1 x i1>, i32)
1181 define <vscale x 1 x i64> @vmax_vv_nxv1i64(<vscale x 1 x i64> %va, <vscale x 1 x i64> %b, <vscale x 1 x i1> %m, i32 zeroext %evl) {
1182 ; CHECK-LABEL: vmax_vv_nxv1i64:
1184 ; CHECK-NEXT: vsetvli zero, a0, e64, m1, ta, ma
1185 ; CHECK-NEXT: vmax.vv v8, v8, v9, v0.t
1187 %v = call <vscale x 1 x i64> @llvm.vp.smax.nxv1i64(<vscale x 1 x i64> %va, <vscale x 1 x i64> %b, <vscale x 1 x i1> %m, i32 %evl)
1188 ret <vscale x 1 x i64> %v
1191 define <vscale x 1 x i64> @vmax_vv_nxv1i64_unmasked(<vscale x 1 x i64> %va, <vscale x 1 x i64> %b, i32 zeroext %evl) {
1192 ; CHECK-LABEL: vmax_vv_nxv1i64_unmasked:
1194 ; CHECK-NEXT: vsetvli zero, a0, e64, m1, ta, ma
1195 ; CHECK-NEXT: vmax.vv v8, v8, v9
1197 %head = insertelement <vscale x 1 x i1> poison, i1 true, i32 0
1198 %m = shufflevector <vscale x 1 x i1> %head, <vscale x 1 x i1> poison, <vscale x 1 x i32> zeroinitializer
1199 %v = call <vscale x 1 x i64> @llvm.vp.smax.nxv1i64(<vscale x 1 x i64> %va, <vscale x 1 x i64> %b, <vscale x 1 x i1> %m, i32 %evl)
1200 ret <vscale x 1 x i64> %v
1203 define <vscale x 1 x i64> @vmax_vx_nxv1i64(<vscale x 1 x i64> %va, i64 %b, <vscale x 1 x i1> %m, i32 zeroext %evl) {
1204 ; RV32-LABEL: vmax_vx_nxv1i64:
1206 ; RV32-NEXT: addi sp, sp, -16
1207 ; RV32-NEXT: .cfi_def_cfa_offset 16
1208 ; RV32-NEXT: sw a1, 12(sp)
1209 ; RV32-NEXT: sw a0, 8(sp)
1210 ; RV32-NEXT: addi a0, sp, 8
1211 ; RV32-NEXT: vsetvli a1, zero, e64, m1, ta, ma
1212 ; RV32-NEXT: vlse64.v v9, (a0), zero
1213 ; RV32-NEXT: vsetvli zero, a2, e64, m1, ta, ma
1214 ; RV32-NEXT: vmax.vv v8, v8, v9, v0.t
1215 ; RV32-NEXT: addi sp, sp, 16
1218 ; RV64-LABEL: vmax_vx_nxv1i64:
1220 ; RV64-NEXT: vsetvli zero, a1, e64, m1, ta, ma
1221 ; RV64-NEXT: vmax.vx v8, v8, a0, v0.t
1223 %elt.head = insertelement <vscale x 1 x i64> poison, i64 %b, i32 0
1224 %vb = shufflevector <vscale x 1 x i64> %elt.head, <vscale x 1 x i64> poison, <vscale x 1 x i32> zeroinitializer
1225 %v = call <vscale x 1 x i64> @llvm.vp.smax.nxv1i64(<vscale x 1 x i64> %va, <vscale x 1 x i64> %vb, <vscale x 1 x i1> %m, i32 %evl)
1226 ret <vscale x 1 x i64> %v
1229 define <vscale x 1 x i64> @vmax_vx_nxv1i64_unmasked(<vscale x 1 x i64> %va, i64 %b, i32 zeroext %evl) {
1230 ; RV32-LABEL: vmax_vx_nxv1i64_unmasked:
1232 ; RV32-NEXT: addi sp, sp, -16
1233 ; RV32-NEXT: .cfi_def_cfa_offset 16
1234 ; RV32-NEXT: sw a1, 12(sp)
1235 ; RV32-NEXT: sw a0, 8(sp)
1236 ; RV32-NEXT: addi a0, sp, 8
1237 ; RV32-NEXT: vsetvli a1, zero, e64, m1, ta, ma
1238 ; RV32-NEXT: vlse64.v v9, (a0), zero
1239 ; RV32-NEXT: vsetvli zero, a2, e64, m1, ta, ma
1240 ; RV32-NEXT: vmax.vv v8, v8, v9
1241 ; RV32-NEXT: addi sp, sp, 16
1244 ; RV64-LABEL: vmax_vx_nxv1i64_unmasked:
1246 ; RV64-NEXT: vsetvli zero, a1, e64, m1, ta, ma
1247 ; RV64-NEXT: vmax.vx v8, v8, a0
1249 %elt.head = insertelement <vscale x 1 x i64> poison, i64 %b, i32 0
1250 %vb = shufflevector <vscale x 1 x i64> %elt.head, <vscale x 1 x i64> poison, <vscale x 1 x i32> zeroinitializer
1251 %head = insertelement <vscale x 1 x i1> poison, i1 true, i32 0
1252 %m = shufflevector <vscale x 1 x i1> %head, <vscale x 1 x i1> poison, <vscale x 1 x i32> zeroinitializer
1253 %v = call <vscale x 1 x i64> @llvm.vp.smax.nxv1i64(<vscale x 1 x i64> %va, <vscale x 1 x i64> %vb, <vscale x 1 x i1> %m, i32 %evl)
1254 ret <vscale x 1 x i64> %v
1257 declare <vscale x 2 x i64> @llvm.vp.smax.nxv2i64(<vscale x 2 x i64>, <vscale x 2 x i64>, <vscale x 2 x i1>, i32)
1259 define <vscale x 2 x i64> @vmax_vv_nxv2i64(<vscale x 2 x i64> %va, <vscale x 2 x i64> %b, <vscale x 2 x i1> %m, i32 zeroext %evl) {
1260 ; CHECK-LABEL: vmax_vv_nxv2i64:
1262 ; CHECK-NEXT: vsetvli zero, a0, e64, m2, ta, ma
1263 ; CHECK-NEXT: vmax.vv v8, v8, v10, v0.t
1265 %v = call <vscale x 2 x i64> @llvm.vp.smax.nxv2i64(<vscale x 2 x i64> %va, <vscale x 2 x i64> %b, <vscale x 2 x i1> %m, i32 %evl)
1266 ret <vscale x 2 x i64> %v
1269 define <vscale x 2 x i64> @vmax_vv_nxv2i64_unmasked(<vscale x 2 x i64> %va, <vscale x 2 x i64> %b, i32 zeroext %evl) {
1270 ; CHECK-LABEL: vmax_vv_nxv2i64_unmasked:
1272 ; CHECK-NEXT: vsetvli zero, a0, e64, m2, ta, ma
1273 ; CHECK-NEXT: vmax.vv v8, v8, v10
1275 %head = insertelement <vscale x 2 x i1> poison, i1 true, i32 0
1276 %m = shufflevector <vscale x 2 x i1> %head, <vscale x 2 x i1> poison, <vscale x 2 x i32> zeroinitializer
1277 %v = call <vscale x 2 x i64> @llvm.vp.smax.nxv2i64(<vscale x 2 x i64> %va, <vscale x 2 x i64> %b, <vscale x 2 x i1> %m, i32 %evl)
1278 ret <vscale x 2 x i64> %v
1281 define <vscale x 2 x i64> @vmax_vx_nxv2i64(<vscale x 2 x i64> %va, i64 %b, <vscale x 2 x i1> %m, i32 zeroext %evl) {
1282 ; RV32-LABEL: vmax_vx_nxv2i64:
1284 ; RV32-NEXT: addi sp, sp, -16
1285 ; RV32-NEXT: .cfi_def_cfa_offset 16
1286 ; RV32-NEXT: sw a1, 12(sp)
1287 ; RV32-NEXT: sw a0, 8(sp)
1288 ; RV32-NEXT: addi a0, sp, 8
1289 ; RV32-NEXT: vsetvli a1, zero, e64, m2, ta, ma
1290 ; RV32-NEXT: vlse64.v v10, (a0), zero
1291 ; RV32-NEXT: vsetvli zero, a2, e64, m2, ta, ma
1292 ; RV32-NEXT: vmax.vv v8, v8, v10, v0.t
1293 ; RV32-NEXT: addi sp, sp, 16
1296 ; RV64-LABEL: vmax_vx_nxv2i64:
1298 ; RV64-NEXT: vsetvli zero, a1, e64, m2, ta, ma
1299 ; RV64-NEXT: vmax.vx v8, v8, a0, v0.t
1301 %elt.head = insertelement <vscale x 2 x i64> poison, i64 %b, i32 0
1302 %vb = shufflevector <vscale x 2 x i64> %elt.head, <vscale x 2 x i64> poison, <vscale x 2 x i32> zeroinitializer
1303 %v = call <vscale x 2 x i64> @llvm.vp.smax.nxv2i64(<vscale x 2 x i64> %va, <vscale x 2 x i64> %vb, <vscale x 2 x i1> %m, i32 %evl)
1304 ret <vscale x 2 x i64> %v
1307 define <vscale x 2 x i64> @vmax_vx_nxv2i64_unmasked(<vscale x 2 x i64> %va, i64 %b, i32 zeroext %evl) {
1308 ; RV32-LABEL: vmax_vx_nxv2i64_unmasked:
1310 ; RV32-NEXT: addi sp, sp, -16
1311 ; RV32-NEXT: .cfi_def_cfa_offset 16
1312 ; RV32-NEXT: sw a1, 12(sp)
1313 ; RV32-NEXT: sw a0, 8(sp)
1314 ; RV32-NEXT: addi a0, sp, 8
1315 ; RV32-NEXT: vsetvli a1, zero, e64, m2, ta, ma
1316 ; RV32-NEXT: vlse64.v v10, (a0), zero
1317 ; RV32-NEXT: vsetvli zero, a2, e64, m2, ta, ma
1318 ; RV32-NEXT: vmax.vv v8, v8, v10
1319 ; RV32-NEXT: addi sp, sp, 16
1322 ; RV64-LABEL: vmax_vx_nxv2i64_unmasked:
1324 ; RV64-NEXT: vsetvli zero, a1, e64, m2, ta, ma
1325 ; RV64-NEXT: vmax.vx v8, v8, a0
1327 %elt.head = insertelement <vscale x 2 x i64> poison, i64 %b, i32 0
1328 %vb = shufflevector <vscale x 2 x i64> %elt.head, <vscale x 2 x i64> poison, <vscale x 2 x i32> zeroinitializer
1329 %head = insertelement <vscale x 2 x i1> poison, i1 true, i32 0
1330 %m = shufflevector <vscale x 2 x i1> %head, <vscale x 2 x i1> poison, <vscale x 2 x i32> zeroinitializer
1331 %v = call <vscale x 2 x i64> @llvm.vp.smax.nxv2i64(<vscale x 2 x i64> %va, <vscale x 2 x i64> %vb, <vscale x 2 x i1> %m, i32 %evl)
1332 ret <vscale x 2 x i64> %v
1335 declare <vscale x 4 x i64> @llvm.vp.smax.nxv4i64(<vscale x 4 x i64>, <vscale x 4 x i64>, <vscale x 4 x i1>, i32)
1337 define <vscale x 4 x i64> @vmax_vv_nxv4i64(<vscale x 4 x i64> %va, <vscale x 4 x i64> %b, <vscale x 4 x i1> %m, i32 zeroext %evl) {
1338 ; CHECK-LABEL: vmax_vv_nxv4i64:
1340 ; CHECK-NEXT: vsetvli zero, a0, e64, m4, ta, ma
1341 ; CHECK-NEXT: vmax.vv v8, v8, v12, v0.t
1343 %v = call <vscale x 4 x i64> @llvm.vp.smax.nxv4i64(<vscale x 4 x i64> %va, <vscale x 4 x i64> %b, <vscale x 4 x i1> %m, i32 %evl)
1344 ret <vscale x 4 x i64> %v
1347 define <vscale x 4 x i64> @vmax_vv_nxv4i64_unmasked(<vscale x 4 x i64> %va, <vscale x 4 x i64> %b, i32 zeroext %evl) {
1348 ; CHECK-LABEL: vmax_vv_nxv4i64_unmasked:
1350 ; CHECK-NEXT: vsetvli zero, a0, e64, m4, ta, ma
1351 ; CHECK-NEXT: vmax.vv v8, v8, v12
1353 %head = insertelement <vscale x 4 x i1> poison, i1 true, i32 0
1354 %m = shufflevector <vscale x 4 x i1> %head, <vscale x 4 x i1> poison, <vscale x 4 x i32> zeroinitializer
1355 %v = call <vscale x 4 x i64> @llvm.vp.smax.nxv4i64(<vscale x 4 x i64> %va, <vscale x 4 x i64> %b, <vscale x 4 x i1> %m, i32 %evl)
1356 ret <vscale x 4 x i64> %v
1359 define <vscale x 4 x i64> @vmax_vx_nxv4i64(<vscale x 4 x i64> %va, i64 %b, <vscale x 4 x i1> %m, i32 zeroext %evl) {
1360 ; RV32-LABEL: vmax_vx_nxv4i64:
1362 ; RV32-NEXT: addi sp, sp, -16
1363 ; RV32-NEXT: .cfi_def_cfa_offset 16
1364 ; RV32-NEXT: sw a1, 12(sp)
1365 ; RV32-NEXT: sw a0, 8(sp)
1366 ; RV32-NEXT: addi a0, sp, 8
1367 ; RV32-NEXT: vsetvli a1, zero, e64, m4, ta, ma
1368 ; RV32-NEXT: vlse64.v v12, (a0), zero
1369 ; RV32-NEXT: vsetvli zero, a2, e64, m4, ta, ma
1370 ; RV32-NEXT: vmax.vv v8, v8, v12, v0.t
1371 ; RV32-NEXT: addi sp, sp, 16
1374 ; RV64-LABEL: vmax_vx_nxv4i64:
1376 ; RV64-NEXT: vsetvli zero, a1, e64, m4, ta, ma
1377 ; RV64-NEXT: vmax.vx v8, v8, a0, v0.t
1379 %elt.head = insertelement <vscale x 4 x i64> poison, i64 %b, i32 0
1380 %vb = shufflevector <vscale x 4 x i64> %elt.head, <vscale x 4 x i64> poison, <vscale x 4 x i32> zeroinitializer
1381 %v = call <vscale x 4 x i64> @llvm.vp.smax.nxv4i64(<vscale x 4 x i64> %va, <vscale x 4 x i64> %vb, <vscale x 4 x i1> %m, i32 %evl)
1382 ret <vscale x 4 x i64> %v
1385 define <vscale x 4 x i64> @vmax_vx_nxv4i64_unmasked(<vscale x 4 x i64> %va, i64 %b, i32 zeroext %evl) {
1386 ; RV32-LABEL: vmax_vx_nxv4i64_unmasked:
1388 ; RV32-NEXT: addi sp, sp, -16
1389 ; RV32-NEXT: .cfi_def_cfa_offset 16
1390 ; RV32-NEXT: sw a1, 12(sp)
1391 ; RV32-NEXT: sw a0, 8(sp)
1392 ; RV32-NEXT: addi a0, sp, 8
1393 ; RV32-NEXT: vsetvli a1, zero, e64, m4, ta, ma
1394 ; RV32-NEXT: vlse64.v v12, (a0), zero
1395 ; RV32-NEXT: vsetvli zero, a2, e64, m4, ta, ma
1396 ; RV32-NEXT: vmax.vv v8, v8, v12
1397 ; RV32-NEXT: addi sp, sp, 16
1400 ; RV64-LABEL: vmax_vx_nxv4i64_unmasked:
1402 ; RV64-NEXT: vsetvli zero, a1, e64, m4, ta, ma
1403 ; RV64-NEXT: vmax.vx v8, v8, a0
1405 %elt.head = insertelement <vscale x 4 x i64> poison, i64 %b, i32 0
1406 %vb = shufflevector <vscale x 4 x i64> %elt.head, <vscale x 4 x i64> poison, <vscale x 4 x i32> zeroinitializer
1407 %head = insertelement <vscale x 4 x i1> poison, i1 true, i32 0
1408 %m = shufflevector <vscale x 4 x i1> %head, <vscale x 4 x i1> poison, <vscale x 4 x i32> zeroinitializer
1409 %v = call <vscale x 4 x i64> @llvm.vp.smax.nxv4i64(<vscale x 4 x i64> %va, <vscale x 4 x i64> %vb, <vscale x 4 x i1> %m, i32 %evl)
1410 ret <vscale x 4 x i64> %v
1413 declare <vscale x 8 x i64> @llvm.vp.smax.nxv8i64(<vscale x 8 x i64>, <vscale x 8 x i64>, <vscale x 8 x i1>, i32)
1415 define <vscale x 8 x i64> @vmax_vv_nxv8i64(<vscale x 8 x i64> %va, <vscale x 8 x i64> %b, <vscale x 8 x i1> %m, i32 zeroext %evl) {
1416 ; CHECK-LABEL: vmax_vv_nxv8i64:
1418 ; CHECK-NEXT: vsetvli zero, a0, e64, m8, ta, ma
1419 ; CHECK-NEXT: vmax.vv v8, v8, v16, v0.t
1421 %v = call <vscale x 8 x i64> @llvm.vp.smax.nxv8i64(<vscale x 8 x i64> %va, <vscale x 8 x i64> %b, <vscale x 8 x i1> %m, i32 %evl)
1422 ret <vscale x 8 x i64> %v
1425 define <vscale x 8 x i64> @vmax_vv_nxv8i64_unmasked(<vscale x 8 x i64> %va, <vscale x 8 x i64> %b, i32 zeroext %evl) {
1426 ; CHECK-LABEL: vmax_vv_nxv8i64_unmasked:
1428 ; CHECK-NEXT: vsetvli zero, a0, e64, m8, ta, ma
1429 ; CHECK-NEXT: vmax.vv v8, v8, v16
1431 %head = insertelement <vscale x 8 x i1> poison, i1 true, i32 0
1432 %m = shufflevector <vscale x 8 x i1> %head, <vscale x 8 x i1> poison, <vscale x 8 x i32> zeroinitializer
1433 %v = call <vscale x 8 x i64> @llvm.vp.smax.nxv8i64(<vscale x 8 x i64> %va, <vscale x 8 x i64> %b, <vscale x 8 x i1> %m, i32 %evl)
1434 ret <vscale x 8 x i64> %v
1437 define <vscale x 8 x i64> @vmax_vx_nxv8i64(<vscale x 8 x i64> %va, i64 %b, <vscale x 8 x i1> %m, i32 zeroext %evl) {
1438 ; RV32-LABEL: vmax_vx_nxv8i64:
1440 ; RV32-NEXT: addi sp, sp, -16
1441 ; RV32-NEXT: .cfi_def_cfa_offset 16
1442 ; RV32-NEXT: sw a1, 12(sp)
1443 ; RV32-NEXT: sw a0, 8(sp)
1444 ; RV32-NEXT: addi a0, sp, 8
1445 ; RV32-NEXT: vsetvli a1, zero, e64, m8, ta, ma
1446 ; RV32-NEXT: vlse64.v v16, (a0), zero
1447 ; RV32-NEXT: vsetvli zero, a2, e64, m8, ta, ma
1448 ; RV32-NEXT: vmax.vv v8, v8, v16, v0.t
1449 ; RV32-NEXT: addi sp, sp, 16
1452 ; RV64-LABEL: vmax_vx_nxv8i64:
1454 ; RV64-NEXT: vsetvli zero, a1, e64, m8, ta, ma
1455 ; RV64-NEXT: vmax.vx v8, v8, a0, v0.t
1457 %elt.head = insertelement <vscale x 8 x i64> poison, i64 %b, i32 0
1458 %vb = shufflevector <vscale x 8 x i64> %elt.head, <vscale x 8 x i64> poison, <vscale x 8 x i32> zeroinitializer
1459 %v = call <vscale x 8 x i64> @llvm.vp.smax.nxv8i64(<vscale x 8 x i64> %va, <vscale x 8 x i64> %vb, <vscale x 8 x i1> %m, i32 %evl)
1460 ret <vscale x 8 x i64> %v
1463 define <vscale x 8 x i64> @vmax_vx_nxv8i64_unmasked(<vscale x 8 x i64> %va, i64 %b, i32 zeroext %evl) {
1464 ; RV32-LABEL: vmax_vx_nxv8i64_unmasked:
1466 ; RV32-NEXT: addi sp, sp, -16
1467 ; RV32-NEXT: .cfi_def_cfa_offset 16
1468 ; RV32-NEXT: sw a1, 12(sp)
1469 ; RV32-NEXT: sw a0, 8(sp)
1470 ; RV32-NEXT: addi a0, sp, 8
1471 ; RV32-NEXT: vsetvli a1, zero, e64, m8, ta, ma
1472 ; RV32-NEXT: vlse64.v v16, (a0), zero
1473 ; RV32-NEXT: vsetvli zero, a2, e64, m8, ta, ma
1474 ; RV32-NEXT: vmax.vv v8, v8, v16
1475 ; RV32-NEXT: addi sp, sp, 16
1478 ; RV64-LABEL: vmax_vx_nxv8i64_unmasked:
1480 ; RV64-NEXT: vsetvli zero, a1, e64, m8, ta, ma
1481 ; RV64-NEXT: vmax.vx v8, v8, a0
1483 %elt.head = insertelement <vscale x 8 x i64> poison, i64 %b, i32 0
1484 %vb = shufflevector <vscale x 8 x i64> %elt.head, <vscale x 8 x i64> poison, <vscale x 8 x i32> zeroinitializer
1485 %head = insertelement <vscale x 8 x i1> poison, i1 true, i32 0
1486 %m = shufflevector <vscale x 8 x i1> %head, <vscale x 8 x i1> poison, <vscale x 8 x i32> zeroinitializer
1487 %v = call <vscale x 8 x i64> @llvm.vp.smax.nxv8i64(<vscale x 8 x i64> %va, <vscale x 8 x i64> %vb, <vscale x 8 x i1> %m, i32 %evl)
1488 ret <vscale x 8 x i64> %v