1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=riscv32 -mattr=+d,+zfh,+zvfh,+v -target-abi=ilp32d \
3 ; RUN: -verify-machineinstrs < %s | FileCheck %s --check-prefixes=CHECK,ZVFH
4 ; RUN: llc -mtriple=riscv64 -mattr=+d,+zfh,+zvfh,+v -target-abi=lp64d \
5 ; RUN: -verify-machineinstrs < %s | FileCheck %s --check-prefixes=CHECK,ZVFH
6 ; RUN: llc -mtriple=riscv32 -mattr=+d,+zfh,+zvfhmin,+v -target-abi=ilp32d \
7 ; RUN: -verify-machineinstrs < %s | FileCheck %s --check-prefixes=CHECK,ZVFHMIN
8 ; RUN: llc -mtriple=riscv64 -mattr=+d,+zfh,+zvfhmin,+v -target-abi=lp64d \
9 ; RUN: -verify-machineinstrs < %s | FileCheck %s --check-prefixes=CHECK,ZVFHMIN
11 declare <2 x half> @llvm.maxnum.v2f16(<2 x half>, <2 x half>)
13 define <2 x half> @vfmax_v2f16_vv(<2 x half> %a, <2 x half> %b) {
14 ; ZVFH-LABEL: vfmax_v2f16_vv:
16 ; ZVFH-NEXT: vsetivli zero, 2, e16, mf4, ta, ma
17 ; ZVFH-NEXT: vfmax.vv v8, v8, v9
20 ; ZVFHMIN-LABEL: vfmax_v2f16_vv:
22 ; ZVFHMIN-NEXT: vsetivli zero, 2, e16, mf4, ta, ma
23 ; ZVFHMIN-NEXT: vfwcvt.f.f.v v10, v9
24 ; ZVFHMIN-NEXT: vfwcvt.f.f.v v9, v8
25 ; ZVFHMIN-NEXT: vsetvli zero, zero, e32, mf2, ta, ma
26 ; ZVFHMIN-NEXT: vfmax.vv v9, v9, v10
27 ; ZVFHMIN-NEXT: vsetvli zero, zero, e16, mf4, ta, ma
28 ; ZVFHMIN-NEXT: vfncvt.f.f.w v8, v9
30 %v = call <2 x half> @llvm.maxnum.v2f16(<2 x half> %a, <2 x half> %b)
34 define <2 x half> @vfmax_v2f16_vf(<2 x half> %a, half %b) {
35 ; ZVFH-LABEL: vfmax_v2f16_vf:
37 ; ZVFH-NEXT: vsetivli zero, 2, e16, mf4, ta, ma
38 ; ZVFH-NEXT: vfmax.vf v8, v8, fa0
41 ; ZVFHMIN-LABEL: vfmax_v2f16_vf:
43 ; ZVFHMIN-NEXT: fcvt.s.h fa5, fa0
44 ; ZVFHMIN-NEXT: vsetvli a0, zero, e32, mf2, ta, ma
45 ; ZVFHMIN-NEXT: vfmv.v.f v9, fa5
46 ; ZVFHMIN-NEXT: vsetvli zero, zero, e16, mf4, ta, ma
47 ; ZVFHMIN-NEXT: vfncvt.f.f.w v10, v9
48 ; ZVFHMIN-NEXT: vsetivli zero, 2, e16, mf4, ta, ma
49 ; ZVFHMIN-NEXT: vfwcvt.f.f.v v9, v8
50 ; ZVFHMIN-NEXT: vfwcvt.f.f.v v8, v10
51 ; ZVFHMIN-NEXT: vsetvli zero, zero, e32, mf2, ta, ma
52 ; ZVFHMIN-NEXT: vfmax.vv v9, v9, v8
53 ; ZVFHMIN-NEXT: vsetvli zero, zero, e16, mf4, ta, ma
54 ; ZVFHMIN-NEXT: vfncvt.f.f.w v8, v9
56 %head = insertelement <2 x half> poison, half %b, i32 0
57 %splat = shufflevector <2 x half> %head, <2 x half> poison, <2 x i32> zeroinitializer
58 %v = call <2 x half> @llvm.maxnum.v2f16(<2 x half> %a, <2 x half> %splat)
62 define <2 x half> @vfmax_v2f16_fv(<2 x half> %a, half %b) {
63 ; ZVFH-LABEL: vfmax_v2f16_fv:
65 ; ZVFH-NEXT: vsetivli zero, 2, e16, mf4, ta, ma
66 ; ZVFH-NEXT: vfmax.vf v8, v8, fa0
69 ; ZVFHMIN-LABEL: vfmax_v2f16_fv:
71 ; ZVFHMIN-NEXT: fcvt.s.h fa5, fa0
72 ; ZVFHMIN-NEXT: vsetvli a0, zero, e32, mf2, ta, ma
73 ; ZVFHMIN-NEXT: vfmv.v.f v9, fa5
74 ; ZVFHMIN-NEXT: vsetvli zero, zero, e16, mf4, ta, ma
75 ; ZVFHMIN-NEXT: vfncvt.f.f.w v10, v9
76 ; ZVFHMIN-NEXT: vsetivli zero, 2, e16, mf4, ta, ma
77 ; ZVFHMIN-NEXT: vfwcvt.f.f.v v9, v8
78 ; ZVFHMIN-NEXT: vfwcvt.f.f.v v8, v10
79 ; ZVFHMIN-NEXT: vsetvli zero, zero, e32, mf2, ta, ma
80 ; ZVFHMIN-NEXT: vfmax.vv v9, v8, v9
81 ; ZVFHMIN-NEXT: vsetvli zero, zero, e16, mf4, ta, ma
82 ; ZVFHMIN-NEXT: vfncvt.f.f.w v8, v9
84 %head = insertelement <2 x half> poison, half %b, i32 0
85 %splat = shufflevector <2 x half> %head, <2 x half> poison, <2 x i32> zeroinitializer
86 %v = call <2 x half> @llvm.maxnum.v2f16(<2 x half> %splat, <2 x half> %a)
90 declare <4 x half> @llvm.maxnum.v4f16(<4 x half>, <4 x half>)
92 define <4 x half> @vfmax_v4f16_vv(<4 x half> %a, <4 x half> %b) {
93 ; ZVFH-LABEL: vfmax_v4f16_vv:
95 ; ZVFH-NEXT: vsetivli zero, 4, e16, mf2, ta, ma
96 ; ZVFH-NEXT: vfmax.vv v8, v8, v9
99 ; ZVFHMIN-LABEL: vfmax_v4f16_vv:
101 ; ZVFHMIN-NEXT: vsetivli zero, 4, e16, mf2, ta, ma
102 ; ZVFHMIN-NEXT: vfwcvt.f.f.v v10, v9
103 ; ZVFHMIN-NEXT: vfwcvt.f.f.v v9, v8
104 ; ZVFHMIN-NEXT: vsetvli zero, zero, e32, m1, ta, ma
105 ; ZVFHMIN-NEXT: vfmax.vv v9, v9, v10
106 ; ZVFHMIN-NEXT: vsetvli zero, zero, e16, mf2, ta, ma
107 ; ZVFHMIN-NEXT: vfncvt.f.f.w v8, v9
109 %v = call <4 x half> @llvm.maxnum.v4f16(<4 x half> %a, <4 x half> %b)
113 define <4 x half> @vfmax_v4f16_vf(<4 x half> %a, half %b) {
114 ; ZVFH-LABEL: vfmax_v4f16_vf:
116 ; ZVFH-NEXT: vsetivli zero, 4, e16, mf2, ta, ma
117 ; ZVFH-NEXT: vfmax.vf v8, v8, fa0
120 ; ZVFHMIN-LABEL: vfmax_v4f16_vf:
122 ; ZVFHMIN-NEXT: fcvt.s.h fa5, fa0
123 ; ZVFHMIN-NEXT: vsetvli a0, zero, e32, m1, ta, ma
124 ; ZVFHMIN-NEXT: vfmv.v.f v9, fa5
125 ; ZVFHMIN-NEXT: vsetvli zero, zero, e16, mf2, ta, ma
126 ; ZVFHMIN-NEXT: vfncvt.f.f.w v10, v9
127 ; ZVFHMIN-NEXT: vsetivli zero, 4, e16, mf2, ta, ma
128 ; ZVFHMIN-NEXT: vfwcvt.f.f.v v9, v8
129 ; ZVFHMIN-NEXT: vfwcvt.f.f.v v8, v10
130 ; ZVFHMIN-NEXT: vsetvli zero, zero, e32, m1, ta, ma
131 ; ZVFHMIN-NEXT: vfmax.vv v9, v9, v8
132 ; ZVFHMIN-NEXT: vsetvli zero, zero, e16, mf2, ta, ma
133 ; ZVFHMIN-NEXT: vfncvt.f.f.w v8, v9
135 %head = insertelement <4 x half> poison, half %b, i32 0
136 %splat = shufflevector <4 x half> %head, <4 x half> poison, <4 x i32> zeroinitializer
137 %v = call <4 x half> @llvm.maxnum.v4f16(<4 x half> %a, <4 x half> %splat)
141 define <4 x half> @vfmax_v4f16_fv(<4 x half> %a, half %b) {
142 ; ZVFH-LABEL: vfmax_v4f16_fv:
144 ; ZVFH-NEXT: vsetivli zero, 4, e16, mf2, ta, ma
145 ; ZVFH-NEXT: vfmax.vf v8, v8, fa0
148 ; ZVFHMIN-LABEL: vfmax_v4f16_fv:
150 ; ZVFHMIN-NEXT: fcvt.s.h fa5, fa0
151 ; ZVFHMIN-NEXT: vsetvli a0, zero, e32, m1, ta, ma
152 ; ZVFHMIN-NEXT: vfmv.v.f v9, fa5
153 ; ZVFHMIN-NEXT: vsetvli zero, zero, e16, mf2, ta, ma
154 ; ZVFHMIN-NEXT: vfncvt.f.f.w v10, v9
155 ; ZVFHMIN-NEXT: vsetivli zero, 4, e16, mf2, ta, ma
156 ; ZVFHMIN-NEXT: vfwcvt.f.f.v v9, v8
157 ; ZVFHMIN-NEXT: vfwcvt.f.f.v v8, v10
158 ; ZVFHMIN-NEXT: vsetvli zero, zero, e32, m1, ta, ma
159 ; ZVFHMIN-NEXT: vfmax.vv v9, v8, v9
160 ; ZVFHMIN-NEXT: vsetvli zero, zero, e16, mf2, ta, ma
161 ; ZVFHMIN-NEXT: vfncvt.f.f.w v8, v9
163 %head = insertelement <4 x half> poison, half %b, i32 0
164 %splat = shufflevector <4 x half> %head, <4 x half> poison, <4 x i32> zeroinitializer
165 %v = call <4 x half> @llvm.maxnum.v4f16(<4 x half> %splat, <4 x half> %a)
169 declare <8 x half> @llvm.maxnum.v8f16(<8 x half>, <8 x half>)
171 define <8 x half> @vfmax_v8f16_vv(<8 x half> %a, <8 x half> %b) {
172 ; ZVFH-LABEL: vfmax_v8f16_vv:
174 ; ZVFH-NEXT: vsetivli zero, 8, e16, m1, ta, ma
175 ; ZVFH-NEXT: vfmax.vv v8, v8, v9
178 ; ZVFHMIN-LABEL: vfmax_v8f16_vv:
180 ; ZVFHMIN-NEXT: vsetivli zero, 8, e16, m1, ta, ma
181 ; ZVFHMIN-NEXT: vfwcvt.f.f.v v10, v9
182 ; ZVFHMIN-NEXT: vfwcvt.f.f.v v12, v8
183 ; ZVFHMIN-NEXT: vsetvli zero, zero, e32, m2, ta, ma
184 ; ZVFHMIN-NEXT: vfmax.vv v10, v12, v10
185 ; ZVFHMIN-NEXT: vsetvli zero, zero, e16, m1, ta, ma
186 ; ZVFHMIN-NEXT: vfncvt.f.f.w v8, v10
188 %v = call <8 x half> @llvm.maxnum.v8f16(<8 x half> %a, <8 x half> %b)
192 define <8 x half> @vfmax_v8f16_vf(<8 x half> %a, half %b) {
193 ; ZVFH-LABEL: vfmax_v8f16_vf:
195 ; ZVFH-NEXT: vsetivli zero, 8, e16, m1, ta, ma
196 ; ZVFH-NEXT: vfmax.vf v8, v8, fa0
199 ; ZVFHMIN-LABEL: vfmax_v8f16_vf:
201 ; ZVFHMIN-NEXT: fcvt.s.h fa5, fa0
202 ; ZVFHMIN-NEXT: vsetvli a0, zero, e32, m2, ta, ma
203 ; ZVFHMIN-NEXT: vfmv.v.f v10, fa5
204 ; ZVFHMIN-NEXT: vsetvli zero, zero, e16, m1, ta, ma
205 ; ZVFHMIN-NEXT: vfncvt.f.f.w v9, v10
206 ; ZVFHMIN-NEXT: vsetivli zero, 8, e16, m1, ta, ma
207 ; ZVFHMIN-NEXT: vfwcvt.f.f.v v10, v8
208 ; ZVFHMIN-NEXT: vfwcvt.f.f.v v12, v9
209 ; ZVFHMIN-NEXT: vsetvli zero, zero, e32, m2, ta, ma
210 ; ZVFHMIN-NEXT: vfmax.vv v10, v10, v12
211 ; ZVFHMIN-NEXT: vsetvli zero, zero, e16, m1, ta, ma
212 ; ZVFHMIN-NEXT: vfncvt.f.f.w v8, v10
214 %head = insertelement <8 x half> poison, half %b, i32 0
215 %splat = shufflevector <8 x half> %head, <8 x half> poison, <8 x i32> zeroinitializer
216 %v = call <8 x half> @llvm.maxnum.v8f16(<8 x half> %a, <8 x half> %splat)
220 define <8 x half> @vfmax_v8f16_fv(<8 x half> %a, half %b) {
221 ; ZVFH-LABEL: vfmax_v8f16_fv:
223 ; ZVFH-NEXT: vsetivli zero, 8, e16, m1, ta, ma
224 ; ZVFH-NEXT: vfmax.vf v8, v8, fa0
227 ; ZVFHMIN-LABEL: vfmax_v8f16_fv:
229 ; ZVFHMIN-NEXT: fcvt.s.h fa5, fa0
230 ; ZVFHMIN-NEXT: vsetvli a0, zero, e32, m2, ta, ma
231 ; ZVFHMIN-NEXT: vfmv.v.f v10, fa5
232 ; ZVFHMIN-NEXT: vsetvli zero, zero, e16, m1, ta, ma
233 ; ZVFHMIN-NEXT: vfncvt.f.f.w v9, v10
234 ; ZVFHMIN-NEXT: vsetivli zero, 8, e16, m1, ta, ma
235 ; ZVFHMIN-NEXT: vfwcvt.f.f.v v10, v8
236 ; ZVFHMIN-NEXT: vfwcvt.f.f.v v12, v9
237 ; ZVFHMIN-NEXT: vsetvli zero, zero, e32, m2, ta, ma
238 ; ZVFHMIN-NEXT: vfmax.vv v10, v12, v10
239 ; ZVFHMIN-NEXT: vsetvli zero, zero, e16, m1, ta, ma
240 ; ZVFHMIN-NEXT: vfncvt.f.f.w v8, v10
242 %head = insertelement <8 x half> poison, half %b, i32 0
243 %splat = shufflevector <8 x half> %head, <8 x half> poison, <8 x i32> zeroinitializer
244 %v = call <8 x half> @llvm.maxnum.v8f16(<8 x half> %splat, <8 x half> %a)
248 declare <16 x half> @llvm.maxnum.v16f16(<16 x half>, <16 x half>)
250 define <16 x half> @vfmax_v16f16_vv(<16 x half> %a, <16 x half> %b) {
251 ; ZVFH-LABEL: vfmax_v16f16_vv:
253 ; ZVFH-NEXT: vsetivli zero, 16, e16, m2, ta, ma
254 ; ZVFH-NEXT: vfmax.vv v8, v8, v10
257 ; ZVFHMIN-LABEL: vfmax_v16f16_vv:
259 ; ZVFHMIN-NEXT: vsetivli zero, 16, e16, m2, ta, ma
260 ; ZVFHMIN-NEXT: vfwcvt.f.f.v v12, v10
261 ; ZVFHMIN-NEXT: vfwcvt.f.f.v v16, v8
262 ; ZVFHMIN-NEXT: vsetvli zero, zero, e32, m4, ta, ma
263 ; ZVFHMIN-NEXT: vfmax.vv v12, v16, v12
264 ; ZVFHMIN-NEXT: vsetvli zero, zero, e16, m2, ta, ma
265 ; ZVFHMIN-NEXT: vfncvt.f.f.w v8, v12
267 %v = call <16 x half> @llvm.maxnum.v16f16(<16 x half> %a, <16 x half> %b)
271 define <16 x half> @vfmax_v16f16_vf(<16 x half> %a, half %b) {
272 ; ZVFH-LABEL: vfmax_v16f16_vf:
274 ; ZVFH-NEXT: vsetivli zero, 16, e16, m2, ta, ma
275 ; ZVFH-NEXT: vfmax.vf v8, v8, fa0
278 ; ZVFHMIN-LABEL: vfmax_v16f16_vf:
280 ; ZVFHMIN-NEXT: fcvt.s.h fa5, fa0
281 ; ZVFHMIN-NEXT: vsetvli a0, zero, e32, m4, ta, ma
282 ; ZVFHMIN-NEXT: vfmv.v.f v12, fa5
283 ; ZVFHMIN-NEXT: vsetvli zero, zero, e16, m2, ta, ma
284 ; ZVFHMIN-NEXT: vfncvt.f.f.w v10, v12
285 ; ZVFHMIN-NEXT: vsetivli zero, 16, e16, m2, ta, ma
286 ; ZVFHMIN-NEXT: vfwcvt.f.f.v v12, v8
287 ; ZVFHMIN-NEXT: vfwcvt.f.f.v v16, v10
288 ; ZVFHMIN-NEXT: vsetvli zero, zero, e32, m4, ta, ma
289 ; ZVFHMIN-NEXT: vfmax.vv v12, v12, v16
290 ; ZVFHMIN-NEXT: vsetvli zero, zero, e16, m2, ta, ma
291 ; ZVFHMIN-NEXT: vfncvt.f.f.w v8, v12
293 %head = insertelement <16 x half> poison, half %b, i32 0
294 %splat = shufflevector <16 x half> %head, <16 x half> poison, <16 x i32> zeroinitializer
295 %v = call <16 x half> @llvm.maxnum.v16f16(<16 x half> %a, <16 x half> %splat)
299 define <16 x half> @vfmax_v16f16_fv(<16 x half> %a, half %b) {
300 ; ZVFH-LABEL: vfmax_v16f16_fv:
302 ; ZVFH-NEXT: vsetivli zero, 16, e16, m2, ta, ma
303 ; ZVFH-NEXT: vfmax.vf v8, v8, fa0
306 ; ZVFHMIN-LABEL: vfmax_v16f16_fv:
308 ; ZVFHMIN-NEXT: fcvt.s.h fa5, fa0
309 ; ZVFHMIN-NEXT: vsetvli a0, zero, e32, m4, ta, ma
310 ; ZVFHMIN-NEXT: vfmv.v.f v12, fa5
311 ; ZVFHMIN-NEXT: vsetvli zero, zero, e16, m2, ta, ma
312 ; ZVFHMIN-NEXT: vfncvt.f.f.w v10, v12
313 ; ZVFHMIN-NEXT: vsetivli zero, 16, e16, m2, ta, ma
314 ; ZVFHMIN-NEXT: vfwcvt.f.f.v v12, v8
315 ; ZVFHMIN-NEXT: vfwcvt.f.f.v v16, v10
316 ; ZVFHMIN-NEXT: vsetvli zero, zero, e32, m4, ta, ma
317 ; ZVFHMIN-NEXT: vfmax.vv v12, v16, v12
318 ; ZVFHMIN-NEXT: vsetvli zero, zero, e16, m2, ta, ma
319 ; ZVFHMIN-NEXT: vfncvt.f.f.w v8, v12
321 %head = insertelement <16 x half> poison, half %b, i32 0
322 %splat = shufflevector <16 x half> %head, <16 x half> poison, <16 x i32> zeroinitializer
323 %v = call <16 x half> @llvm.maxnum.v16f16(<16 x half> %splat, <16 x half> %a)
327 declare <2 x float> @llvm.maxnum.v2f32(<2 x float>, <2 x float>)
329 define <2 x float> @vfmax_v2f32_vv(<2 x float> %a, <2 x float> %b) {
330 ; CHECK-LABEL: vfmax_v2f32_vv:
332 ; CHECK-NEXT: vsetivli zero, 2, e32, mf2, ta, ma
333 ; CHECK-NEXT: vfmax.vv v8, v8, v9
335 %v = call <2 x float> @llvm.maxnum.v2f32(<2 x float> %a, <2 x float> %b)
339 define <2 x float> @vfmax_v2f32_vf(<2 x float> %a, float %b) {
340 ; CHECK-LABEL: vfmax_v2f32_vf:
342 ; CHECK-NEXT: vsetivli zero, 2, e32, mf2, ta, ma
343 ; CHECK-NEXT: vfmax.vf v8, v8, fa0
345 %head = insertelement <2 x float> poison, float %b, i32 0
346 %splat = shufflevector <2 x float> %head, <2 x float> poison, <2 x i32> zeroinitializer
347 %v = call <2 x float> @llvm.maxnum.v2f32(<2 x float> %a, <2 x float> %splat)
351 define <2 x float> @vfmax_v2f32_fv(<2 x float> %a, float %b) {
352 ; CHECK-LABEL: vfmax_v2f32_fv:
354 ; CHECK-NEXT: vsetivli zero, 2, e32, mf2, ta, ma
355 ; CHECK-NEXT: vfmax.vf v8, v8, fa0
357 %head = insertelement <2 x float> poison, float %b, i32 0
358 %splat = shufflevector <2 x float> %head, <2 x float> poison, <2 x i32> zeroinitializer
359 %v = call <2 x float> @llvm.maxnum.v2f32(<2 x float> %splat, <2 x float> %a)
363 declare <4 x float> @llvm.maxnum.v4f32(<4 x float>, <4 x float>)
365 define <4 x float> @vfmax_v4f32_vv(<4 x float> %a, <4 x float> %b) {
366 ; CHECK-LABEL: vfmax_v4f32_vv:
368 ; CHECK-NEXT: vsetivli zero, 4, e32, m1, ta, ma
369 ; CHECK-NEXT: vfmax.vv v8, v8, v9
371 %v = call <4 x float> @llvm.maxnum.v4f32(<4 x float> %a, <4 x float> %b)
375 define <4 x float> @vfmax_v4f32_vf(<4 x float> %a, float %b) {
376 ; CHECK-LABEL: vfmax_v4f32_vf:
378 ; CHECK-NEXT: vsetivli zero, 4, e32, m1, ta, ma
379 ; CHECK-NEXT: vfmax.vf v8, v8, fa0
381 %head = insertelement <4 x float> poison, float %b, i32 0
382 %splat = shufflevector <4 x float> %head, <4 x float> poison, <4 x i32> zeroinitializer
383 %v = call <4 x float> @llvm.maxnum.v4f32(<4 x float> %a, <4 x float> %splat)
387 define <4 x float> @vfmax_v4f32_fv(<4 x float> %a, float %b) {
388 ; CHECK-LABEL: vfmax_v4f32_fv:
390 ; CHECK-NEXT: vsetivli zero, 4, e32, m1, ta, ma
391 ; CHECK-NEXT: vfmax.vf v8, v8, fa0
393 %head = insertelement <4 x float> poison, float %b, i32 0
394 %splat = shufflevector <4 x float> %head, <4 x float> poison, <4 x i32> zeroinitializer
395 %v = call <4 x float> @llvm.maxnum.v4f32(<4 x float> %splat, <4 x float> %a)
399 declare <8 x float> @llvm.maxnum.v8f32(<8 x float>, <8 x float>)
401 define <8 x float> @vfmax_v8f32_vv(<8 x float> %a, <8 x float> %b) {
402 ; CHECK-LABEL: vfmax_v8f32_vv:
404 ; CHECK-NEXT: vsetivli zero, 8, e32, m2, ta, ma
405 ; CHECK-NEXT: vfmax.vv v8, v8, v10
407 %v = call <8 x float> @llvm.maxnum.v8f32(<8 x float> %a, <8 x float> %b)
411 define <8 x float> @vfmax_v8f32_vf(<8 x float> %a, float %b) {
412 ; CHECK-LABEL: vfmax_v8f32_vf:
414 ; CHECK-NEXT: vsetivli zero, 8, e32, m2, ta, ma
415 ; CHECK-NEXT: vfmax.vf v8, v8, fa0
417 %head = insertelement <8 x float> poison, float %b, i32 0
418 %splat = shufflevector <8 x float> %head, <8 x float> poison, <8 x i32> zeroinitializer
419 %v = call <8 x float> @llvm.maxnum.v8f32(<8 x float> %a, <8 x float> %splat)
423 define <8 x float> @vfmax_v8f32_fv(<8 x float> %a, float %b) {
424 ; CHECK-LABEL: vfmax_v8f32_fv:
426 ; CHECK-NEXT: vsetivli zero, 8, e32, m2, ta, ma
427 ; CHECK-NEXT: vfmax.vf v8, v8, fa0
429 %head = insertelement <8 x float> poison, float %b, i32 0
430 %splat = shufflevector <8 x float> %head, <8 x float> poison, <8 x i32> zeroinitializer
431 %v = call <8 x float> @llvm.maxnum.v8f32(<8 x float> %splat, <8 x float> %a)
435 declare <16 x float> @llvm.maxnum.v16f32(<16 x float>, <16 x float>)
437 define <16 x float> @vfmax_v16f32_vv(<16 x float> %a, <16 x float> %b) {
438 ; CHECK-LABEL: vfmax_v16f32_vv:
440 ; CHECK-NEXT: vsetivli zero, 16, e32, m4, ta, ma
441 ; CHECK-NEXT: vfmax.vv v8, v8, v12
443 %v = call <16 x float> @llvm.maxnum.v16f32(<16 x float> %a, <16 x float> %b)
447 define <16 x float> @vfmax_v16f32_vf(<16 x float> %a, float %b) {
448 ; CHECK-LABEL: vfmax_v16f32_vf:
450 ; CHECK-NEXT: vsetivli zero, 16, e32, m4, ta, ma
451 ; CHECK-NEXT: vfmax.vf v8, v8, fa0
453 %head = insertelement <16 x float> poison, float %b, i32 0
454 %splat = shufflevector <16 x float> %head, <16 x float> poison, <16 x i32> zeroinitializer
455 %v = call <16 x float> @llvm.maxnum.v16f32(<16 x float> %a, <16 x float> %splat)
459 define <16 x float> @vfmax_v16f32_fv(<16 x float> %a, float %b) {
460 ; CHECK-LABEL: vfmax_v16f32_fv:
462 ; CHECK-NEXT: vsetivli zero, 16, e32, m4, ta, ma
463 ; CHECK-NEXT: vfmax.vf v8, v8, fa0
465 %head = insertelement <16 x float> poison, float %b, i32 0
466 %splat = shufflevector <16 x float> %head, <16 x float> poison, <16 x i32> zeroinitializer
467 %v = call <16 x float> @llvm.maxnum.v16f32(<16 x float> %splat, <16 x float> %a)
471 declare <2 x double> @llvm.maxnum.v2f64(<2 x double>, <2 x double>)
473 define <2 x double> @vfmax_v2f64_vv(<2 x double> %a, <2 x double> %b) {
474 ; CHECK-LABEL: vfmax_v2f64_vv:
476 ; CHECK-NEXT: vsetivli zero, 2, e64, m1, ta, ma
477 ; CHECK-NEXT: vfmax.vv v8, v8, v9
479 %v = call <2 x double> @llvm.maxnum.v2f64(<2 x double> %a, <2 x double> %b)
483 define <2 x double> @vfmax_v2f64_vf(<2 x double> %a, double %b) {
484 ; CHECK-LABEL: vfmax_v2f64_vf:
486 ; CHECK-NEXT: vsetivli zero, 2, e64, m1, ta, ma
487 ; CHECK-NEXT: vfmax.vf v8, v8, fa0
489 %head = insertelement <2 x double> poison, double %b, i32 0
490 %splat = shufflevector <2 x double> %head, <2 x double> poison, <2 x i32> zeroinitializer
491 %v = call <2 x double> @llvm.maxnum.v2f64(<2 x double> %a, <2 x double> %splat)
495 define <2 x double> @vfmax_v2f64_fv(<2 x double> %a, double %b) {
496 ; CHECK-LABEL: vfmax_v2f64_fv:
498 ; CHECK-NEXT: vsetivli zero, 2, e64, m1, ta, ma
499 ; CHECK-NEXT: vfmax.vf v8, v8, fa0
501 %head = insertelement <2 x double> poison, double %b, i32 0
502 %splat = shufflevector <2 x double> %head, <2 x double> poison, <2 x i32> zeroinitializer
503 %v = call <2 x double> @llvm.maxnum.v2f64(<2 x double> %splat, <2 x double> %a)
507 declare <4 x double> @llvm.maxnum.v4f64(<4 x double>, <4 x double>)
509 define <4 x double> @vfmax_v4f64_vv(<4 x double> %a, <4 x double> %b) {
510 ; CHECK-LABEL: vfmax_v4f64_vv:
512 ; CHECK-NEXT: vsetivli zero, 4, e64, m2, ta, ma
513 ; CHECK-NEXT: vfmax.vv v8, v8, v10
515 %v = call <4 x double> @llvm.maxnum.v4f64(<4 x double> %a, <4 x double> %b)
519 define <4 x double> @vfmax_v4f64_vf(<4 x double> %a, double %b) {
520 ; CHECK-LABEL: vfmax_v4f64_vf:
522 ; CHECK-NEXT: vsetivli zero, 4, e64, m2, ta, ma
523 ; CHECK-NEXT: vfmax.vf v8, v8, fa0
525 %head = insertelement <4 x double> poison, double %b, i32 0
526 %splat = shufflevector <4 x double> %head, <4 x double> poison, <4 x i32> zeroinitializer
527 %v = call <4 x double> @llvm.maxnum.v4f64(<4 x double> %a, <4 x double> %splat)
531 define <4 x double> @vfmax_v4f64_fv(<4 x double> %a, double %b) {
532 ; CHECK-LABEL: vfmax_v4f64_fv:
534 ; CHECK-NEXT: vsetivli zero, 4, e64, m2, ta, ma
535 ; CHECK-NEXT: vfmax.vf v8, v8, fa0
537 %head = insertelement <4 x double> poison, double %b, i32 0
538 %splat = shufflevector <4 x double> %head, <4 x double> poison, <4 x i32> zeroinitializer
539 %v = call <4 x double> @llvm.maxnum.v4f64(<4 x double> %splat, <4 x double> %a)
543 declare <8 x double> @llvm.maxnum.v8f64(<8 x double>, <8 x double>)
545 define <8 x double> @vfmax_v8f64_vv(<8 x double> %a, <8 x double> %b) {
546 ; CHECK-LABEL: vfmax_v8f64_vv:
548 ; CHECK-NEXT: vsetivli zero, 8, e64, m4, ta, ma
549 ; CHECK-NEXT: vfmax.vv v8, v8, v12
551 %v = call <8 x double> @llvm.maxnum.v8f64(<8 x double> %a, <8 x double> %b)
555 define <8 x double> @vfmax_v8f64_vf(<8 x double> %a, double %b) {
556 ; CHECK-LABEL: vfmax_v8f64_vf:
558 ; CHECK-NEXT: vsetivli zero, 8, e64, m4, ta, ma
559 ; CHECK-NEXT: vfmax.vf v8, v8, fa0
561 %head = insertelement <8 x double> poison, double %b, i32 0
562 %splat = shufflevector <8 x double> %head, <8 x double> poison, <8 x i32> zeroinitializer
563 %v = call <8 x double> @llvm.maxnum.v8f64(<8 x double> %a, <8 x double> %splat)
567 define <8 x double> @vfmax_v8f64_fv(<8 x double> %a, double %b) {
568 ; CHECK-LABEL: vfmax_v8f64_fv:
570 ; CHECK-NEXT: vsetivli zero, 8, e64, m4, ta, ma
571 ; CHECK-NEXT: vfmax.vf v8, v8, fa0
573 %head = insertelement <8 x double> poison, double %b, i32 0
574 %splat = shufflevector <8 x double> %head, <8 x double> poison, <8 x i32> zeroinitializer
575 %v = call <8 x double> @llvm.maxnum.v8f64(<8 x double> %splat, <8 x double> %a)
579 declare <16 x double> @llvm.maxnum.v16f64(<16 x double>, <16 x double>)
581 define <16 x double> @vfmax_v16f64_vv(<16 x double> %a, <16 x double> %b) {
582 ; CHECK-LABEL: vfmax_v16f64_vv:
584 ; CHECK-NEXT: vsetivli zero, 16, e64, m8, ta, ma
585 ; CHECK-NEXT: vfmax.vv v8, v8, v16
587 %v = call <16 x double> @llvm.maxnum.v16f64(<16 x double> %a, <16 x double> %b)
591 define <16 x double> @vfmax_v16f64_vf(<16 x double> %a, double %b) {
592 ; CHECK-LABEL: vfmax_v16f64_vf:
594 ; CHECK-NEXT: vsetivli zero, 16, e64, m8, ta, ma
595 ; CHECK-NEXT: vfmax.vf v8, v8, fa0
597 %head = insertelement <16 x double> poison, double %b, i32 0
598 %splat = shufflevector <16 x double> %head, <16 x double> poison, <16 x i32> zeroinitializer
599 %v = call <16 x double> @llvm.maxnum.v16f64(<16 x double> %a, <16 x double> %splat)
603 define <16 x double> @vfmax_v16f64_fv(<16 x double> %a, double %b) {
604 ; CHECK-LABEL: vfmax_v16f64_fv:
606 ; CHECK-NEXT: vsetivli zero, 16, e64, m8, ta, ma
607 ; CHECK-NEXT: vfmax.vf v8, v8, fa0
609 %head = insertelement <16 x double> poison, double %b, i32 0
610 %splat = shufflevector <16 x double> %head, <16 x double> poison, <16 x i32> zeroinitializer
611 %v = call <16 x double> @llvm.maxnum.v16f64(<16 x double> %splat, <16 x double> %a)