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
4 ; RUN: llc -mtriple=riscv64 -mattr=+d,+zfh,+zvfh,+v -target-abi=lp64d \
5 ; RUN: -verify-machineinstrs < %s | FileCheck %s
7 declare <2 x half> @llvm.vp.nearbyint.v2f16(<2 x half>, <2 x i1>, i32)
9 define <2 x half> @vp_nearbyint_v2f16(<2 x half> %va, <2 x i1> %m, i32 zeroext %evl) {
10 ; CHECK-LABEL: vp_nearbyint_v2f16:
12 ; CHECK-NEXT: lui a1, %hi(.LCPI0_0)
13 ; CHECK-NEXT: flh fa5, %lo(.LCPI0_0)(a1)
14 ; CHECK-NEXT: vsetvli zero, a0, e16, mf4, ta, ma
15 ; CHECK-NEXT: vfabs.v v9, v8, v0.t
16 ; CHECK-NEXT: vsetvli zero, zero, e16, mf4, ta, mu
17 ; CHECK-NEXT: vmflt.vf v0, v9, fa5, v0.t
18 ; CHECK-NEXT: frflags a0
19 ; CHECK-NEXT: vsetvli zero, zero, e16, mf4, ta, ma
20 ; CHECK-NEXT: vfcvt.x.f.v v9, v8, v0.t
21 ; CHECK-NEXT: vfcvt.f.x.v v9, v9, v0.t
22 ; CHECK-NEXT: fsflags a0
23 ; CHECK-NEXT: vsetvli zero, zero, e16, mf4, ta, mu
24 ; CHECK-NEXT: vfsgnj.vv v8, v9, v8, v0.t
26 %v = call <2 x half> @llvm.vp.nearbyint.v2f16(<2 x half> %va, <2 x i1> %m, i32 %evl)
30 define <2 x half> @vp_nearbyint_v2f16_unmasked(<2 x half> %va, i32 zeroext %evl) {
31 ; CHECK-LABEL: vp_nearbyint_v2f16_unmasked:
33 ; CHECK-NEXT: lui a1, %hi(.LCPI1_0)
34 ; CHECK-NEXT: flh fa5, %lo(.LCPI1_0)(a1)
35 ; CHECK-NEXT: vsetvli zero, a0, e16, mf4, ta, ma
36 ; CHECK-NEXT: vfabs.v v9, v8
37 ; CHECK-NEXT: vmflt.vf v0, v9, fa5
38 ; CHECK-NEXT: frflags a0
39 ; CHECK-NEXT: vfcvt.x.f.v v9, v8, v0.t
40 ; CHECK-NEXT: vfcvt.f.x.v v9, v9, v0.t
41 ; CHECK-NEXT: fsflags a0
42 ; CHECK-NEXT: vsetvli zero, zero, e16, mf4, ta, mu
43 ; CHECK-NEXT: vfsgnj.vv v8, v9, v8, v0.t
45 %head = insertelement <2 x i1> poison, i1 true, i32 0
46 %m = shufflevector <2 x i1> %head, <2 x i1> poison, <2 x i32> zeroinitializer
47 %v = call <2 x half> @llvm.vp.nearbyint.v2f16(<2 x half> %va, <2 x i1> %m, i32 %evl)
51 declare <4 x half> @llvm.vp.nearbyint.v4f16(<4 x half>, <4 x i1>, i32)
53 define <4 x half> @vp_nearbyint_v4f16(<4 x half> %va, <4 x i1> %m, i32 zeroext %evl) {
54 ; CHECK-LABEL: vp_nearbyint_v4f16:
56 ; CHECK-NEXT: lui a1, %hi(.LCPI2_0)
57 ; CHECK-NEXT: flh fa5, %lo(.LCPI2_0)(a1)
58 ; CHECK-NEXT: vsetvli zero, a0, e16, mf2, ta, ma
59 ; CHECK-NEXT: vfabs.v v9, v8, v0.t
60 ; CHECK-NEXT: vsetvli zero, zero, e16, mf2, ta, mu
61 ; CHECK-NEXT: vmflt.vf v0, v9, fa5, v0.t
62 ; CHECK-NEXT: frflags a0
63 ; CHECK-NEXT: vsetvli zero, zero, e16, mf2, ta, ma
64 ; CHECK-NEXT: vfcvt.x.f.v v9, v8, v0.t
65 ; CHECK-NEXT: vfcvt.f.x.v v9, v9, v0.t
66 ; CHECK-NEXT: fsflags a0
67 ; CHECK-NEXT: vsetvli zero, zero, e16, mf2, ta, mu
68 ; CHECK-NEXT: vfsgnj.vv v8, v9, v8, v0.t
70 %v = call <4 x half> @llvm.vp.nearbyint.v4f16(<4 x half> %va, <4 x i1> %m, i32 %evl)
74 define <4 x half> @vp_nearbyint_v4f16_unmasked(<4 x half> %va, i32 zeroext %evl) {
75 ; CHECK-LABEL: vp_nearbyint_v4f16_unmasked:
77 ; CHECK-NEXT: lui a1, %hi(.LCPI3_0)
78 ; CHECK-NEXT: flh fa5, %lo(.LCPI3_0)(a1)
79 ; CHECK-NEXT: vsetvli zero, a0, e16, mf2, ta, ma
80 ; CHECK-NEXT: vfabs.v v9, v8
81 ; CHECK-NEXT: vmflt.vf v0, v9, fa5
82 ; CHECK-NEXT: frflags a0
83 ; CHECK-NEXT: vfcvt.x.f.v v9, v8, v0.t
84 ; CHECK-NEXT: vfcvt.f.x.v v9, v9, v0.t
85 ; CHECK-NEXT: fsflags a0
86 ; CHECK-NEXT: vsetvli zero, zero, e16, mf2, ta, mu
87 ; CHECK-NEXT: vfsgnj.vv v8, v9, v8, v0.t
89 %head = insertelement <4 x i1> poison, i1 true, i32 0
90 %m = shufflevector <4 x i1> %head, <4 x i1> poison, <4 x i32> zeroinitializer
91 %v = call <4 x half> @llvm.vp.nearbyint.v4f16(<4 x half> %va, <4 x i1> %m, i32 %evl)
95 declare <8 x half> @llvm.vp.nearbyint.v8f16(<8 x half>, <8 x i1>, i32)
97 define <8 x half> @vp_nearbyint_v8f16(<8 x half> %va, <8 x i1> %m, i32 zeroext %evl) {
98 ; CHECK-LABEL: vp_nearbyint_v8f16:
100 ; CHECK-NEXT: lui a1, %hi(.LCPI4_0)
101 ; CHECK-NEXT: flh fa5, %lo(.LCPI4_0)(a1)
102 ; CHECK-NEXT: vsetvli zero, a0, e16, m1, ta, ma
103 ; CHECK-NEXT: vfabs.v v9, v8, v0.t
104 ; CHECK-NEXT: vsetvli zero, zero, e16, m1, ta, mu
105 ; CHECK-NEXT: vmflt.vf v0, v9, fa5, v0.t
106 ; CHECK-NEXT: frflags a0
107 ; CHECK-NEXT: vsetvli zero, zero, e16, m1, ta, ma
108 ; CHECK-NEXT: vfcvt.x.f.v v9, v8, v0.t
109 ; CHECK-NEXT: vfcvt.f.x.v v9, v9, v0.t
110 ; CHECK-NEXT: fsflags a0
111 ; CHECK-NEXT: vsetvli zero, zero, e16, m1, ta, mu
112 ; CHECK-NEXT: vfsgnj.vv v8, v9, v8, v0.t
114 %v = call <8 x half> @llvm.vp.nearbyint.v8f16(<8 x half> %va, <8 x i1> %m, i32 %evl)
118 define <8 x half> @vp_nearbyint_v8f16_unmasked(<8 x half> %va, i32 zeroext %evl) {
119 ; CHECK-LABEL: vp_nearbyint_v8f16_unmasked:
121 ; CHECK-NEXT: lui a1, %hi(.LCPI5_0)
122 ; CHECK-NEXT: flh fa5, %lo(.LCPI5_0)(a1)
123 ; CHECK-NEXT: vsetvli zero, a0, e16, m1, ta, ma
124 ; CHECK-NEXT: vfabs.v v9, v8
125 ; CHECK-NEXT: vmflt.vf v0, v9, fa5
126 ; CHECK-NEXT: frflags a0
127 ; CHECK-NEXT: vfcvt.x.f.v v9, v8, v0.t
128 ; CHECK-NEXT: vfcvt.f.x.v v9, v9, v0.t
129 ; CHECK-NEXT: fsflags a0
130 ; CHECK-NEXT: vsetvli zero, zero, e16, m1, ta, mu
131 ; CHECK-NEXT: vfsgnj.vv v8, v9, v8, v0.t
133 %head = insertelement <8 x i1> poison, i1 true, i32 0
134 %m = shufflevector <8 x i1> %head, <8 x i1> poison, <8 x i32> zeroinitializer
135 %v = call <8 x half> @llvm.vp.nearbyint.v8f16(<8 x half> %va, <8 x i1> %m, i32 %evl)
139 declare <16 x half> @llvm.vp.nearbyint.v16f16(<16 x half>, <16 x i1>, i32)
141 define <16 x half> @vp_nearbyint_v16f16(<16 x half> %va, <16 x i1> %m, i32 zeroext %evl) {
142 ; CHECK-LABEL: vp_nearbyint_v16f16:
144 ; CHECK-NEXT: vmv1r.v v10, v0
145 ; CHECK-NEXT: lui a1, %hi(.LCPI6_0)
146 ; CHECK-NEXT: flh fa5, %lo(.LCPI6_0)(a1)
147 ; CHECK-NEXT: vsetvli zero, a0, e16, m2, ta, ma
148 ; CHECK-NEXT: vfabs.v v12, v8, v0.t
149 ; CHECK-NEXT: vsetvli zero, zero, e16, m2, ta, mu
150 ; CHECK-NEXT: vmflt.vf v10, v12, fa5, v0.t
151 ; CHECK-NEXT: frflags a0
152 ; CHECK-NEXT: vsetvli zero, zero, e16, m2, ta, ma
153 ; CHECK-NEXT: vmv1r.v v0, v10
154 ; CHECK-NEXT: vfcvt.x.f.v v12, v8, v0.t
155 ; CHECK-NEXT: vfcvt.f.x.v v12, v12, v0.t
156 ; CHECK-NEXT: fsflags a0
157 ; CHECK-NEXT: vsetvli zero, zero, e16, m2, ta, mu
158 ; CHECK-NEXT: vfsgnj.vv v8, v12, v8, v0.t
160 %v = call <16 x half> @llvm.vp.nearbyint.v16f16(<16 x half> %va, <16 x i1> %m, i32 %evl)
164 define <16 x half> @vp_nearbyint_v16f16_unmasked(<16 x half> %va, i32 zeroext %evl) {
165 ; CHECK-LABEL: vp_nearbyint_v16f16_unmasked:
167 ; CHECK-NEXT: lui a1, %hi(.LCPI7_0)
168 ; CHECK-NEXT: flh fa5, %lo(.LCPI7_0)(a1)
169 ; CHECK-NEXT: vsetvli zero, a0, e16, m2, ta, ma
170 ; CHECK-NEXT: vfabs.v v10, v8
171 ; CHECK-NEXT: vmflt.vf v0, v10, fa5
172 ; CHECK-NEXT: frflags a0
173 ; CHECK-NEXT: vfcvt.x.f.v v10, v8, v0.t
174 ; CHECK-NEXT: vfcvt.f.x.v v10, v10, v0.t
175 ; CHECK-NEXT: fsflags a0
176 ; CHECK-NEXT: vsetvli zero, zero, e16, m2, ta, mu
177 ; CHECK-NEXT: vfsgnj.vv v8, v10, v8, v0.t
179 %head = insertelement <16 x i1> poison, i1 true, i32 0
180 %m = shufflevector <16 x i1> %head, <16 x i1> poison, <16 x i32> zeroinitializer
181 %v = call <16 x half> @llvm.vp.nearbyint.v16f16(<16 x half> %va, <16 x i1> %m, i32 %evl)
185 declare <2 x float> @llvm.vp.nearbyint.v2f32(<2 x float>, <2 x i1>, i32)
187 define <2 x float> @vp_nearbyint_v2f32(<2 x float> %va, <2 x i1> %m, i32 zeroext %evl) {
188 ; CHECK-LABEL: vp_nearbyint_v2f32:
190 ; CHECK-NEXT: vsetvli zero, a0, e32, mf2, ta, ma
191 ; CHECK-NEXT: vfabs.v v9, v8, v0.t
192 ; CHECK-NEXT: lui a0, 307200
193 ; CHECK-NEXT: fmv.w.x fa5, a0
194 ; CHECK-NEXT: vsetvli zero, zero, e32, mf2, ta, mu
195 ; CHECK-NEXT: vmflt.vf v0, v9, fa5, v0.t
196 ; CHECK-NEXT: frflags a0
197 ; CHECK-NEXT: vsetvli zero, zero, e32, mf2, ta, ma
198 ; CHECK-NEXT: vfcvt.x.f.v v9, v8, v0.t
199 ; CHECK-NEXT: vfcvt.f.x.v v9, v9, v0.t
200 ; CHECK-NEXT: fsflags a0
201 ; CHECK-NEXT: vsetvli zero, zero, e32, mf2, ta, mu
202 ; CHECK-NEXT: vfsgnj.vv v8, v9, v8, v0.t
204 %v = call <2 x float> @llvm.vp.nearbyint.v2f32(<2 x float> %va, <2 x i1> %m, i32 %evl)
208 define <2 x float> @vp_nearbyint_v2f32_unmasked(<2 x float> %va, i32 zeroext %evl) {
209 ; CHECK-LABEL: vp_nearbyint_v2f32_unmasked:
211 ; CHECK-NEXT: vsetvli zero, a0, e32, mf2, ta, ma
212 ; CHECK-NEXT: vfabs.v v9, v8
213 ; CHECK-NEXT: lui a0, 307200
214 ; CHECK-NEXT: fmv.w.x fa5, a0
215 ; CHECK-NEXT: vmflt.vf v0, v9, fa5
216 ; CHECK-NEXT: frflags a0
217 ; CHECK-NEXT: vfcvt.x.f.v v9, v8, v0.t
218 ; CHECK-NEXT: vfcvt.f.x.v v9, v9, v0.t
219 ; CHECK-NEXT: fsflags a0
220 ; CHECK-NEXT: vsetvli zero, zero, e32, mf2, ta, mu
221 ; CHECK-NEXT: vfsgnj.vv v8, v9, v8, v0.t
223 %head = insertelement <2 x i1> poison, i1 true, i32 0
224 %m = shufflevector <2 x i1> %head, <2 x i1> poison, <2 x i32> zeroinitializer
225 %v = call <2 x float> @llvm.vp.nearbyint.v2f32(<2 x float> %va, <2 x i1> %m, i32 %evl)
229 declare <4 x float> @llvm.vp.nearbyint.v4f32(<4 x float>, <4 x i1>, i32)
231 define <4 x float> @vp_nearbyint_v4f32(<4 x float> %va, <4 x i1> %m, i32 zeroext %evl) {
232 ; CHECK-LABEL: vp_nearbyint_v4f32:
234 ; CHECK-NEXT: vsetvli zero, a0, e32, m1, ta, ma
235 ; CHECK-NEXT: vfabs.v v9, v8, v0.t
236 ; CHECK-NEXT: lui a0, 307200
237 ; CHECK-NEXT: fmv.w.x fa5, a0
238 ; CHECK-NEXT: vsetvli zero, zero, e32, m1, ta, mu
239 ; CHECK-NEXT: vmflt.vf v0, v9, fa5, v0.t
240 ; CHECK-NEXT: frflags a0
241 ; CHECK-NEXT: vsetvli zero, zero, e32, m1, ta, ma
242 ; CHECK-NEXT: vfcvt.x.f.v v9, v8, v0.t
243 ; CHECK-NEXT: vfcvt.f.x.v v9, v9, v0.t
244 ; CHECK-NEXT: fsflags a0
245 ; CHECK-NEXT: vsetvli zero, zero, e32, m1, ta, mu
246 ; CHECK-NEXT: vfsgnj.vv v8, v9, v8, v0.t
248 %v = call <4 x float> @llvm.vp.nearbyint.v4f32(<4 x float> %va, <4 x i1> %m, i32 %evl)
252 define <4 x float> @vp_nearbyint_v4f32_unmasked(<4 x float> %va, i32 zeroext %evl) {
253 ; CHECK-LABEL: vp_nearbyint_v4f32_unmasked:
255 ; CHECK-NEXT: vsetvli zero, a0, e32, m1, ta, ma
256 ; CHECK-NEXT: vfabs.v v9, v8
257 ; CHECK-NEXT: lui a0, 307200
258 ; CHECK-NEXT: fmv.w.x fa5, a0
259 ; CHECK-NEXT: vmflt.vf v0, v9, fa5
260 ; CHECK-NEXT: frflags a0
261 ; CHECK-NEXT: vfcvt.x.f.v v9, v8, v0.t
262 ; CHECK-NEXT: vfcvt.f.x.v v9, v9, v0.t
263 ; CHECK-NEXT: fsflags a0
264 ; CHECK-NEXT: vsetvli zero, zero, e32, m1, ta, mu
265 ; CHECK-NEXT: vfsgnj.vv v8, v9, v8, v0.t
267 %head = insertelement <4 x i1> poison, i1 true, i32 0
268 %m = shufflevector <4 x i1> %head, <4 x i1> poison, <4 x i32> zeroinitializer
269 %v = call <4 x float> @llvm.vp.nearbyint.v4f32(<4 x float> %va, <4 x i1> %m, i32 %evl)
273 declare <8 x float> @llvm.vp.nearbyint.v8f32(<8 x float>, <8 x i1>, i32)
275 define <8 x float> @vp_nearbyint_v8f32(<8 x float> %va, <8 x i1> %m, i32 zeroext %evl) {
276 ; CHECK-LABEL: vp_nearbyint_v8f32:
278 ; CHECK-NEXT: vmv1r.v v10, v0
279 ; CHECK-NEXT: vsetvli zero, a0, e32, m2, ta, ma
280 ; CHECK-NEXT: vfabs.v v12, v8, v0.t
281 ; CHECK-NEXT: lui a0, 307200
282 ; CHECK-NEXT: fmv.w.x fa5, a0
283 ; CHECK-NEXT: vsetvli zero, zero, e32, m2, ta, mu
284 ; CHECK-NEXT: vmflt.vf v10, v12, fa5, v0.t
285 ; CHECK-NEXT: frflags a0
286 ; CHECK-NEXT: vsetvli zero, zero, e32, m2, ta, ma
287 ; CHECK-NEXT: vmv1r.v v0, v10
288 ; CHECK-NEXT: vfcvt.x.f.v v12, v8, v0.t
289 ; CHECK-NEXT: vfcvt.f.x.v v12, v12, v0.t
290 ; CHECK-NEXT: fsflags a0
291 ; CHECK-NEXT: vsetvli zero, zero, e32, m2, ta, mu
292 ; CHECK-NEXT: vfsgnj.vv v8, v12, v8, v0.t
294 %v = call <8 x float> @llvm.vp.nearbyint.v8f32(<8 x float> %va, <8 x i1> %m, i32 %evl)
298 define <8 x float> @vp_nearbyint_v8f32_unmasked(<8 x float> %va, i32 zeroext %evl) {
299 ; CHECK-LABEL: vp_nearbyint_v8f32_unmasked:
301 ; CHECK-NEXT: vsetvli zero, a0, e32, m2, ta, ma
302 ; CHECK-NEXT: vfabs.v v10, v8
303 ; CHECK-NEXT: lui a0, 307200
304 ; CHECK-NEXT: fmv.w.x fa5, a0
305 ; CHECK-NEXT: vmflt.vf v0, v10, fa5
306 ; CHECK-NEXT: frflags a0
307 ; CHECK-NEXT: vfcvt.x.f.v v10, v8, v0.t
308 ; CHECK-NEXT: vfcvt.f.x.v v10, v10, v0.t
309 ; CHECK-NEXT: fsflags a0
310 ; CHECK-NEXT: vsetvli zero, zero, e32, m2, ta, mu
311 ; CHECK-NEXT: vfsgnj.vv v8, v10, v8, v0.t
313 %head = insertelement <8 x i1> poison, i1 true, i32 0
314 %m = shufflevector <8 x i1> %head, <8 x i1> poison, <8 x i32> zeroinitializer
315 %v = call <8 x float> @llvm.vp.nearbyint.v8f32(<8 x float> %va, <8 x i1> %m, i32 %evl)
319 declare <16 x float> @llvm.vp.nearbyint.v16f32(<16 x float>, <16 x i1>, i32)
321 define <16 x float> @vp_nearbyint_v16f32(<16 x float> %va, <16 x i1> %m, i32 zeroext %evl) {
322 ; CHECK-LABEL: vp_nearbyint_v16f32:
324 ; CHECK-NEXT: vmv1r.v v12, v0
325 ; CHECK-NEXT: vsetvli zero, a0, e32, m4, ta, ma
326 ; CHECK-NEXT: vfabs.v v16, v8, v0.t
327 ; CHECK-NEXT: lui a0, 307200
328 ; CHECK-NEXT: fmv.w.x fa5, a0
329 ; CHECK-NEXT: vsetvli zero, zero, e32, m4, ta, mu
330 ; CHECK-NEXT: vmflt.vf v12, v16, fa5, v0.t
331 ; CHECK-NEXT: frflags a0
332 ; CHECK-NEXT: vsetvli zero, zero, e32, m4, ta, ma
333 ; CHECK-NEXT: vmv1r.v v0, v12
334 ; CHECK-NEXT: vfcvt.x.f.v v16, v8, v0.t
335 ; CHECK-NEXT: vfcvt.f.x.v v16, v16, v0.t
336 ; CHECK-NEXT: fsflags a0
337 ; CHECK-NEXT: vsetvli zero, zero, e32, m4, ta, mu
338 ; CHECK-NEXT: vfsgnj.vv v8, v16, v8, v0.t
340 %v = call <16 x float> @llvm.vp.nearbyint.v16f32(<16 x float> %va, <16 x i1> %m, i32 %evl)
344 define <16 x float> @vp_nearbyint_v16f32_unmasked(<16 x float> %va, i32 zeroext %evl) {
345 ; CHECK-LABEL: vp_nearbyint_v16f32_unmasked:
347 ; CHECK-NEXT: vsetvli zero, a0, e32, m4, ta, ma
348 ; CHECK-NEXT: vfabs.v v12, v8
349 ; CHECK-NEXT: lui a0, 307200
350 ; CHECK-NEXT: fmv.w.x fa5, a0
351 ; CHECK-NEXT: vmflt.vf v0, v12, fa5
352 ; CHECK-NEXT: frflags a0
353 ; CHECK-NEXT: vfcvt.x.f.v v12, v8, v0.t
354 ; CHECK-NEXT: vfcvt.f.x.v v12, v12, v0.t
355 ; CHECK-NEXT: fsflags a0
356 ; CHECK-NEXT: vsetvli zero, zero, e32, m4, ta, mu
357 ; CHECK-NEXT: vfsgnj.vv v8, v12, v8, v0.t
359 %head = insertelement <16 x i1> poison, i1 true, i32 0
360 %m = shufflevector <16 x i1> %head, <16 x i1> poison, <16 x i32> zeroinitializer
361 %v = call <16 x float> @llvm.vp.nearbyint.v16f32(<16 x float> %va, <16 x i1> %m, i32 %evl)
365 declare <2 x double> @llvm.vp.nearbyint.v2f64(<2 x double>, <2 x i1>, i32)
367 define <2 x double> @vp_nearbyint_v2f64(<2 x double> %va, <2 x i1> %m, i32 zeroext %evl) {
368 ; CHECK-LABEL: vp_nearbyint_v2f64:
370 ; CHECK-NEXT: lui a1, %hi(.LCPI16_0)
371 ; CHECK-NEXT: fld fa5, %lo(.LCPI16_0)(a1)
372 ; CHECK-NEXT: vsetvli zero, a0, e64, m1, ta, ma
373 ; CHECK-NEXT: vfabs.v v9, v8, v0.t
374 ; CHECK-NEXT: vsetvli zero, zero, e64, m1, ta, mu
375 ; CHECK-NEXT: vmflt.vf v0, v9, fa5, v0.t
376 ; CHECK-NEXT: frflags a0
377 ; CHECK-NEXT: vsetvli zero, zero, e64, m1, ta, ma
378 ; CHECK-NEXT: vfcvt.x.f.v v9, v8, v0.t
379 ; CHECK-NEXT: vfcvt.f.x.v v9, v9, v0.t
380 ; CHECK-NEXT: fsflags a0
381 ; CHECK-NEXT: vsetvli zero, zero, e64, m1, ta, mu
382 ; CHECK-NEXT: vfsgnj.vv v8, v9, v8, v0.t
384 %v = call <2 x double> @llvm.vp.nearbyint.v2f64(<2 x double> %va, <2 x i1> %m, i32 %evl)
388 define <2 x double> @vp_nearbyint_v2f64_unmasked(<2 x double> %va, i32 zeroext %evl) {
389 ; CHECK-LABEL: vp_nearbyint_v2f64_unmasked:
391 ; CHECK-NEXT: lui a1, %hi(.LCPI17_0)
392 ; CHECK-NEXT: fld fa5, %lo(.LCPI17_0)(a1)
393 ; CHECK-NEXT: vsetvli zero, a0, e64, m1, ta, ma
394 ; CHECK-NEXT: vfabs.v v9, v8
395 ; CHECK-NEXT: vmflt.vf v0, v9, fa5
396 ; CHECK-NEXT: frflags a0
397 ; CHECK-NEXT: vfcvt.x.f.v v9, v8, v0.t
398 ; CHECK-NEXT: vfcvt.f.x.v v9, v9, v0.t
399 ; CHECK-NEXT: fsflags a0
400 ; CHECK-NEXT: vsetvli zero, zero, e64, m1, ta, mu
401 ; CHECK-NEXT: vfsgnj.vv v8, v9, v8, v0.t
403 %head = insertelement <2 x i1> poison, i1 true, i32 0
404 %m = shufflevector <2 x i1> %head, <2 x i1> poison, <2 x i32> zeroinitializer
405 %v = call <2 x double> @llvm.vp.nearbyint.v2f64(<2 x double> %va, <2 x i1> %m, i32 %evl)
409 declare <4 x double> @llvm.vp.nearbyint.v4f64(<4 x double>, <4 x i1>, i32)
411 define <4 x double> @vp_nearbyint_v4f64(<4 x double> %va, <4 x i1> %m, i32 zeroext %evl) {
412 ; CHECK-LABEL: vp_nearbyint_v4f64:
414 ; CHECK-NEXT: vmv1r.v v10, v0
415 ; CHECK-NEXT: lui a1, %hi(.LCPI18_0)
416 ; CHECK-NEXT: fld fa5, %lo(.LCPI18_0)(a1)
417 ; CHECK-NEXT: vsetvli zero, a0, e64, m2, ta, ma
418 ; CHECK-NEXT: vfabs.v v12, v8, v0.t
419 ; CHECK-NEXT: vsetvli zero, zero, e64, m2, ta, mu
420 ; CHECK-NEXT: vmflt.vf v10, v12, fa5, v0.t
421 ; CHECK-NEXT: frflags a0
422 ; CHECK-NEXT: vsetvli zero, zero, e64, m2, ta, ma
423 ; CHECK-NEXT: vmv1r.v v0, v10
424 ; CHECK-NEXT: vfcvt.x.f.v v12, v8, v0.t
425 ; CHECK-NEXT: vfcvt.f.x.v v12, v12, v0.t
426 ; CHECK-NEXT: fsflags a0
427 ; CHECK-NEXT: vsetvli zero, zero, e64, m2, ta, mu
428 ; CHECK-NEXT: vfsgnj.vv v8, v12, v8, v0.t
430 %v = call <4 x double> @llvm.vp.nearbyint.v4f64(<4 x double> %va, <4 x i1> %m, i32 %evl)
434 define <4 x double> @vp_nearbyint_v4f64_unmasked(<4 x double> %va, i32 zeroext %evl) {
435 ; CHECK-LABEL: vp_nearbyint_v4f64_unmasked:
437 ; CHECK-NEXT: lui a1, %hi(.LCPI19_0)
438 ; CHECK-NEXT: fld fa5, %lo(.LCPI19_0)(a1)
439 ; CHECK-NEXT: vsetvli zero, a0, e64, m2, ta, ma
440 ; CHECK-NEXT: vfabs.v v10, v8
441 ; CHECK-NEXT: vmflt.vf v0, v10, fa5
442 ; CHECK-NEXT: frflags a0
443 ; CHECK-NEXT: vfcvt.x.f.v v10, v8, v0.t
444 ; CHECK-NEXT: vfcvt.f.x.v v10, v10, v0.t
445 ; CHECK-NEXT: fsflags a0
446 ; CHECK-NEXT: vsetvli zero, zero, e64, m2, ta, mu
447 ; CHECK-NEXT: vfsgnj.vv v8, v10, v8, v0.t
449 %head = insertelement <4 x i1> poison, i1 true, i32 0
450 %m = shufflevector <4 x i1> %head, <4 x i1> poison, <4 x i32> zeroinitializer
451 %v = call <4 x double> @llvm.vp.nearbyint.v4f64(<4 x double> %va, <4 x i1> %m, i32 %evl)
455 declare <8 x double> @llvm.vp.nearbyint.v8f64(<8 x double>, <8 x i1>, i32)
457 define <8 x double> @vp_nearbyint_v8f64(<8 x double> %va, <8 x i1> %m, i32 zeroext %evl) {
458 ; CHECK-LABEL: vp_nearbyint_v8f64:
460 ; CHECK-NEXT: vmv1r.v v12, v0
461 ; CHECK-NEXT: lui a1, %hi(.LCPI20_0)
462 ; CHECK-NEXT: fld fa5, %lo(.LCPI20_0)(a1)
463 ; CHECK-NEXT: vsetvli zero, a0, e64, m4, ta, ma
464 ; CHECK-NEXT: vfabs.v v16, v8, v0.t
465 ; CHECK-NEXT: vsetvli zero, zero, e64, m4, ta, mu
466 ; CHECK-NEXT: vmflt.vf v12, v16, fa5, v0.t
467 ; CHECK-NEXT: frflags a0
468 ; CHECK-NEXT: vsetvli zero, zero, e64, m4, ta, ma
469 ; CHECK-NEXT: vmv1r.v v0, v12
470 ; CHECK-NEXT: vfcvt.x.f.v v16, v8, v0.t
471 ; CHECK-NEXT: vfcvt.f.x.v v16, v16, v0.t
472 ; CHECK-NEXT: fsflags a0
473 ; CHECK-NEXT: vsetvli zero, zero, e64, m4, ta, mu
474 ; CHECK-NEXT: vfsgnj.vv v8, v16, v8, v0.t
476 %v = call <8 x double> @llvm.vp.nearbyint.v8f64(<8 x double> %va, <8 x i1> %m, i32 %evl)
480 define <8 x double> @vp_nearbyint_v8f64_unmasked(<8 x double> %va, i32 zeroext %evl) {
481 ; CHECK-LABEL: vp_nearbyint_v8f64_unmasked:
483 ; CHECK-NEXT: lui a1, %hi(.LCPI21_0)
484 ; CHECK-NEXT: fld fa5, %lo(.LCPI21_0)(a1)
485 ; CHECK-NEXT: vsetvli zero, a0, e64, m4, ta, ma
486 ; CHECK-NEXT: vfabs.v v12, v8
487 ; CHECK-NEXT: vmflt.vf v0, v12, fa5
488 ; CHECK-NEXT: frflags a0
489 ; CHECK-NEXT: vfcvt.x.f.v v12, v8, v0.t
490 ; CHECK-NEXT: vfcvt.f.x.v v12, v12, v0.t
491 ; CHECK-NEXT: fsflags a0
492 ; CHECK-NEXT: vsetvli zero, zero, e64, m4, ta, mu
493 ; CHECK-NEXT: vfsgnj.vv v8, v12, v8, v0.t
495 %head = insertelement <8 x i1> poison, i1 true, i32 0
496 %m = shufflevector <8 x i1> %head, <8 x i1> poison, <8 x i32> zeroinitializer
497 %v = call <8 x double> @llvm.vp.nearbyint.v8f64(<8 x double> %va, <8 x i1> %m, i32 %evl)
501 declare <15 x double> @llvm.vp.nearbyint.v15f64(<15 x double>, <15 x i1>, i32)
503 define <15 x double> @vp_nearbyint_v15f64(<15 x double> %va, <15 x i1> %m, i32 zeroext %evl) {
504 ; CHECK-LABEL: vp_nearbyint_v15f64:
506 ; CHECK-NEXT: vmv1r.v v16, v0
507 ; CHECK-NEXT: lui a1, %hi(.LCPI22_0)
508 ; CHECK-NEXT: fld fa5, %lo(.LCPI22_0)(a1)
509 ; CHECK-NEXT: vsetvli zero, a0, e64, m8, ta, ma
510 ; CHECK-NEXT: vfabs.v v24, v8, v0.t
511 ; CHECK-NEXT: vsetvli zero, zero, e64, m8, ta, mu
512 ; CHECK-NEXT: vmflt.vf v16, v24, fa5, v0.t
513 ; CHECK-NEXT: frflags a0
514 ; CHECK-NEXT: vsetvli zero, zero, e64, m8, ta, ma
515 ; CHECK-NEXT: vmv1r.v v0, v16
516 ; CHECK-NEXT: vfcvt.x.f.v v24, v8, v0.t
517 ; CHECK-NEXT: vfcvt.f.x.v v24, v24, v0.t
518 ; CHECK-NEXT: fsflags a0
519 ; CHECK-NEXT: vsetvli zero, zero, e64, m8, ta, mu
520 ; CHECK-NEXT: vfsgnj.vv v8, v24, v8, v0.t
522 %v = call <15 x double> @llvm.vp.nearbyint.v15f64(<15 x double> %va, <15 x i1> %m, i32 %evl)
526 define <15 x double> @vp_nearbyint_v15f64_unmasked(<15 x double> %va, i32 zeroext %evl) {
527 ; CHECK-LABEL: vp_nearbyint_v15f64_unmasked:
529 ; CHECK-NEXT: lui a1, %hi(.LCPI23_0)
530 ; CHECK-NEXT: fld fa5, %lo(.LCPI23_0)(a1)
531 ; CHECK-NEXT: vsetvli zero, a0, e64, m8, ta, ma
532 ; CHECK-NEXT: vfabs.v v16, v8
533 ; CHECK-NEXT: vmflt.vf v0, v16, fa5
534 ; CHECK-NEXT: frflags a0
535 ; CHECK-NEXT: vfcvt.x.f.v v16, v8, v0.t
536 ; CHECK-NEXT: vfcvt.f.x.v v16, v16, v0.t
537 ; CHECK-NEXT: fsflags a0
538 ; CHECK-NEXT: vsetvli zero, zero, e64, m8, ta, mu
539 ; CHECK-NEXT: vfsgnj.vv v8, v16, v8, v0.t
541 %head = insertelement <15 x i1> poison, i1 true, i32 0
542 %m = shufflevector <15 x i1> %head, <15 x i1> poison, <15 x i32> zeroinitializer
543 %v = call <15 x double> @llvm.vp.nearbyint.v15f64(<15 x double> %va, <15 x i1> %m, i32 %evl)
547 declare <16 x double> @llvm.vp.nearbyint.v16f64(<16 x double>, <16 x i1>, i32)
549 define <16 x double> @vp_nearbyint_v16f64(<16 x double> %va, <16 x i1> %m, i32 zeroext %evl) {
550 ; CHECK-LABEL: vp_nearbyint_v16f64:
552 ; CHECK-NEXT: vmv1r.v v16, v0
553 ; CHECK-NEXT: lui a1, %hi(.LCPI24_0)
554 ; CHECK-NEXT: fld fa5, %lo(.LCPI24_0)(a1)
555 ; CHECK-NEXT: vsetvli zero, a0, e64, m8, ta, ma
556 ; CHECK-NEXT: vfabs.v v24, v8, v0.t
557 ; CHECK-NEXT: vsetvli zero, zero, e64, m8, ta, mu
558 ; CHECK-NEXT: vmflt.vf v16, v24, fa5, v0.t
559 ; CHECK-NEXT: frflags a0
560 ; CHECK-NEXT: vsetvli zero, zero, e64, m8, ta, ma
561 ; CHECK-NEXT: vmv1r.v v0, v16
562 ; CHECK-NEXT: vfcvt.x.f.v v24, v8, v0.t
563 ; CHECK-NEXT: vfcvt.f.x.v v24, v24, v0.t
564 ; CHECK-NEXT: fsflags a0
565 ; CHECK-NEXT: vsetvli zero, zero, e64, m8, ta, mu
566 ; CHECK-NEXT: vfsgnj.vv v8, v24, v8, v0.t
568 %v = call <16 x double> @llvm.vp.nearbyint.v16f64(<16 x double> %va, <16 x i1> %m, i32 %evl)
572 define <16 x double> @vp_nearbyint_v16f64_unmasked(<16 x double> %va, i32 zeroext %evl) {
573 ; CHECK-LABEL: vp_nearbyint_v16f64_unmasked:
575 ; CHECK-NEXT: lui a1, %hi(.LCPI25_0)
576 ; CHECK-NEXT: fld fa5, %lo(.LCPI25_0)(a1)
577 ; CHECK-NEXT: vsetvli zero, a0, e64, m8, ta, ma
578 ; CHECK-NEXT: vfabs.v v16, v8
579 ; CHECK-NEXT: vmflt.vf v0, v16, fa5
580 ; CHECK-NEXT: frflags a0
581 ; CHECK-NEXT: vfcvt.x.f.v v16, v8, v0.t
582 ; CHECK-NEXT: vfcvt.f.x.v v16, v16, v0.t
583 ; CHECK-NEXT: fsflags a0
584 ; CHECK-NEXT: vsetvli zero, zero, e64, m8, ta, mu
585 ; CHECK-NEXT: vfsgnj.vv v8, v16, v8, v0.t
587 %head = insertelement <16 x i1> poison, i1 true, i32 0
588 %m = shufflevector <16 x i1> %head, <16 x i1> poison, <16 x i32> zeroinitializer
589 %v = call <16 x double> @llvm.vp.nearbyint.v16f64(<16 x double> %va, <16 x i1> %m, i32 %evl)
593 declare <32 x double> @llvm.vp.nearbyint.v32f64(<32 x double>, <32 x i1>, i32)
595 define <32 x double> @vp_nearbyint_v32f64(<32 x double> %va, <32 x i1> %m, i32 zeroext %evl) {
596 ; CHECK-LABEL: vp_nearbyint_v32f64:
598 ; CHECK-NEXT: addi sp, sp, -16
599 ; CHECK-NEXT: .cfi_def_cfa_offset 16
600 ; CHECK-NEXT: csrr a1, vlenb
601 ; CHECK-NEXT: slli a1, a1, 3
602 ; CHECK-NEXT: sub sp, sp, a1
603 ; CHECK-NEXT: .cfi_escape 0x0f, 0x0d, 0x72, 0x00, 0x11, 0x10, 0x22, 0x11, 0x08, 0x92, 0xa2, 0x38, 0x00, 0x1e, 0x22 # sp + 16 + 8 * vlenb
604 ; CHECK-NEXT: vmv1r.v v25, v0
605 ; CHECK-NEXT: addi a1, sp, 16
606 ; CHECK-NEXT: vs8r.v v16, (a1) # Unknown-size Folded Spill
607 ; CHECK-NEXT: vsetivli zero, 2, e8, mf4, ta, ma
608 ; CHECK-NEXT: li a2, 16
609 ; CHECK-NEXT: vslidedown.vi v1, v0, 2
610 ; CHECK-NEXT: mv a1, a0
611 ; CHECK-NEXT: bltu a0, a2, .LBB26_2
612 ; CHECK-NEXT: # %bb.1:
613 ; CHECK-NEXT: li a1, 16
614 ; CHECK-NEXT: .LBB26_2:
615 ; CHECK-NEXT: lui a2, %hi(.LCPI26_0)
616 ; CHECK-NEXT: fld fa5, %lo(.LCPI26_0)(a2)
617 ; CHECK-NEXT: vsetvli zero, a1, e64, m8, ta, ma
618 ; CHECK-NEXT: vmv1r.v v0, v25
619 ; CHECK-NEXT: vfabs.v v16, v8, v0.t
620 ; CHECK-NEXT: vsetvli zero, zero, e64, m8, ta, mu
621 ; CHECK-NEXT: vmflt.vf v25, v16, fa5, v0.t
622 ; CHECK-NEXT: frflags a1
623 ; CHECK-NEXT: vsetvli zero, zero, e64, m8, ta, ma
624 ; CHECK-NEXT: vmv1r.v v0, v25
625 ; CHECK-NEXT: vfcvt.x.f.v v16, v8, v0.t
626 ; CHECK-NEXT: vfcvt.f.x.v v16, v16, v0.t
627 ; CHECK-NEXT: fsflags a1
628 ; CHECK-NEXT: vsetvli zero, zero, e64, m8, ta, mu
629 ; CHECK-NEXT: vfsgnj.vv v8, v16, v8, v0.t
630 ; CHECK-NEXT: addi a1, a0, -16
631 ; CHECK-NEXT: sltu a0, a0, a1
632 ; CHECK-NEXT: addi a0, a0, -1
633 ; CHECK-NEXT: and a0, a0, a1
634 ; CHECK-NEXT: vsetvli zero, a0, e64, m8, ta, ma
635 ; CHECK-NEXT: vmv1r.v v0, v1
636 ; CHECK-NEXT: addi a0, sp, 16
637 ; CHECK-NEXT: vl8r.v v24, (a0) # Unknown-size Folded Reload
638 ; CHECK-NEXT: vfabs.v v16, v24, v0.t
639 ; CHECK-NEXT: vsetvli zero, zero, e64, m8, ta, mu
640 ; CHECK-NEXT: vmv1r.v v0, v1
641 ; CHECK-NEXT: vmflt.vf v1, v16, fa5, v0.t
642 ; CHECK-NEXT: frflags a0
643 ; CHECK-NEXT: vsetvli zero, zero, e64, m8, ta, ma
644 ; CHECK-NEXT: vmv1r.v v0, v1
645 ; CHECK-NEXT: vfcvt.x.f.v v16, v24, v0.t
646 ; CHECK-NEXT: vfcvt.f.x.v v16, v16, v0.t
647 ; CHECK-NEXT: fsflags a0
648 ; CHECK-NEXT: vsetvli zero, zero, e64, m8, ta, mu
649 ; CHECK-NEXT: vfsgnj.vv v24, v16, v24, v0.t
650 ; CHECK-NEXT: vmv.v.v v16, v24
651 ; CHECK-NEXT: csrr a0, vlenb
652 ; CHECK-NEXT: slli a0, a0, 3
653 ; CHECK-NEXT: add sp, sp, a0
654 ; CHECK-NEXT: addi sp, sp, 16
656 %v = call <32 x double> @llvm.vp.nearbyint.v32f64(<32 x double> %va, <32 x i1> %m, i32 %evl)
660 define <32 x double> @vp_nearbyint_v32f64_unmasked(<32 x double> %va, i32 zeroext %evl) {
661 ; CHECK-LABEL: vp_nearbyint_v32f64_unmasked:
663 ; CHECK-NEXT: li a2, 16
664 ; CHECK-NEXT: mv a1, a0
665 ; CHECK-NEXT: bltu a0, a2, .LBB27_2
666 ; CHECK-NEXT: # %bb.1:
667 ; CHECK-NEXT: li a1, 16
668 ; CHECK-NEXT: .LBB27_2:
669 ; CHECK-NEXT: lui a2, %hi(.LCPI27_0)
670 ; CHECK-NEXT: fld fa5, %lo(.LCPI27_0)(a2)
671 ; CHECK-NEXT: vsetvli zero, a1, e64, m8, ta, ma
672 ; CHECK-NEXT: vfabs.v v24, v8
673 ; CHECK-NEXT: vmflt.vf v0, v24, fa5
674 ; CHECK-NEXT: frflags a1
675 ; CHECK-NEXT: vfcvt.x.f.v v24, v8, v0.t
676 ; CHECK-NEXT: vfcvt.f.x.v v24, v24, v0.t
677 ; CHECK-NEXT: fsflags a1
678 ; CHECK-NEXT: vsetvli zero, zero, e64, m8, ta, mu
679 ; CHECK-NEXT: vfsgnj.vv v8, v24, v8, v0.t
680 ; CHECK-NEXT: addi a1, a0, -16
681 ; CHECK-NEXT: sltu a0, a0, a1
682 ; CHECK-NEXT: addi a0, a0, -1
683 ; CHECK-NEXT: and a0, a0, a1
684 ; CHECK-NEXT: vsetvli zero, a0, e64, m8, ta, ma
685 ; CHECK-NEXT: vfabs.v v24, v16
686 ; CHECK-NEXT: vmflt.vf v0, v24, fa5
687 ; CHECK-NEXT: frflags a0
688 ; CHECK-NEXT: vfcvt.x.f.v v24, v16, v0.t
689 ; CHECK-NEXT: vfcvt.f.x.v v24, v24, v0.t
690 ; CHECK-NEXT: fsflags a0
691 ; CHECK-NEXT: vsetvli zero, zero, e64, m8, ta, mu
692 ; CHECK-NEXT: vfsgnj.vv v16, v24, v16, v0.t
694 %head = insertelement <32 x i1> poison, i1 true, i32 0
695 %m = shufflevector <32 x i1> %head, <32 x i1> poison, <32 x i32> zeroinitializer
696 %v = call <32 x double> @llvm.vp.nearbyint.v32f64(<32 x double> %va, <32 x i1> %m, i32 %evl)