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,+zfhmin,+zvfhmin,+v -target-abi=ilp32d \
7 ; RUN: -verify-machineinstrs < %s | FileCheck %s --check-prefixes=CHECK,ZVFHMIN
8 ; RUN: llc -mtriple=riscv64 -mattr=+d,+zfhmin,+zvfhmin,+v -target-abi=lp64d \
9 ; RUN: -verify-machineinstrs < %s | FileCheck %s --check-prefixes=CHECK,ZVFHMIN
11 declare <vscale x 1 x half> @llvm.vp.nearbyint.nxv1f16(<vscale x 1 x half>, <vscale x 1 x i1>, i32)
13 define <vscale x 1 x half> @vp_nearbyint_nxv1f16(<vscale x 1 x half> %va, <vscale x 1 x i1> %m, i32 zeroext %evl) {
14 ; ZVFH-LABEL: vp_nearbyint_nxv1f16:
16 ; ZVFH-NEXT: lui a1, %hi(.LCPI0_0)
17 ; ZVFH-NEXT: flh fa5, %lo(.LCPI0_0)(a1)
18 ; ZVFH-NEXT: vsetvli zero, a0, e16, mf4, ta, ma
19 ; ZVFH-NEXT: vfabs.v v9, v8, v0.t
20 ; ZVFH-NEXT: vsetvli zero, zero, e16, mf4, ta, mu
21 ; ZVFH-NEXT: vmflt.vf v0, v9, fa5, v0.t
22 ; ZVFH-NEXT: frflags a0
23 ; ZVFH-NEXT: vsetvli zero, zero, e16, mf4, ta, ma
24 ; ZVFH-NEXT: vfcvt.x.f.v v9, v8, v0.t
25 ; ZVFH-NEXT: vfcvt.f.x.v v9, v9, v0.t
26 ; ZVFH-NEXT: fsflags a0
27 ; ZVFH-NEXT: vsetvli zero, zero, e16, mf4, ta, mu
28 ; ZVFH-NEXT: vfsgnj.vv v8, v9, v8, v0.t
31 ; ZVFHMIN-LABEL: vp_nearbyint_nxv1f16:
33 ; ZVFHMIN-NEXT: vsetvli a1, zero, e16, mf4, ta, ma
34 ; ZVFHMIN-NEXT: vfwcvt.f.f.v v9, v8
35 ; ZVFHMIN-NEXT: vsetvli zero, a0, e32, mf2, ta, ma
36 ; ZVFHMIN-NEXT: vfabs.v v8, v9, v0.t
37 ; ZVFHMIN-NEXT: lui a0, 307200
38 ; ZVFHMIN-NEXT: fmv.w.x fa5, a0
39 ; ZVFHMIN-NEXT: vsetvli zero, zero, e32, mf2, ta, mu
40 ; ZVFHMIN-NEXT: vmflt.vf v0, v8, fa5, v0.t
41 ; ZVFHMIN-NEXT: frflags a0
42 ; ZVFHMIN-NEXT: vsetvli zero, zero, e32, mf2, ta, ma
43 ; ZVFHMIN-NEXT: vfcvt.x.f.v v8, v9, v0.t
44 ; ZVFHMIN-NEXT: vfcvt.f.x.v v8, v8, v0.t
45 ; ZVFHMIN-NEXT: fsflags a0
46 ; ZVFHMIN-NEXT: vsetvli zero, zero, e32, mf2, ta, mu
47 ; ZVFHMIN-NEXT: vfsgnj.vv v9, v8, v9, v0.t
48 ; ZVFHMIN-NEXT: vsetvli a0, zero, e16, mf4, ta, ma
49 ; ZVFHMIN-NEXT: vfncvt.f.f.w v8, v9
51 %v = call <vscale x 1 x half> @llvm.vp.nearbyint.nxv1f16(<vscale x 1 x half> %va, <vscale x 1 x i1> %m, i32 %evl)
52 ret <vscale x 1 x half> %v
55 define <vscale x 1 x half> @vp_nearbyint_nxv1f16_unmasked(<vscale x 1 x half> %va, i32 zeroext %evl) {
56 ; ZVFH-LABEL: vp_nearbyint_nxv1f16_unmasked:
58 ; ZVFH-NEXT: lui a1, %hi(.LCPI1_0)
59 ; ZVFH-NEXT: flh fa5, %lo(.LCPI1_0)(a1)
60 ; ZVFH-NEXT: vsetvli zero, a0, e16, mf4, ta, ma
61 ; ZVFH-NEXT: vfabs.v v9, v8
62 ; ZVFH-NEXT: vmflt.vf v0, v9, fa5
63 ; ZVFH-NEXT: frflags a0
64 ; ZVFH-NEXT: vfcvt.x.f.v v9, v8, v0.t
65 ; ZVFH-NEXT: vfcvt.f.x.v v9, v9, v0.t
66 ; ZVFH-NEXT: fsflags a0
67 ; ZVFH-NEXT: vsetvli zero, zero, e16, mf4, ta, mu
68 ; ZVFH-NEXT: vfsgnj.vv v8, v9, v8, v0.t
71 ; ZVFHMIN-LABEL: vp_nearbyint_nxv1f16_unmasked:
73 ; ZVFHMIN-NEXT: vsetvli a1, zero, e16, mf4, ta, ma
74 ; ZVFHMIN-NEXT: vfwcvt.f.f.v v9, v8
75 ; ZVFHMIN-NEXT: vsetvli zero, a0, e32, mf2, ta, ma
76 ; ZVFHMIN-NEXT: vfabs.v v8, v9
77 ; ZVFHMIN-NEXT: lui a0, 307200
78 ; ZVFHMIN-NEXT: fmv.w.x fa5, a0
79 ; ZVFHMIN-NEXT: vmflt.vf v0, v8, fa5
80 ; ZVFHMIN-NEXT: frflags a0
81 ; ZVFHMIN-NEXT: vfcvt.x.f.v v8, v9, v0.t
82 ; ZVFHMIN-NEXT: vfcvt.f.x.v v8, v8, v0.t
83 ; ZVFHMIN-NEXT: fsflags a0
84 ; ZVFHMIN-NEXT: vsetvli zero, zero, e32, mf2, ta, mu
85 ; ZVFHMIN-NEXT: vfsgnj.vv v9, v8, v9, v0.t
86 ; ZVFHMIN-NEXT: vsetvli a0, zero, e16, mf4, ta, ma
87 ; ZVFHMIN-NEXT: vfncvt.f.f.w v8, v9
89 %head = insertelement <vscale x 1 x i1> poison, i1 true, i32 0
90 %m = shufflevector <vscale x 1 x i1> %head, <vscale x 1 x i1> poison, <vscale x 1 x i32> zeroinitializer
91 %v = call <vscale x 1 x half> @llvm.vp.nearbyint.nxv1f16(<vscale x 1 x half> %va, <vscale x 1 x i1> %m, i32 %evl)
92 ret <vscale x 1 x half> %v
95 declare <vscale x 2 x half> @llvm.vp.nearbyint.nxv2f16(<vscale x 2 x half>, <vscale x 2 x i1>, i32)
97 define <vscale x 2 x half> @vp_nearbyint_nxv2f16(<vscale x 2 x half> %va, <vscale x 2 x i1> %m, i32 zeroext %evl) {
98 ; ZVFH-LABEL: vp_nearbyint_nxv2f16:
100 ; ZVFH-NEXT: lui a1, %hi(.LCPI2_0)
101 ; ZVFH-NEXT: flh fa5, %lo(.LCPI2_0)(a1)
102 ; ZVFH-NEXT: vsetvli zero, a0, e16, mf2, ta, ma
103 ; ZVFH-NEXT: vfabs.v v9, v8, v0.t
104 ; ZVFH-NEXT: vsetvli zero, zero, e16, mf2, ta, mu
105 ; ZVFH-NEXT: vmflt.vf v0, v9, fa5, v0.t
106 ; ZVFH-NEXT: frflags a0
107 ; ZVFH-NEXT: vsetvli zero, zero, e16, mf2, ta, ma
108 ; ZVFH-NEXT: vfcvt.x.f.v v9, v8, v0.t
109 ; ZVFH-NEXT: vfcvt.f.x.v v9, v9, v0.t
110 ; ZVFH-NEXT: fsflags a0
111 ; ZVFH-NEXT: vsetvli zero, zero, e16, mf2, ta, mu
112 ; ZVFH-NEXT: vfsgnj.vv v8, v9, v8, v0.t
115 ; ZVFHMIN-LABEL: vp_nearbyint_nxv2f16:
117 ; ZVFHMIN-NEXT: vsetvli a1, zero, e16, mf2, ta, ma
118 ; ZVFHMIN-NEXT: vfwcvt.f.f.v v9, v8
119 ; ZVFHMIN-NEXT: vsetvli zero, a0, e32, m1, ta, ma
120 ; ZVFHMIN-NEXT: vfabs.v v8, v9, v0.t
121 ; ZVFHMIN-NEXT: lui a0, 307200
122 ; ZVFHMIN-NEXT: fmv.w.x fa5, a0
123 ; ZVFHMIN-NEXT: vsetvli zero, zero, e32, m1, ta, mu
124 ; ZVFHMIN-NEXT: vmflt.vf v0, v8, fa5, v0.t
125 ; ZVFHMIN-NEXT: frflags a0
126 ; ZVFHMIN-NEXT: vsetvli zero, zero, e32, m1, ta, ma
127 ; ZVFHMIN-NEXT: vfcvt.x.f.v v8, v9, v0.t
128 ; ZVFHMIN-NEXT: vfcvt.f.x.v v8, v8, v0.t
129 ; ZVFHMIN-NEXT: fsflags a0
130 ; ZVFHMIN-NEXT: vsetvli zero, zero, e32, m1, ta, mu
131 ; ZVFHMIN-NEXT: vfsgnj.vv v9, v8, v9, v0.t
132 ; ZVFHMIN-NEXT: vsetvli a0, zero, e16, mf2, ta, ma
133 ; ZVFHMIN-NEXT: vfncvt.f.f.w v8, v9
135 %v = call <vscale x 2 x half> @llvm.vp.nearbyint.nxv2f16(<vscale x 2 x half> %va, <vscale x 2 x i1> %m, i32 %evl)
136 ret <vscale x 2 x half> %v
139 define <vscale x 2 x half> @vp_nearbyint_nxv2f16_unmasked(<vscale x 2 x half> %va, i32 zeroext %evl) {
140 ; ZVFH-LABEL: vp_nearbyint_nxv2f16_unmasked:
142 ; ZVFH-NEXT: lui a1, %hi(.LCPI3_0)
143 ; ZVFH-NEXT: flh fa5, %lo(.LCPI3_0)(a1)
144 ; ZVFH-NEXT: vsetvli zero, a0, e16, mf2, ta, ma
145 ; ZVFH-NEXT: vfabs.v v9, v8
146 ; ZVFH-NEXT: vmflt.vf v0, v9, fa5
147 ; ZVFH-NEXT: frflags a0
148 ; ZVFH-NEXT: vfcvt.x.f.v v9, v8, v0.t
149 ; ZVFH-NEXT: vfcvt.f.x.v v9, v9, v0.t
150 ; ZVFH-NEXT: fsflags a0
151 ; ZVFH-NEXT: vsetvli zero, zero, e16, mf2, ta, mu
152 ; ZVFH-NEXT: vfsgnj.vv v8, v9, v8, v0.t
155 ; ZVFHMIN-LABEL: vp_nearbyint_nxv2f16_unmasked:
157 ; ZVFHMIN-NEXT: vsetvli a1, zero, e16, mf2, ta, ma
158 ; ZVFHMIN-NEXT: vfwcvt.f.f.v v9, v8
159 ; ZVFHMIN-NEXT: vsetvli zero, a0, e32, m1, ta, ma
160 ; ZVFHMIN-NEXT: vfabs.v v8, v9
161 ; ZVFHMIN-NEXT: lui a0, 307200
162 ; ZVFHMIN-NEXT: fmv.w.x fa5, a0
163 ; ZVFHMIN-NEXT: vmflt.vf v0, v8, fa5
164 ; ZVFHMIN-NEXT: frflags a0
165 ; ZVFHMIN-NEXT: vfcvt.x.f.v v8, v9, v0.t
166 ; ZVFHMIN-NEXT: vfcvt.f.x.v v8, v8, v0.t
167 ; ZVFHMIN-NEXT: fsflags a0
168 ; ZVFHMIN-NEXT: vsetvli zero, zero, e32, m1, ta, mu
169 ; ZVFHMIN-NEXT: vfsgnj.vv v9, v8, v9, v0.t
170 ; ZVFHMIN-NEXT: vsetvli a0, zero, e16, mf2, ta, ma
171 ; ZVFHMIN-NEXT: vfncvt.f.f.w v8, v9
173 %head = insertelement <vscale x 2 x i1> poison, i1 true, i32 0
174 %m = shufflevector <vscale x 2 x i1> %head, <vscale x 2 x i1> poison, <vscale x 2 x i32> zeroinitializer
175 %v = call <vscale x 2 x half> @llvm.vp.nearbyint.nxv2f16(<vscale x 2 x half> %va, <vscale x 2 x i1> %m, i32 %evl)
176 ret <vscale x 2 x half> %v
179 declare <vscale x 4 x half> @llvm.vp.nearbyint.nxv4f16(<vscale x 4 x half>, <vscale x 4 x i1>, i32)
181 define <vscale x 4 x half> @vp_nearbyint_nxv4f16(<vscale x 4 x half> %va, <vscale x 4 x i1> %m, i32 zeroext %evl) {
182 ; ZVFH-LABEL: vp_nearbyint_nxv4f16:
184 ; ZVFH-NEXT: lui a1, %hi(.LCPI4_0)
185 ; ZVFH-NEXT: flh fa5, %lo(.LCPI4_0)(a1)
186 ; ZVFH-NEXT: vsetvli zero, a0, e16, m1, ta, ma
187 ; ZVFH-NEXT: vfabs.v v9, v8, v0.t
188 ; ZVFH-NEXT: vsetvli zero, zero, e16, m1, ta, mu
189 ; ZVFH-NEXT: vmflt.vf v0, v9, fa5, v0.t
190 ; ZVFH-NEXT: frflags a0
191 ; ZVFH-NEXT: vsetvli zero, zero, e16, m1, ta, ma
192 ; ZVFH-NEXT: vfcvt.x.f.v v9, v8, v0.t
193 ; ZVFH-NEXT: vfcvt.f.x.v v9, v9, v0.t
194 ; ZVFH-NEXT: fsflags a0
195 ; ZVFH-NEXT: vsetvli zero, zero, e16, m1, ta, mu
196 ; ZVFH-NEXT: vfsgnj.vv v8, v9, v8, v0.t
199 ; ZVFHMIN-LABEL: vp_nearbyint_nxv4f16:
201 ; ZVFHMIN-NEXT: vmv1r.v v9, v0
202 ; ZVFHMIN-NEXT: vsetvli a1, zero, e16, m1, ta, ma
203 ; ZVFHMIN-NEXT: vfwcvt.f.f.v v10, v8
204 ; ZVFHMIN-NEXT: vsetvli zero, a0, e32, m2, ta, ma
205 ; ZVFHMIN-NEXT: vfabs.v v12, v10, v0.t
206 ; ZVFHMIN-NEXT: lui a0, 307200
207 ; ZVFHMIN-NEXT: fmv.w.x fa5, a0
208 ; ZVFHMIN-NEXT: vsetvli zero, zero, e32, m2, ta, mu
209 ; ZVFHMIN-NEXT: vmflt.vf v9, v12, fa5, v0.t
210 ; ZVFHMIN-NEXT: frflags a0
211 ; ZVFHMIN-NEXT: vsetvli zero, zero, e32, m2, ta, ma
212 ; ZVFHMIN-NEXT: vmv1r.v v0, v9
213 ; ZVFHMIN-NEXT: vfcvt.x.f.v v12, v10, v0.t
214 ; ZVFHMIN-NEXT: vfcvt.f.x.v v12, v12, v0.t
215 ; ZVFHMIN-NEXT: fsflags a0
216 ; ZVFHMIN-NEXT: vsetvli zero, zero, e32, m2, ta, mu
217 ; ZVFHMIN-NEXT: vfsgnj.vv v10, v12, v10, v0.t
218 ; ZVFHMIN-NEXT: vsetvli a0, zero, e16, m1, ta, ma
219 ; ZVFHMIN-NEXT: vfncvt.f.f.w v8, v10
221 %v = call <vscale x 4 x half> @llvm.vp.nearbyint.nxv4f16(<vscale x 4 x half> %va, <vscale x 4 x i1> %m, i32 %evl)
222 ret <vscale x 4 x half> %v
225 define <vscale x 4 x half> @vp_nearbyint_nxv4f16_unmasked(<vscale x 4 x half> %va, i32 zeroext %evl) {
226 ; ZVFH-LABEL: vp_nearbyint_nxv4f16_unmasked:
228 ; ZVFH-NEXT: lui a1, %hi(.LCPI5_0)
229 ; ZVFH-NEXT: flh fa5, %lo(.LCPI5_0)(a1)
230 ; ZVFH-NEXT: vsetvli zero, a0, e16, m1, ta, ma
231 ; ZVFH-NEXT: vfabs.v v9, v8
232 ; ZVFH-NEXT: vmflt.vf v0, v9, fa5
233 ; ZVFH-NEXT: frflags a0
234 ; ZVFH-NEXT: vfcvt.x.f.v v9, v8, v0.t
235 ; ZVFH-NEXT: vfcvt.f.x.v v9, v9, v0.t
236 ; ZVFH-NEXT: fsflags a0
237 ; ZVFH-NEXT: vsetvli zero, zero, e16, m1, ta, mu
238 ; ZVFH-NEXT: vfsgnj.vv v8, v9, v8, v0.t
241 ; ZVFHMIN-LABEL: vp_nearbyint_nxv4f16_unmasked:
243 ; ZVFHMIN-NEXT: vsetvli a1, zero, e16, m1, ta, ma
244 ; ZVFHMIN-NEXT: vfwcvt.f.f.v v10, v8
245 ; ZVFHMIN-NEXT: vsetvli zero, a0, e32, m2, ta, ma
246 ; ZVFHMIN-NEXT: vfabs.v v8, v10
247 ; ZVFHMIN-NEXT: lui a0, 307200
248 ; ZVFHMIN-NEXT: fmv.w.x fa5, a0
249 ; ZVFHMIN-NEXT: vmflt.vf v0, v8, fa5
250 ; ZVFHMIN-NEXT: frflags a0
251 ; ZVFHMIN-NEXT: vfcvt.x.f.v v8, v10, v0.t
252 ; ZVFHMIN-NEXT: vfcvt.f.x.v v8, v8, v0.t
253 ; ZVFHMIN-NEXT: fsflags a0
254 ; ZVFHMIN-NEXT: vsetvli zero, zero, e32, m2, ta, mu
255 ; ZVFHMIN-NEXT: vfsgnj.vv v10, v8, v10, v0.t
256 ; ZVFHMIN-NEXT: vsetvli a0, zero, e16, m1, ta, ma
257 ; ZVFHMIN-NEXT: vfncvt.f.f.w v8, v10
259 %head = insertelement <vscale x 4 x i1> poison, i1 true, i32 0
260 %m = shufflevector <vscale x 4 x i1> %head, <vscale x 4 x i1> poison, <vscale x 4 x i32> zeroinitializer
261 %v = call <vscale x 4 x half> @llvm.vp.nearbyint.nxv4f16(<vscale x 4 x half> %va, <vscale x 4 x i1> %m, i32 %evl)
262 ret <vscale x 4 x half> %v
265 declare <vscale x 8 x half> @llvm.vp.nearbyint.nxv8f16(<vscale x 8 x half>, <vscale x 8 x i1>, i32)
267 define <vscale x 8 x half> @vp_nearbyint_nxv8f16(<vscale x 8 x half> %va, <vscale x 8 x i1> %m, i32 zeroext %evl) {
268 ; ZVFH-LABEL: vp_nearbyint_nxv8f16:
270 ; ZVFH-NEXT: vmv1r.v v10, v0
271 ; ZVFH-NEXT: lui a1, %hi(.LCPI6_0)
272 ; ZVFH-NEXT: flh fa5, %lo(.LCPI6_0)(a1)
273 ; ZVFH-NEXT: vsetvli zero, a0, e16, m2, ta, ma
274 ; ZVFH-NEXT: vfabs.v v12, v8, v0.t
275 ; ZVFH-NEXT: vsetvli zero, zero, e16, m2, ta, mu
276 ; ZVFH-NEXT: vmflt.vf v10, v12, fa5, v0.t
277 ; ZVFH-NEXT: frflags a0
278 ; ZVFH-NEXT: vsetvli zero, zero, e16, m2, ta, ma
279 ; ZVFH-NEXT: vmv1r.v v0, v10
280 ; ZVFH-NEXT: vfcvt.x.f.v v12, v8, v0.t
281 ; ZVFH-NEXT: vfcvt.f.x.v v12, v12, v0.t
282 ; ZVFH-NEXT: fsflags a0
283 ; ZVFH-NEXT: vsetvli zero, zero, e16, m2, ta, mu
284 ; ZVFH-NEXT: vfsgnj.vv v8, v12, v8, v0.t
287 ; ZVFHMIN-LABEL: vp_nearbyint_nxv8f16:
289 ; ZVFHMIN-NEXT: vmv1r.v v10, v0
290 ; ZVFHMIN-NEXT: vsetvli a1, zero, e16, m2, ta, ma
291 ; ZVFHMIN-NEXT: vfwcvt.f.f.v v12, v8
292 ; ZVFHMIN-NEXT: vsetvli zero, a0, e32, m4, ta, ma
293 ; ZVFHMIN-NEXT: vfabs.v v16, v12, v0.t
294 ; ZVFHMIN-NEXT: lui a0, 307200
295 ; ZVFHMIN-NEXT: fmv.w.x fa5, a0
296 ; ZVFHMIN-NEXT: vsetvli zero, zero, e32, m4, ta, mu
297 ; ZVFHMIN-NEXT: vmflt.vf v10, v16, fa5, v0.t
298 ; ZVFHMIN-NEXT: frflags a0
299 ; ZVFHMIN-NEXT: vsetvli zero, zero, e32, m4, ta, ma
300 ; ZVFHMIN-NEXT: vmv1r.v v0, v10
301 ; ZVFHMIN-NEXT: vfcvt.x.f.v v16, v12, v0.t
302 ; ZVFHMIN-NEXT: vfcvt.f.x.v v16, v16, v0.t
303 ; ZVFHMIN-NEXT: fsflags a0
304 ; ZVFHMIN-NEXT: vsetvli zero, zero, e32, m4, ta, mu
305 ; ZVFHMIN-NEXT: vfsgnj.vv v12, v16, v12, v0.t
306 ; ZVFHMIN-NEXT: vsetvli a0, zero, e16, m2, ta, ma
307 ; ZVFHMIN-NEXT: vfncvt.f.f.w v8, v12
309 %v = call <vscale x 8 x half> @llvm.vp.nearbyint.nxv8f16(<vscale x 8 x half> %va, <vscale x 8 x i1> %m, i32 %evl)
310 ret <vscale x 8 x half> %v
313 define <vscale x 8 x half> @vp_nearbyint_nxv8f16_unmasked(<vscale x 8 x half> %va, i32 zeroext %evl) {
314 ; ZVFH-LABEL: vp_nearbyint_nxv8f16_unmasked:
316 ; ZVFH-NEXT: lui a1, %hi(.LCPI7_0)
317 ; ZVFH-NEXT: flh fa5, %lo(.LCPI7_0)(a1)
318 ; ZVFH-NEXT: vsetvli zero, a0, e16, m2, ta, ma
319 ; ZVFH-NEXT: vfabs.v v10, v8
320 ; ZVFH-NEXT: vmflt.vf v0, v10, fa5
321 ; ZVFH-NEXT: frflags a0
322 ; ZVFH-NEXT: vfcvt.x.f.v v10, v8, v0.t
323 ; ZVFH-NEXT: vfcvt.f.x.v v10, v10, v0.t
324 ; ZVFH-NEXT: fsflags a0
325 ; ZVFH-NEXT: vsetvli zero, zero, e16, m2, ta, mu
326 ; ZVFH-NEXT: vfsgnj.vv v8, v10, v8, v0.t
329 ; ZVFHMIN-LABEL: vp_nearbyint_nxv8f16_unmasked:
331 ; ZVFHMIN-NEXT: vsetvli a1, zero, e16, m2, ta, ma
332 ; ZVFHMIN-NEXT: vfwcvt.f.f.v v12, v8
333 ; ZVFHMIN-NEXT: vsetvli zero, a0, e32, m4, ta, ma
334 ; ZVFHMIN-NEXT: vfabs.v v8, v12
335 ; ZVFHMIN-NEXT: lui a0, 307200
336 ; ZVFHMIN-NEXT: fmv.w.x fa5, a0
337 ; ZVFHMIN-NEXT: vmflt.vf v0, v8, fa5
338 ; ZVFHMIN-NEXT: frflags a0
339 ; ZVFHMIN-NEXT: vfcvt.x.f.v v8, v12, v0.t
340 ; ZVFHMIN-NEXT: vfcvt.f.x.v v8, v8, v0.t
341 ; ZVFHMIN-NEXT: fsflags a0
342 ; ZVFHMIN-NEXT: vsetvli zero, zero, e32, m4, ta, mu
343 ; ZVFHMIN-NEXT: vfsgnj.vv v12, v8, v12, v0.t
344 ; ZVFHMIN-NEXT: vsetvli a0, zero, e16, m2, ta, ma
345 ; ZVFHMIN-NEXT: vfncvt.f.f.w v8, v12
347 %head = insertelement <vscale x 8 x i1> poison, i1 true, i32 0
348 %m = shufflevector <vscale x 8 x i1> %head, <vscale x 8 x i1> poison, <vscale x 8 x i32> zeroinitializer
349 %v = call <vscale x 8 x half> @llvm.vp.nearbyint.nxv8f16(<vscale x 8 x half> %va, <vscale x 8 x i1> %m, i32 %evl)
350 ret <vscale x 8 x half> %v
353 declare <vscale x 16 x half> @llvm.vp.nearbyint.nxv16f16(<vscale x 16 x half>, <vscale x 16 x i1>, i32)
355 define <vscale x 16 x half> @vp_nearbyint_nxv16f16(<vscale x 16 x half> %va, <vscale x 16 x i1> %m, i32 zeroext %evl) {
356 ; ZVFH-LABEL: vp_nearbyint_nxv16f16:
358 ; ZVFH-NEXT: vmv1r.v v12, v0
359 ; ZVFH-NEXT: lui a1, %hi(.LCPI8_0)
360 ; ZVFH-NEXT: flh fa5, %lo(.LCPI8_0)(a1)
361 ; ZVFH-NEXT: vsetvli zero, a0, e16, m4, ta, ma
362 ; ZVFH-NEXT: vfabs.v v16, v8, v0.t
363 ; ZVFH-NEXT: vsetvli zero, zero, e16, m4, ta, mu
364 ; ZVFH-NEXT: vmflt.vf v12, v16, fa5, v0.t
365 ; ZVFH-NEXT: frflags a0
366 ; ZVFH-NEXT: vsetvli zero, zero, e16, m4, ta, ma
367 ; ZVFH-NEXT: vmv1r.v v0, v12
368 ; ZVFH-NEXT: vfcvt.x.f.v v16, v8, v0.t
369 ; ZVFH-NEXT: vfcvt.f.x.v v16, v16, v0.t
370 ; ZVFH-NEXT: fsflags a0
371 ; ZVFH-NEXT: vsetvli zero, zero, e16, m4, ta, mu
372 ; ZVFH-NEXT: vfsgnj.vv v8, v16, v8, v0.t
375 ; ZVFHMIN-LABEL: vp_nearbyint_nxv16f16:
377 ; ZVFHMIN-NEXT: vmv1r.v v12, v0
378 ; ZVFHMIN-NEXT: vsetvli a1, zero, e16, m4, ta, ma
379 ; ZVFHMIN-NEXT: vfwcvt.f.f.v v16, v8
380 ; ZVFHMIN-NEXT: vsetvli zero, a0, e32, m8, ta, ma
381 ; ZVFHMIN-NEXT: vfabs.v v24, v16, v0.t
382 ; ZVFHMIN-NEXT: lui a0, 307200
383 ; ZVFHMIN-NEXT: fmv.w.x fa5, a0
384 ; ZVFHMIN-NEXT: vsetvli zero, zero, e32, m8, ta, mu
385 ; ZVFHMIN-NEXT: vmflt.vf v12, v24, fa5, v0.t
386 ; ZVFHMIN-NEXT: frflags a0
387 ; ZVFHMIN-NEXT: vsetvli zero, zero, e32, m8, ta, ma
388 ; ZVFHMIN-NEXT: vmv1r.v v0, v12
389 ; ZVFHMIN-NEXT: vfcvt.x.f.v v24, v16, v0.t
390 ; ZVFHMIN-NEXT: vfcvt.f.x.v v24, v24, v0.t
391 ; ZVFHMIN-NEXT: fsflags a0
392 ; ZVFHMIN-NEXT: vsetvli zero, zero, e32, m8, ta, mu
393 ; ZVFHMIN-NEXT: vfsgnj.vv v16, v24, v16, v0.t
394 ; ZVFHMIN-NEXT: vsetvli a0, zero, e16, m4, ta, ma
395 ; ZVFHMIN-NEXT: vfncvt.f.f.w v8, v16
397 %v = call <vscale x 16 x half> @llvm.vp.nearbyint.nxv16f16(<vscale x 16 x half> %va, <vscale x 16 x i1> %m, i32 %evl)
398 ret <vscale x 16 x half> %v
401 define <vscale x 16 x half> @vp_nearbyint_nxv16f16_unmasked(<vscale x 16 x half> %va, i32 zeroext %evl) {
402 ; ZVFH-LABEL: vp_nearbyint_nxv16f16_unmasked:
404 ; ZVFH-NEXT: lui a1, %hi(.LCPI9_0)
405 ; ZVFH-NEXT: flh fa5, %lo(.LCPI9_0)(a1)
406 ; ZVFH-NEXT: vsetvli zero, a0, e16, m4, ta, ma
407 ; ZVFH-NEXT: vfabs.v v12, v8
408 ; ZVFH-NEXT: vmflt.vf v0, v12, fa5
409 ; ZVFH-NEXT: frflags a0
410 ; ZVFH-NEXT: vfcvt.x.f.v v12, v8, v0.t
411 ; ZVFH-NEXT: vfcvt.f.x.v v12, v12, v0.t
412 ; ZVFH-NEXT: fsflags a0
413 ; ZVFH-NEXT: vsetvli zero, zero, e16, m4, ta, mu
414 ; ZVFH-NEXT: vfsgnj.vv v8, v12, v8, v0.t
417 ; ZVFHMIN-LABEL: vp_nearbyint_nxv16f16_unmasked:
419 ; ZVFHMIN-NEXT: vsetvli a1, zero, e16, m4, ta, ma
420 ; ZVFHMIN-NEXT: vfwcvt.f.f.v v16, v8
421 ; ZVFHMIN-NEXT: vsetvli zero, a0, e32, m8, ta, ma
422 ; ZVFHMIN-NEXT: vfabs.v v8, v16
423 ; ZVFHMIN-NEXT: lui a0, 307200
424 ; ZVFHMIN-NEXT: fmv.w.x fa5, a0
425 ; ZVFHMIN-NEXT: vmflt.vf v0, v8, fa5
426 ; ZVFHMIN-NEXT: frflags a0
427 ; ZVFHMIN-NEXT: vfcvt.x.f.v v8, v16, v0.t
428 ; ZVFHMIN-NEXT: vfcvt.f.x.v v8, v8, v0.t
429 ; ZVFHMIN-NEXT: fsflags a0
430 ; ZVFHMIN-NEXT: vsetvli zero, zero, e32, m8, ta, mu
431 ; ZVFHMIN-NEXT: vfsgnj.vv v16, v8, v16, v0.t
432 ; ZVFHMIN-NEXT: vsetvli a0, zero, e16, m4, ta, ma
433 ; ZVFHMIN-NEXT: vfncvt.f.f.w v8, v16
435 %head = insertelement <vscale x 16 x i1> poison, i1 true, i32 0
436 %m = shufflevector <vscale x 16 x i1> %head, <vscale x 16 x i1> poison, <vscale x 16 x i32> zeroinitializer
437 %v = call <vscale x 16 x half> @llvm.vp.nearbyint.nxv16f16(<vscale x 16 x half> %va, <vscale x 16 x i1> %m, i32 %evl)
438 ret <vscale x 16 x half> %v
441 declare <vscale x 32 x half> @llvm.vp.nearbyint.nxv32f16(<vscale x 32 x half>, <vscale x 32 x i1>, i32)
443 define <vscale x 32 x half> @vp_nearbyint_nxv32f16(<vscale x 32 x half> %va, <vscale x 32 x i1> %m, i32 zeroext %evl) {
444 ; ZVFH-LABEL: vp_nearbyint_nxv32f16:
446 ; ZVFH-NEXT: vmv1r.v v16, v0
447 ; ZVFH-NEXT: lui a1, %hi(.LCPI10_0)
448 ; ZVFH-NEXT: flh fa5, %lo(.LCPI10_0)(a1)
449 ; ZVFH-NEXT: vsetvli zero, a0, e16, m8, ta, ma
450 ; ZVFH-NEXT: vfabs.v v24, v8, v0.t
451 ; ZVFH-NEXT: vsetvli zero, zero, e16, m8, ta, mu
452 ; ZVFH-NEXT: vmflt.vf v16, v24, fa5, v0.t
453 ; ZVFH-NEXT: frflags a0
454 ; ZVFH-NEXT: vsetvli zero, zero, e16, m8, ta, ma
455 ; ZVFH-NEXT: vmv1r.v v0, v16
456 ; ZVFH-NEXT: vfcvt.x.f.v v24, v8, v0.t
457 ; ZVFH-NEXT: vfcvt.f.x.v v24, v24, v0.t
458 ; ZVFH-NEXT: fsflags a0
459 ; ZVFH-NEXT: vsetvli zero, zero, e16, m8, ta, mu
460 ; ZVFH-NEXT: vfsgnj.vv v8, v24, v8, v0.t
463 ; ZVFHMIN-LABEL: vp_nearbyint_nxv32f16:
465 ; ZVFHMIN-NEXT: addi sp, sp, -16
466 ; ZVFHMIN-NEXT: .cfi_def_cfa_offset 16
467 ; ZVFHMIN-NEXT: csrr a1, vlenb
468 ; ZVFHMIN-NEXT: slli a1, a1, 3
469 ; ZVFHMIN-NEXT: sub sp, sp, a1
470 ; ZVFHMIN-NEXT: .cfi_escape 0x0f, 0x0d, 0x72, 0x00, 0x11, 0x10, 0x22, 0x11, 0x08, 0x92, 0xa2, 0x38, 0x00, 0x1e, 0x22 # sp + 16 + 8 * vlenb
471 ; ZVFHMIN-NEXT: vmv1r.v v1, v0
472 ; ZVFHMIN-NEXT: csrr a2, vlenb
473 ; ZVFHMIN-NEXT: slli a1, a2, 1
474 ; ZVFHMIN-NEXT: sub a3, a0, a1
475 ; ZVFHMIN-NEXT: sltu a4, a0, a3
476 ; ZVFHMIN-NEXT: addi a4, a4, -1
477 ; ZVFHMIN-NEXT: and a3, a4, a3
478 ; ZVFHMIN-NEXT: srli a2, a2, 2
479 ; ZVFHMIN-NEXT: vsetvli a4, zero, e8, mf2, ta, ma
480 ; ZVFHMIN-NEXT: vslidedown.vx v17, v0, a2
481 ; ZVFHMIN-NEXT: vsetvli a2, zero, e16, m4, ta, ma
482 ; ZVFHMIN-NEXT: addi a2, sp, 16
483 ; ZVFHMIN-NEXT: vs8r.v v8, (a2) # Unknown-size Folded Spill
484 ; ZVFHMIN-NEXT: vfwcvt.f.f.v v24, v12
485 ; ZVFHMIN-NEXT: vsetvli zero, a3, e32, m8, ta, ma
486 ; ZVFHMIN-NEXT: vmv1r.v v0, v17
487 ; ZVFHMIN-NEXT: vfabs.v v8, v24, v0.t
488 ; ZVFHMIN-NEXT: lui a2, 307200
489 ; ZVFHMIN-NEXT: fmv.w.x fa5, a2
490 ; ZVFHMIN-NEXT: vsetvli zero, zero, e32, m8, ta, mu
491 ; ZVFHMIN-NEXT: vmflt.vf v17, v8, fa5, v0.t
492 ; ZVFHMIN-NEXT: frflags a2
493 ; ZVFHMIN-NEXT: vsetvli zero, zero, e32, m8, ta, ma
494 ; ZVFHMIN-NEXT: vmv1r.v v0, v17
495 ; ZVFHMIN-NEXT: vfcvt.x.f.v v8, v24, v0.t
496 ; ZVFHMIN-NEXT: vfcvt.f.x.v v8, v8, v0.t
497 ; ZVFHMIN-NEXT: fsflags a2
498 ; ZVFHMIN-NEXT: vsetvli zero, zero, e32, m8, ta, mu
499 ; ZVFHMIN-NEXT: vfsgnj.vv v24, v8, v24, v0.t
500 ; ZVFHMIN-NEXT: vsetvli a2, zero, e16, m4, ta, ma
501 ; ZVFHMIN-NEXT: vfncvt.f.f.w v12, v24
502 ; ZVFHMIN-NEXT: bltu a0, a1, .LBB10_2
503 ; ZVFHMIN-NEXT: # %bb.1:
504 ; ZVFHMIN-NEXT: mv a0, a1
505 ; ZVFHMIN-NEXT: .LBB10_2:
506 ; ZVFHMIN-NEXT: addi a1, sp, 16
507 ; ZVFHMIN-NEXT: vl8r.v v16, (a1) # Unknown-size Folded Reload
508 ; ZVFHMIN-NEXT: vfwcvt.f.f.v v24, v16
509 ; ZVFHMIN-NEXT: vsetvli zero, a0, e32, m8, ta, ma
510 ; ZVFHMIN-NEXT: vmv1r.v v0, v1
511 ; ZVFHMIN-NEXT: vfabs.v v16, v24, v0.t
512 ; ZVFHMIN-NEXT: vsetvli zero, zero, e32, m8, ta, mu
513 ; ZVFHMIN-NEXT: vmflt.vf v1, v16, fa5, v0.t
514 ; ZVFHMIN-NEXT: frflags a0
515 ; ZVFHMIN-NEXT: vsetvli zero, zero, e32, m8, ta, ma
516 ; ZVFHMIN-NEXT: vmv1r.v v0, v1
517 ; ZVFHMIN-NEXT: vfcvt.x.f.v v16, v24, v0.t
518 ; ZVFHMIN-NEXT: vfcvt.f.x.v v16, v16, v0.t
519 ; ZVFHMIN-NEXT: fsflags a0
520 ; ZVFHMIN-NEXT: vsetvli zero, zero, e32, m8, ta, mu
521 ; ZVFHMIN-NEXT: vfsgnj.vv v24, v16, v24, v0.t
522 ; ZVFHMIN-NEXT: vsetvli a0, zero, e16, m4, ta, ma
523 ; ZVFHMIN-NEXT: vfncvt.f.f.w v8, v24
524 ; ZVFHMIN-NEXT: csrr a0, vlenb
525 ; ZVFHMIN-NEXT: slli a0, a0, 3
526 ; ZVFHMIN-NEXT: add sp, sp, a0
527 ; ZVFHMIN-NEXT: addi sp, sp, 16
529 %v = call <vscale x 32 x half> @llvm.vp.nearbyint.nxv32f16(<vscale x 32 x half> %va, <vscale x 32 x i1> %m, i32 %evl)
530 ret <vscale x 32 x half> %v
533 define <vscale x 32 x half> @vp_nearbyint_nxv32f16_unmasked(<vscale x 32 x half> %va, i32 zeroext %evl) {
534 ; ZVFH-LABEL: vp_nearbyint_nxv32f16_unmasked:
536 ; ZVFH-NEXT: lui a1, %hi(.LCPI11_0)
537 ; ZVFH-NEXT: flh fa5, %lo(.LCPI11_0)(a1)
538 ; ZVFH-NEXT: vsetvli zero, a0, e16, m8, ta, ma
539 ; ZVFH-NEXT: vfabs.v v16, v8
540 ; ZVFH-NEXT: vmflt.vf v0, v16, fa5
541 ; ZVFH-NEXT: frflags a0
542 ; ZVFH-NEXT: vfcvt.x.f.v v16, v8, v0.t
543 ; ZVFH-NEXT: vfcvt.f.x.v v16, v16, v0.t
544 ; ZVFH-NEXT: fsflags a0
545 ; ZVFH-NEXT: vsetvli zero, zero, e16, m8, ta, mu
546 ; ZVFH-NEXT: vfsgnj.vv v8, v16, v8, v0.t
549 ; ZVFHMIN-LABEL: vp_nearbyint_nxv32f16_unmasked:
551 ; ZVFHMIN-NEXT: addi sp, sp, -16
552 ; ZVFHMIN-NEXT: .cfi_def_cfa_offset 16
553 ; ZVFHMIN-NEXT: csrr a1, vlenb
554 ; ZVFHMIN-NEXT: slli a1, a1, 3
555 ; ZVFHMIN-NEXT: sub sp, sp, a1
556 ; ZVFHMIN-NEXT: .cfi_escape 0x0f, 0x0d, 0x72, 0x00, 0x11, 0x10, 0x22, 0x11, 0x08, 0x92, 0xa2, 0x38, 0x00, 0x1e, 0x22 # sp + 16 + 8 * vlenb
557 ; ZVFHMIN-NEXT: vsetvli a1, zero, e8, m4, ta, ma
558 ; ZVFHMIN-NEXT: vmset.m v16
559 ; ZVFHMIN-NEXT: csrr a2, vlenb
560 ; ZVFHMIN-NEXT: slli a1, a2, 1
561 ; ZVFHMIN-NEXT: sub a3, a0, a1
562 ; ZVFHMIN-NEXT: sltu a4, a0, a3
563 ; ZVFHMIN-NEXT: addi a4, a4, -1
564 ; ZVFHMIN-NEXT: and a3, a4, a3
565 ; ZVFHMIN-NEXT: srli a2, a2, 2
566 ; ZVFHMIN-NEXT: vsetvli a4, zero, e8, mf2, ta, ma
567 ; ZVFHMIN-NEXT: vslidedown.vx v16, v16, a2
568 ; ZVFHMIN-NEXT: vsetvli a2, zero, e16, m4, ta, ma
569 ; ZVFHMIN-NEXT: addi a2, sp, 16
570 ; ZVFHMIN-NEXT: vs8r.v v8, (a2) # Unknown-size Folded Spill
571 ; ZVFHMIN-NEXT: vfwcvt.f.f.v v24, v12
572 ; ZVFHMIN-NEXT: vsetvli zero, a3, e32, m8, ta, ma
573 ; ZVFHMIN-NEXT: vmv1r.v v0, v16
574 ; ZVFHMIN-NEXT: vfabs.v v8, v24, v0.t
575 ; ZVFHMIN-NEXT: lui a2, 307200
576 ; ZVFHMIN-NEXT: fmv.w.x fa5, a2
577 ; ZVFHMIN-NEXT: vsetvli zero, zero, e32, m8, ta, mu
578 ; ZVFHMIN-NEXT: vmflt.vf v16, v8, fa5, v0.t
579 ; ZVFHMIN-NEXT: frflags a2
580 ; ZVFHMIN-NEXT: vsetvli zero, zero, e32, m8, ta, ma
581 ; ZVFHMIN-NEXT: vmv1r.v v0, v16
582 ; ZVFHMIN-NEXT: vfcvt.x.f.v v8, v24, v0.t
583 ; ZVFHMIN-NEXT: vfcvt.f.x.v v8, v8, v0.t
584 ; ZVFHMIN-NEXT: fsflags a2
585 ; ZVFHMIN-NEXT: vsetvli zero, zero, e32, m8, ta, mu
586 ; ZVFHMIN-NEXT: vfsgnj.vv v24, v8, v24, v0.t
587 ; ZVFHMIN-NEXT: vsetvli a2, zero, e16, m4, ta, ma
588 ; ZVFHMIN-NEXT: vfncvt.f.f.w v12, v24
589 ; ZVFHMIN-NEXT: bltu a0, a1, .LBB11_2
590 ; ZVFHMIN-NEXT: # %bb.1:
591 ; ZVFHMIN-NEXT: mv a0, a1
592 ; ZVFHMIN-NEXT: .LBB11_2:
593 ; ZVFHMIN-NEXT: addi a1, sp, 16
594 ; ZVFHMIN-NEXT: vl8r.v v24, (a1) # Unknown-size Folded Reload
595 ; ZVFHMIN-NEXT: vfwcvt.f.f.v v16, v24
596 ; ZVFHMIN-NEXT: vsetvli zero, a0, e32, m8, ta, ma
597 ; ZVFHMIN-NEXT: vfabs.v v24, v16
598 ; ZVFHMIN-NEXT: vmflt.vf v0, v24, fa5
599 ; ZVFHMIN-NEXT: frflags a0
600 ; ZVFHMIN-NEXT: vfcvt.x.f.v v24, v16, v0.t
601 ; ZVFHMIN-NEXT: vfcvt.f.x.v v24, v24, v0.t
602 ; ZVFHMIN-NEXT: fsflags a0
603 ; ZVFHMIN-NEXT: vsetvli zero, zero, e32, m8, ta, mu
604 ; ZVFHMIN-NEXT: vfsgnj.vv v16, v24, v16, v0.t
605 ; ZVFHMIN-NEXT: vsetvli a0, zero, e16, m4, ta, ma
606 ; ZVFHMIN-NEXT: vfncvt.f.f.w v8, v16
607 ; ZVFHMIN-NEXT: csrr a0, vlenb
608 ; ZVFHMIN-NEXT: slli a0, a0, 3
609 ; ZVFHMIN-NEXT: add sp, sp, a0
610 ; ZVFHMIN-NEXT: addi sp, sp, 16
612 %head = insertelement <vscale x 32 x i1> poison, i1 true, i32 0
613 %m = shufflevector <vscale x 32 x i1> %head, <vscale x 32 x i1> poison, <vscale x 32 x i32> zeroinitializer
614 %v = call <vscale x 32 x half> @llvm.vp.nearbyint.nxv32f16(<vscale x 32 x half> %va, <vscale x 32 x i1> %m, i32 %evl)
615 ret <vscale x 32 x half> %v
618 declare <vscale x 1 x float> @llvm.vp.nearbyint.nxv1f32(<vscale x 1 x float>, <vscale x 1 x i1>, i32)
620 define <vscale x 1 x float> @vp_nearbyint_nxv1f32(<vscale x 1 x float> %va, <vscale x 1 x i1> %m, i32 zeroext %evl) {
621 ; CHECK-LABEL: vp_nearbyint_nxv1f32:
623 ; CHECK-NEXT: vsetvli zero, a0, e32, mf2, ta, ma
624 ; CHECK-NEXT: vfabs.v v9, v8, v0.t
625 ; CHECK-NEXT: lui a0, 307200
626 ; CHECK-NEXT: fmv.w.x fa5, a0
627 ; CHECK-NEXT: vsetvli zero, zero, e32, mf2, ta, mu
628 ; CHECK-NEXT: vmflt.vf v0, v9, fa5, v0.t
629 ; CHECK-NEXT: frflags a0
630 ; CHECK-NEXT: vsetvli zero, zero, e32, mf2, ta, ma
631 ; CHECK-NEXT: vfcvt.x.f.v v9, v8, v0.t
632 ; CHECK-NEXT: vfcvt.f.x.v v9, v9, v0.t
633 ; CHECK-NEXT: fsflags a0
634 ; CHECK-NEXT: vsetvli zero, zero, e32, mf2, ta, mu
635 ; CHECK-NEXT: vfsgnj.vv v8, v9, v8, v0.t
637 %v = call <vscale x 1 x float> @llvm.vp.nearbyint.nxv1f32(<vscale x 1 x float> %va, <vscale x 1 x i1> %m, i32 %evl)
638 ret <vscale x 1 x float> %v
641 define <vscale x 1 x float> @vp_nearbyint_nxv1f32_unmasked(<vscale x 1 x float> %va, i32 zeroext %evl) {
642 ; CHECK-LABEL: vp_nearbyint_nxv1f32_unmasked:
644 ; CHECK-NEXT: vsetvli zero, a0, e32, mf2, ta, ma
645 ; CHECK-NEXT: vfabs.v v9, v8
646 ; CHECK-NEXT: lui a0, 307200
647 ; CHECK-NEXT: fmv.w.x fa5, a0
648 ; CHECK-NEXT: vmflt.vf v0, v9, fa5
649 ; CHECK-NEXT: frflags a0
650 ; CHECK-NEXT: vfcvt.x.f.v v9, v8, v0.t
651 ; CHECK-NEXT: vfcvt.f.x.v v9, v9, v0.t
652 ; CHECK-NEXT: fsflags a0
653 ; CHECK-NEXT: vsetvli zero, zero, e32, mf2, ta, mu
654 ; CHECK-NEXT: vfsgnj.vv v8, v9, v8, v0.t
656 %head = insertelement <vscale x 1 x i1> poison, i1 true, i32 0
657 %m = shufflevector <vscale x 1 x i1> %head, <vscale x 1 x i1> poison, <vscale x 1 x i32> zeroinitializer
658 %v = call <vscale x 1 x float> @llvm.vp.nearbyint.nxv1f32(<vscale x 1 x float> %va, <vscale x 1 x i1> %m, i32 %evl)
659 ret <vscale x 1 x float> %v
662 declare <vscale x 2 x float> @llvm.vp.nearbyint.nxv2f32(<vscale x 2 x float>, <vscale x 2 x i1>, i32)
664 define <vscale x 2 x float> @vp_nearbyint_nxv2f32(<vscale x 2 x float> %va, <vscale x 2 x i1> %m, i32 zeroext %evl) {
665 ; CHECK-LABEL: vp_nearbyint_nxv2f32:
667 ; CHECK-NEXT: vsetvli zero, a0, e32, m1, ta, ma
668 ; CHECK-NEXT: vfabs.v v9, v8, v0.t
669 ; CHECK-NEXT: lui a0, 307200
670 ; CHECK-NEXT: fmv.w.x fa5, a0
671 ; CHECK-NEXT: vsetvli zero, zero, e32, m1, ta, mu
672 ; CHECK-NEXT: vmflt.vf v0, v9, fa5, v0.t
673 ; CHECK-NEXT: frflags a0
674 ; CHECK-NEXT: vsetvli zero, zero, e32, m1, ta, ma
675 ; CHECK-NEXT: vfcvt.x.f.v v9, v8, v0.t
676 ; CHECK-NEXT: vfcvt.f.x.v v9, v9, v0.t
677 ; CHECK-NEXT: fsflags a0
678 ; CHECK-NEXT: vsetvli zero, zero, e32, m1, ta, mu
679 ; CHECK-NEXT: vfsgnj.vv v8, v9, v8, v0.t
681 %v = call <vscale x 2 x float> @llvm.vp.nearbyint.nxv2f32(<vscale x 2 x float> %va, <vscale x 2 x i1> %m, i32 %evl)
682 ret <vscale x 2 x float> %v
685 define <vscale x 2 x float> @vp_nearbyint_nxv2f32_unmasked(<vscale x 2 x float> %va, i32 zeroext %evl) {
686 ; CHECK-LABEL: vp_nearbyint_nxv2f32_unmasked:
688 ; CHECK-NEXT: vsetvli zero, a0, e32, m1, ta, ma
689 ; CHECK-NEXT: vfabs.v v9, v8
690 ; CHECK-NEXT: lui a0, 307200
691 ; CHECK-NEXT: fmv.w.x fa5, a0
692 ; CHECK-NEXT: vmflt.vf v0, v9, fa5
693 ; CHECK-NEXT: frflags a0
694 ; CHECK-NEXT: vfcvt.x.f.v v9, v8, v0.t
695 ; CHECK-NEXT: vfcvt.f.x.v v9, v9, v0.t
696 ; CHECK-NEXT: fsflags a0
697 ; CHECK-NEXT: vsetvli zero, zero, e32, m1, ta, mu
698 ; CHECK-NEXT: vfsgnj.vv v8, v9, v8, v0.t
700 %head = insertelement <vscale x 2 x i1> poison, i1 true, i32 0
701 %m = shufflevector <vscale x 2 x i1> %head, <vscale x 2 x i1> poison, <vscale x 2 x i32> zeroinitializer
702 %v = call <vscale x 2 x float> @llvm.vp.nearbyint.nxv2f32(<vscale x 2 x float> %va, <vscale x 2 x i1> %m, i32 %evl)
703 ret <vscale x 2 x float> %v
706 declare <vscale x 4 x float> @llvm.vp.nearbyint.nxv4f32(<vscale x 4 x float>, <vscale x 4 x i1>, i32)
708 define <vscale x 4 x float> @vp_nearbyint_nxv4f32(<vscale x 4 x float> %va, <vscale x 4 x i1> %m, i32 zeroext %evl) {
709 ; CHECK-LABEL: vp_nearbyint_nxv4f32:
711 ; CHECK-NEXT: vmv1r.v v10, v0
712 ; CHECK-NEXT: vsetvli zero, a0, e32, m2, ta, ma
713 ; CHECK-NEXT: vfabs.v v12, v8, v0.t
714 ; CHECK-NEXT: lui a0, 307200
715 ; CHECK-NEXT: fmv.w.x fa5, a0
716 ; CHECK-NEXT: vsetvli zero, zero, e32, m2, ta, mu
717 ; CHECK-NEXT: vmflt.vf v10, v12, fa5, v0.t
718 ; CHECK-NEXT: frflags a0
719 ; CHECK-NEXT: vsetvli zero, zero, e32, m2, ta, ma
720 ; CHECK-NEXT: vmv1r.v v0, v10
721 ; CHECK-NEXT: vfcvt.x.f.v v12, v8, v0.t
722 ; CHECK-NEXT: vfcvt.f.x.v v12, v12, v0.t
723 ; CHECK-NEXT: fsflags a0
724 ; CHECK-NEXT: vsetvli zero, zero, e32, m2, ta, mu
725 ; CHECK-NEXT: vfsgnj.vv v8, v12, v8, v0.t
727 %v = call <vscale x 4 x float> @llvm.vp.nearbyint.nxv4f32(<vscale x 4 x float> %va, <vscale x 4 x i1> %m, i32 %evl)
728 ret <vscale x 4 x float> %v
731 define <vscale x 4 x float> @vp_nearbyint_nxv4f32_unmasked(<vscale x 4 x float> %va, i32 zeroext %evl) {
732 ; CHECK-LABEL: vp_nearbyint_nxv4f32_unmasked:
734 ; CHECK-NEXT: vsetvli zero, a0, e32, m2, ta, ma
735 ; CHECK-NEXT: vfabs.v v10, v8
736 ; CHECK-NEXT: lui a0, 307200
737 ; CHECK-NEXT: fmv.w.x fa5, a0
738 ; CHECK-NEXT: vmflt.vf v0, v10, fa5
739 ; CHECK-NEXT: frflags a0
740 ; CHECK-NEXT: vfcvt.x.f.v v10, v8, v0.t
741 ; CHECK-NEXT: vfcvt.f.x.v v10, v10, v0.t
742 ; CHECK-NEXT: fsflags a0
743 ; CHECK-NEXT: vsetvli zero, zero, e32, m2, ta, mu
744 ; CHECK-NEXT: vfsgnj.vv v8, v10, v8, v0.t
746 %head = insertelement <vscale x 4 x i1> poison, i1 true, i32 0
747 %m = shufflevector <vscale x 4 x i1> %head, <vscale x 4 x i1> poison, <vscale x 4 x i32> zeroinitializer
748 %v = call <vscale x 4 x float> @llvm.vp.nearbyint.nxv4f32(<vscale x 4 x float> %va, <vscale x 4 x i1> %m, i32 %evl)
749 ret <vscale x 4 x float> %v
752 declare <vscale x 8 x float> @llvm.vp.nearbyint.nxv8f32(<vscale x 8 x float>, <vscale x 8 x i1>, i32)
754 define <vscale x 8 x float> @vp_nearbyint_nxv8f32(<vscale x 8 x float> %va, <vscale x 8 x i1> %m, i32 zeroext %evl) {
755 ; CHECK-LABEL: vp_nearbyint_nxv8f32:
757 ; CHECK-NEXT: vmv1r.v v12, v0
758 ; CHECK-NEXT: vsetvli zero, a0, e32, m4, ta, ma
759 ; CHECK-NEXT: vfabs.v v16, v8, v0.t
760 ; CHECK-NEXT: lui a0, 307200
761 ; CHECK-NEXT: fmv.w.x fa5, a0
762 ; CHECK-NEXT: vsetvli zero, zero, e32, m4, ta, mu
763 ; CHECK-NEXT: vmflt.vf v12, v16, fa5, v0.t
764 ; CHECK-NEXT: frflags a0
765 ; CHECK-NEXT: vsetvli zero, zero, e32, m4, ta, ma
766 ; CHECK-NEXT: vmv1r.v v0, v12
767 ; CHECK-NEXT: vfcvt.x.f.v v16, v8, v0.t
768 ; CHECK-NEXT: vfcvt.f.x.v v16, v16, v0.t
769 ; CHECK-NEXT: fsflags a0
770 ; CHECK-NEXT: vsetvli zero, zero, e32, m4, ta, mu
771 ; CHECK-NEXT: vfsgnj.vv v8, v16, v8, v0.t
773 %v = call <vscale x 8 x float> @llvm.vp.nearbyint.nxv8f32(<vscale x 8 x float> %va, <vscale x 8 x i1> %m, i32 %evl)
774 ret <vscale x 8 x float> %v
777 define <vscale x 8 x float> @vp_nearbyint_nxv8f32_unmasked(<vscale x 8 x float> %va, i32 zeroext %evl) {
778 ; CHECK-LABEL: vp_nearbyint_nxv8f32_unmasked:
780 ; CHECK-NEXT: vsetvli zero, a0, e32, m4, ta, ma
781 ; CHECK-NEXT: vfabs.v v12, v8
782 ; CHECK-NEXT: lui a0, 307200
783 ; CHECK-NEXT: fmv.w.x fa5, a0
784 ; CHECK-NEXT: vmflt.vf v0, v12, fa5
785 ; CHECK-NEXT: frflags a0
786 ; CHECK-NEXT: vfcvt.x.f.v v12, v8, v0.t
787 ; CHECK-NEXT: vfcvt.f.x.v v12, v12, v0.t
788 ; CHECK-NEXT: fsflags a0
789 ; CHECK-NEXT: vsetvli zero, zero, e32, m4, ta, mu
790 ; CHECK-NEXT: vfsgnj.vv v8, v12, v8, v0.t
792 %head = insertelement <vscale x 8 x i1> poison, i1 true, i32 0
793 %m = shufflevector <vscale x 8 x i1> %head, <vscale x 8 x i1> poison, <vscale x 8 x i32> zeroinitializer
794 %v = call <vscale x 8 x float> @llvm.vp.nearbyint.nxv8f32(<vscale x 8 x float> %va, <vscale x 8 x i1> %m, i32 %evl)
795 ret <vscale x 8 x float> %v
798 declare <vscale x 16 x float> @llvm.vp.nearbyint.nxv16f32(<vscale x 16 x float>, <vscale x 16 x i1>, i32)
800 define <vscale x 16 x float> @vp_nearbyint_nxv16f32(<vscale x 16 x float> %va, <vscale x 16 x i1> %m, i32 zeroext %evl) {
801 ; CHECK-LABEL: vp_nearbyint_nxv16f32:
803 ; CHECK-NEXT: vmv1r.v v16, v0
804 ; CHECK-NEXT: vsetvli zero, a0, e32, m8, ta, ma
805 ; CHECK-NEXT: vfabs.v v24, v8, v0.t
806 ; CHECK-NEXT: lui a0, 307200
807 ; CHECK-NEXT: fmv.w.x fa5, a0
808 ; CHECK-NEXT: vsetvli zero, zero, e32, m8, ta, mu
809 ; CHECK-NEXT: vmflt.vf v16, v24, fa5, v0.t
810 ; CHECK-NEXT: frflags a0
811 ; CHECK-NEXT: vsetvli zero, zero, e32, m8, ta, ma
812 ; CHECK-NEXT: vmv1r.v v0, v16
813 ; CHECK-NEXT: vfcvt.x.f.v v24, v8, v0.t
814 ; CHECK-NEXT: vfcvt.f.x.v v24, v24, v0.t
815 ; CHECK-NEXT: fsflags a0
816 ; CHECK-NEXT: vsetvli zero, zero, e32, m8, ta, mu
817 ; CHECK-NEXT: vfsgnj.vv v8, v24, v8, v0.t
819 %v = call <vscale x 16 x float> @llvm.vp.nearbyint.nxv16f32(<vscale x 16 x float> %va, <vscale x 16 x i1> %m, i32 %evl)
820 ret <vscale x 16 x float> %v
823 define <vscale x 16 x float> @vp_nearbyint_nxv16f32_unmasked(<vscale x 16 x float> %va, i32 zeroext %evl) {
824 ; CHECK-LABEL: vp_nearbyint_nxv16f32_unmasked:
826 ; CHECK-NEXT: vsetvli zero, a0, e32, m8, ta, ma
827 ; CHECK-NEXT: vfabs.v v16, v8
828 ; CHECK-NEXT: lui a0, 307200
829 ; CHECK-NEXT: fmv.w.x fa5, a0
830 ; CHECK-NEXT: vmflt.vf v0, v16, fa5
831 ; CHECK-NEXT: frflags a0
832 ; CHECK-NEXT: vfcvt.x.f.v v16, v8, v0.t
833 ; CHECK-NEXT: vfcvt.f.x.v v16, v16, v0.t
834 ; CHECK-NEXT: fsflags a0
835 ; CHECK-NEXT: vsetvli zero, zero, e32, m8, ta, mu
836 ; CHECK-NEXT: vfsgnj.vv v8, v16, v8, v0.t
838 %head = insertelement <vscale x 16 x i1> poison, i1 true, i32 0
839 %m = shufflevector <vscale x 16 x i1> %head, <vscale x 16 x i1> poison, <vscale x 16 x i32> zeroinitializer
840 %v = call <vscale x 16 x float> @llvm.vp.nearbyint.nxv16f32(<vscale x 16 x float> %va, <vscale x 16 x i1> %m, i32 %evl)
841 ret <vscale x 16 x float> %v
844 declare <vscale x 1 x double> @llvm.vp.nearbyint.nxv1f64(<vscale x 1 x double>, <vscale x 1 x i1>, i32)
846 define <vscale x 1 x double> @vp_nearbyint_nxv1f64(<vscale x 1 x double> %va, <vscale x 1 x i1> %m, i32 zeroext %evl) {
847 ; CHECK-LABEL: vp_nearbyint_nxv1f64:
849 ; CHECK-NEXT: lui a1, %hi(.LCPI22_0)
850 ; CHECK-NEXT: fld fa5, %lo(.LCPI22_0)(a1)
851 ; CHECK-NEXT: vsetvli zero, a0, e64, m1, ta, ma
852 ; CHECK-NEXT: vfabs.v v9, v8, v0.t
853 ; CHECK-NEXT: vsetvli zero, zero, e64, m1, ta, mu
854 ; CHECK-NEXT: vmflt.vf v0, v9, fa5, v0.t
855 ; CHECK-NEXT: frflags a0
856 ; CHECK-NEXT: vsetvli zero, zero, e64, m1, ta, ma
857 ; CHECK-NEXT: vfcvt.x.f.v v9, v8, v0.t
858 ; CHECK-NEXT: vfcvt.f.x.v v9, v9, v0.t
859 ; CHECK-NEXT: fsflags a0
860 ; CHECK-NEXT: vsetvli zero, zero, e64, m1, ta, mu
861 ; CHECK-NEXT: vfsgnj.vv v8, v9, v8, v0.t
863 %v = call <vscale x 1 x double> @llvm.vp.nearbyint.nxv1f64(<vscale x 1 x double> %va, <vscale x 1 x i1> %m, i32 %evl)
864 ret <vscale x 1 x double> %v
867 define <vscale x 1 x double> @vp_nearbyint_nxv1f64_unmasked(<vscale x 1 x double> %va, i32 zeroext %evl) {
868 ; CHECK-LABEL: vp_nearbyint_nxv1f64_unmasked:
870 ; CHECK-NEXT: lui a1, %hi(.LCPI23_0)
871 ; CHECK-NEXT: fld fa5, %lo(.LCPI23_0)(a1)
872 ; CHECK-NEXT: vsetvli zero, a0, e64, m1, ta, ma
873 ; CHECK-NEXT: vfabs.v v9, v8
874 ; CHECK-NEXT: vmflt.vf v0, v9, fa5
875 ; CHECK-NEXT: frflags a0
876 ; CHECK-NEXT: vfcvt.x.f.v v9, v8, v0.t
877 ; CHECK-NEXT: vfcvt.f.x.v v9, v9, v0.t
878 ; CHECK-NEXT: fsflags a0
879 ; CHECK-NEXT: vsetvli zero, zero, e64, m1, ta, mu
880 ; CHECK-NEXT: vfsgnj.vv v8, v9, v8, v0.t
882 %head = insertelement <vscale x 1 x i1> poison, i1 true, i32 0
883 %m = shufflevector <vscale x 1 x i1> %head, <vscale x 1 x i1> poison, <vscale x 1 x i32> zeroinitializer
884 %v = call <vscale x 1 x double> @llvm.vp.nearbyint.nxv1f64(<vscale x 1 x double> %va, <vscale x 1 x i1> %m, i32 %evl)
885 ret <vscale x 1 x double> %v
888 declare <vscale x 2 x double> @llvm.vp.nearbyint.nxv2f64(<vscale x 2 x double>, <vscale x 2 x i1>, i32)
890 define <vscale x 2 x double> @vp_nearbyint_nxv2f64(<vscale x 2 x double> %va, <vscale x 2 x i1> %m, i32 zeroext %evl) {
891 ; CHECK-LABEL: vp_nearbyint_nxv2f64:
893 ; CHECK-NEXT: vmv1r.v v10, v0
894 ; CHECK-NEXT: lui a1, %hi(.LCPI24_0)
895 ; CHECK-NEXT: fld fa5, %lo(.LCPI24_0)(a1)
896 ; CHECK-NEXT: vsetvli zero, a0, e64, m2, ta, ma
897 ; CHECK-NEXT: vfabs.v v12, v8, v0.t
898 ; CHECK-NEXT: vsetvli zero, zero, e64, m2, ta, mu
899 ; CHECK-NEXT: vmflt.vf v10, v12, fa5, v0.t
900 ; CHECK-NEXT: frflags a0
901 ; CHECK-NEXT: vsetvli zero, zero, e64, m2, ta, ma
902 ; CHECK-NEXT: vmv1r.v v0, v10
903 ; CHECK-NEXT: vfcvt.x.f.v v12, v8, v0.t
904 ; CHECK-NEXT: vfcvt.f.x.v v12, v12, v0.t
905 ; CHECK-NEXT: fsflags a0
906 ; CHECK-NEXT: vsetvli zero, zero, e64, m2, ta, mu
907 ; CHECK-NEXT: vfsgnj.vv v8, v12, v8, v0.t
909 %v = call <vscale x 2 x double> @llvm.vp.nearbyint.nxv2f64(<vscale x 2 x double> %va, <vscale x 2 x i1> %m, i32 %evl)
910 ret <vscale x 2 x double> %v
913 define <vscale x 2 x double> @vp_nearbyint_nxv2f64_unmasked(<vscale x 2 x double> %va, i32 zeroext %evl) {
914 ; CHECK-LABEL: vp_nearbyint_nxv2f64_unmasked:
916 ; CHECK-NEXT: lui a1, %hi(.LCPI25_0)
917 ; CHECK-NEXT: fld fa5, %lo(.LCPI25_0)(a1)
918 ; CHECK-NEXT: vsetvli zero, a0, e64, m2, ta, ma
919 ; CHECK-NEXT: vfabs.v v10, v8
920 ; CHECK-NEXT: vmflt.vf v0, v10, fa5
921 ; CHECK-NEXT: frflags a0
922 ; CHECK-NEXT: vfcvt.x.f.v v10, v8, v0.t
923 ; CHECK-NEXT: vfcvt.f.x.v v10, v10, v0.t
924 ; CHECK-NEXT: fsflags a0
925 ; CHECK-NEXT: vsetvli zero, zero, e64, m2, ta, mu
926 ; CHECK-NEXT: vfsgnj.vv v8, v10, v8, v0.t
928 %head = insertelement <vscale x 2 x i1> poison, i1 true, i32 0
929 %m = shufflevector <vscale x 2 x i1> %head, <vscale x 2 x i1> poison, <vscale x 2 x i32> zeroinitializer
930 %v = call <vscale x 2 x double> @llvm.vp.nearbyint.nxv2f64(<vscale x 2 x double> %va, <vscale x 2 x i1> %m, i32 %evl)
931 ret <vscale x 2 x double> %v
934 declare <vscale x 4 x double> @llvm.vp.nearbyint.nxv4f64(<vscale x 4 x double>, <vscale x 4 x i1>, i32)
936 define <vscale x 4 x double> @vp_nearbyint_nxv4f64(<vscale x 4 x double> %va, <vscale x 4 x i1> %m, i32 zeroext %evl) {
937 ; CHECK-LABEL: vp_nearbyint_nxv4f64:
939 ; CHECK-NEXT: vmv1r.v v12, v0
940 ; CHECK-NEXT: lui a1, %hi(.LCPI26_0)
941 ; CHECK-NEXT: fld fa5, %lo(.LCPI26_0)(a1)
942 ; CHECK-NEXT: vsetvli zero, a0, e64, m4, ta, ma
943 ; CHECK-NEXT: vfabs.v v16, v8, v0.t
944 ; CHECK-NEXT: vsetvli zero, zero, e64, m4, ta, mu
945 ; CHECK-NEXT: vmflt.vf v12, v16, fa5, v0.t
946 ; CHECK-NEXT: frflags a0
947 ; CHECK-NEXT: vsetvli zero, zero, e64, m4, ta, ma
948 ; CHECK-NEXT: vmv1r.v v0, v12
949 ; CHECK-NEXT: vfcvt.x.f.v v16, v8, v0.t
950 ; CHECK-NEXT: vfcvt.f.x.v v16, v16, v0.t
951 ; CHECK-NEXT: fsflags a0
952 ; CHECK-NEXT: vsetvli zero, zero, e64, m4, ta, mu
953 ; CHECK-NEXT: vfsgnj.vv v8, v16, v8, v0.t
955 %v = call <vscale x 4 x double> @llvm.vp.nearbyint.nxv4f64(<vscale x 4 x double> %va, <vscale x 4 x i1> %m, i32 %evl)
956 ret <vscale x 4 x double> %v
959 define <vscale x 4 x double> @vp_nearbyint_nxv4f64_unmasked(<vscale x 4 x double> %va, i32 zeroext %evl) {
960 ; CHECK-LABEL: vp_nearbyint_nxv4f64_unmasked:
962 ; CHECK-NEXT: lui a1, %hi(.LCPI27_0)
963 ; CHECK-NEXT: fld fa5, %lo(.LCPI27_0)(a1)
964 ; CHECK-NEXT: vsetvli zero, a0, e64, m4, ta, ma
965 ; CHECK-NEXT: vfabs.v v12, v8
966 ; CHECK-NEXT: vmflt.vf v0, v12, fa5
967 ; CHECK-NEXT: frflags a0
968 ; CHECK-NEXT: vfcvt.x.f.v v12, v8, v0.t
969 ; CHECK-NEXT: vfcvt.f.x.v v12, v12, v0.t
970 ; CHECK-NEXT: fsflags a0
971 ; CHECK-NEXT: vsetvli zero, zero, e64, m4, ta, mu
972 ; CHECK-NEXT: vfsgnj.vv v8, v12, v8, v0.t
974 %head = insertelement <vscale x 4 x i1> poison, i1 true, i32 0
975 %m = shufflevector <vscale x 4 x i1> %head, <vscale x 4 x i1> poison, <vscale x 4 x i32> zeroinitializer
976 %v = call <vscale x 4 x double> @llvm.vp.nearbyint.nxv4f64(<vscale x 4 x double> %va, <vscale x 4 x i1> %m, i32 %evl)
977 ret <vscale x 4 x double> %v
980 declare <vscale x 7 x double> @llvm.vp.nearbyint.nxv7f64(<vscale x 7 x double>, <vscale x 7 x i1>, i32)
982 define <vscale x 7 x double> @vp_nearbyint_nxv7f64(<vscale x 7 x double> %va, <vscale x 7 x i1> %m, i32 zeroext %evl) {
983 ; CHECK-LABEL: vp_nearbyint_nxv7f64:
985 ; CHECK-NEXT: vmv1r.v v16, v0
986 ; CHECK-NEXT: lui a1, %hi(.LCPI28_0)
987 ; CHECK-NEXT: fld fa5, %lo(.LCPI28_0)(a1)
988 ; CHECK-NEXT: vsetvli zero, a0, e64, m8, ta, ma
989 ; CHECK-NEXT: vfabs.v v24, v8, v0.t
990 ; CHECK-NEXT: vsetvli zero, zero, e64, m8, ta, mu
991 ; CHECK-NEXT: vmflt.vf v16, v24, fa5, v0.t
992 ; CHECK-NEXT: frflags a0
993 ; CHECK-NEXT: vsetvli zero, zero, e64, m8, ta, ma
994 ; CHECK-NEXT: vmv1r.v v0, v16
995 ; CHECK-NEXT: vfcvt.x.f.v v24, v8, v0.t
996 ; CHECK-NEXT: vfcvt.f.x.v v24, v24, v0.t
997 ; CHECK-NEXT: fsflags a0
998 ; CHECK-NEXT: vsetvli zero, zero, e64, m8, ta, mu
999 ; CHECK-NEXT: vfsgnj.vv v8, v24, v8, v0.t
1001 %v = call <vscale x 7 x double> @llvm.vp.nearbyint.nxv7f64(<vscale x 7 x double> %va, <vscale x 7 x i1> %m, i32 %evl)
1002 ret <vscale x 7 x double> %v
1005 define <vscale x 7 x double> @vp_nearbyint_nxv7f64_unmasked(<vscale x 7 x double> %va, i32 zeroext %evl) {
1006 ; CHECK-LABEL: vp_nearbyint_nxv7f64_unmasked:
1008 ; CHECK-NEXT: lui a1, %hi(.LCPI29_0)
1009 ; CHECK-NEXT: fld fa5, %lo(.LCPI29_0)(a1)
1010 ; CHECK-NEXT: vsetvli zero, a0, e64, m8, ta, ma
1011 ; CHECK-NEXT: vfabs.v v16, v8
1012 ; CHECK-NEXT: vmflt.vf v0, v16, fa5
1013 ; CHECK-NEXT: frflags a0
1014 ; CHECK-NEXT: vfcvt.x.f.v v16, v8, v0.t
1015 ; CHECK-NEXT: vfcvt.f.x.v v16, v16, v0.t
1016 ; CHECK-NEXT: fsflags a0
1017 ; CHECK-NEXT: vsetvli zero, zero, e64, m8, ta, mu
1018 ; CHECK-NEXT: vfsgnj.vv v8, v16, v8, v0.t
1020 %head = insertelement <vscale x 7 x i1> poison, i1 true, i32 0
1021 %m = shufflevector <vscale x 7 x i1> %head, <vscale x 7 x i1> poison, <vscale x 7 x i32> zeroinitializer
1022 %v = call <vscale x 7 x double> @llvm.vp.nearbyint.nxv7f64(<vscale x 7 x double> %va, <vscale x 7 x i1> %m, i32 %evl)
1023 ret <vscale x 7 x double> %v
1026 declare <vscale x 8 x double> @llvm.vp.nearbyint.nxv8f64(<vscale x 8 x double>, <vscale x 8 x i1>, i32)
1028 define <vscale x 8 x double> @vp_nearbyint_nxv8f64(<vscale x 8 x double> %va, <vscale x 8 x i1> %m, i32 zeroext %evl) {
1029 ; CHECK-LABEL: vp_nearbyint_nxv8f64:
1031 ; CHECK-NEXT: vmv1r.v v16, v0
1032 ; CHECK-NEXT: lui a1, %hi(.LCPI30_0)
1033 ; CHECK-NEXT: fld fa5, %lo(.LCPI30_0)(a1)
1034 ; CHECK-NEXT: vsetvli zero, a0, e64, m8, ta, ma
1035 ; CHECK-NEXT: vfabs.v v24, v8, v0.t
1036 ; CHECK-NEXT: vsetvli zero, zero, e64, m8, ta, mu
1037 ; CHECK-NEXT: vmflt.vf v16, v24, fa5, v0.t
1038 ; CHECK-NEXT: frflags a0
1039 ; CHECK-NEXT: vsetvli zero, zero, e64, m8, ta, ma
1040 ; CHECK-NEXT: vmv1r.v v0, v16
1041 ; CHECK-NEXT: vfcvt.x.f.v v24, v8, v0.t
1042 ; CHECK-NEXT: vfcvt.f.x.v v24, v24, v0.t
1043 ; CHECK-NEXT: fsflags a0
1044 ; CHECK-NEXT: vsetvli zero, zero, e64, m8, ta, mu
1045 ; CHECK-NEXT: vfsgnj.vv v8, v24, v8, v0.t
1047 %v = call <vscale x 8 x double> @llvm.vp.nearbyint.nxv8f64(<vscale x 8 x double> %va, <vscale x 8 x i1> %m, i32 %evl)
1048 ret <vscale x 8 x double> %v
1051 define <vscale x 8 x double> @vp_nearbyint_nxv8f64_unmasked(<vscale x 8 x double> %va, i32 zeroext %evl) {
1052 ; CHECK-LABEL: vp_nearbyint_nxv8f64_unmasked:
1054 ; CHECK-NEXT: lui a1, %hi(.LCPI31_0)
1055 ; CHECK-NEXT: fld fa5, %lo(.LCPI31_0)(a1)
1056 ; CHECK-NEXT: vsetvli zero, a0, e64, m8, ta, ma
1057 ; CHECK-NEXT: vfabs.v v16, v8
1058 ; CHECK-NEXT: vmflt.vf v0, v16, fa5
1059 ; CHECK-NEXT: frflags a0
1060 ; CHECK-NEXT: vfcvt.x.f.v v16, v8, v0.t
1061 ; CHECK-NEXT: vfcvt.f.x.v v16, v16, v0.t
1062 ; CHECK-NEXT: fsflags a0
1063 ; CHECK-NEXT: vsetvli zero, zero, e64, m8, ta, mu
1064 ; CHECK-NEXT: vfsgnj.vv v8, v16, v8, v0.t
1066 %head = insertelement <vscale x 8 x i1> poison, i1 true, i32 0
1067 %m = shufflevector <vscale x 8 x i1> %head, <vscale x 8 x i1> poison, <vscale x 8 x i32> zeroinitializer
1068 %v = call <vscale x 8 x double> @llvm.vp.nearbyint.nxv8f64(<vscale x 8 x double> %va, <vscale x 8 x i1> %m, i32 %evl)
1069 ret <vscale x 8 x double> %v
1073 declare <vscale x 16 x double> @llvm.vp.nearbyint.nxv16f64(<vscale x 16 x double>, <vscale x 16 x i1>, i32)
1075 define <vscale x 16 x double> @vp_nearbyint_nxv16f64(<vscale x 16 x double> %va, <vscale x 16 x i1> %m, i32 zeroext %evl) {
1076 ; CHECK-LABEL: vp_nearbyint_nxv16f64:
1078 ; CHECK-NEXT: addi sp, sp, -16
1079 ; CHECK-NEXT: .cfi_def_cfa_offset 16
1080 ; CHECK-NEXT: csrr a1, vlenb
1081 ; CHECK-NEXT: slli a1, a1, 4
1082 ; CHECK-NEXT: sub sp, sp, a1
1083 ; CHECK-NEXT: .cfi_escape 0x0f, 0x0d, 0x72, 0x00, 0x11, 0x10, 0x22, 0x11, 0x10, 0x92, 0xa2, 0x38, 0x00, 0x1e, 0x22 # sp + 16 + 16 * vlenb
1084 ; CHECK-NEXT: vmv1r.v v24, v0
1085 ; CHECK-NEXT: addi a1, sp, 16
1086 ; CHECK-NEXT: vs8r.v v8, (a1) # Unknown-size Folded Spill
1087 ; CHECK-NEXT: csrr a1, vlenb
1088 ; CHECK-NEXT: srli a2, a1, 3
1089 ; CHECK-NEXT: vsetvli a3, zero, e8, mf4, ta, ma
1090 ; CHECK-NEXT: vslidedown.vx v25, v0, a2
1091 ; CHECK-NEXT: sub a2, a0, a1
1092 ; CHECK-NEXT: sltu a3, a0, a2
1093 ; CHECK-NEXT: addi a3, a3, -1
1094 ; CHECK-NEXT: and a2, a3, a2
1095 ; CHECK-NEXT: lui a3, %hi(.LCPI32_0)
1096 ; CHECK-NEXT: fld fa5, %lo(.LCPI32_0)(a3)
1097 ; CHECK-NEXT: vsetvli zero, a2, e64, m8, ta, ma
1098 ; CHECK-NEXT: vmv1r.v v0, v25
1099 ; CHECK-NEXT: vmv8r.v v8, v16
1100 ; CHECK-NEXT: csrr a2, vlenb
1101 ; CHECK-NEXT: slli a2, a2, 3
1102 ; CHECK-NEXT: add a2, sp, a2
1103 ; CHECK-NEXT: addi a2, a2, 16
1104 ; CHECK-NEXT: vs8r.v v16, (a2) # Unknown-size Folded Spill
1105 ; CHECK-NEXT: vfabs.v v16, v16, v0.t
1106 ; CHECK-NEXT: vsetvli zero, zero, e64, m8, ta, mu
1107 ; CHECK-NEXT: vmflt.vf v25, v16, fa5, v0.t
1108 ; CHECK-NEXT: frflags a2
1109 ; CHECK-NEXT: vsetvli zero, zero, e64, m8, ta, ma
1110 ; CHECK-NEXT: vmv1r.v v0, v25
1111 ; CHECK-NEXT: vfcvt.x.f.v v16, v8, v0.t
1112 ; CHECK-NEXT: vfcvt.f.x.v v8, v16, v0.t
1113 ; CHECK-NEXT: fsflags a2
1114 ; CHECK-NEXT: vsetvli zero, zero, e64, m8, ta, mu
1115 ; CHECK-NEXT: csrr a2, vlenb
1116 ; CHECK-NEXT: slli a2, a2, 3
1117 ; CHECK-NEXT: add a2, sp, a2
1118 ; CHECK-NEXT: addi a2, a2, 16
1119 ; CHECK-NEXT: vl8r.v v16, (a2) # Unknown-size Folded Reload
1120 ; CHECK-NEXT: vfsgnj.vv v16, v8, v16, v0.t
1121 ; CHECK-NEXT: csrr a2, vlenb
1122 ; CHECK-NEXT: slli a2, a2, 3
1123 ; CHECK-NEXT: add a2, sp, a2
1124 ; CHECK-NEXT: addi a2, a2, 16
1125 ; CHECK-NEXT: vs8r.v v16, (a2) # Unknown-size Folded Spill
1126 ; CHECK-NEXT: bltu a0, a1, .LBB32_2
1127 ; CHECK-NEXT: # %bb.1:
1128 ; CHECK-NEXT: mv a0, a1
1129 ; CHECK-NEXT: .LBB32_2:
1130 ; CHECK-NEXT: vsetvli zero, a0, e64, m8, ta, ma
1131 ; CHECK-NEXT: vmv1r.v v0, v24
1132 ; CHECK-NEXT: addi a0, sp, 16
1133 ; CHECK-NEXT: vl8r.v v8, (a0) # Unknown-size Folded Reload
1134 ; CHECK-NEXT: vfabs.v v16, v8, v0.t
1135 ; CHECK-NEXT: vsetvli zero, zero, e64, m8, ta, mu
1136 ; CHECK-NEXT: vmflt.vf v24, v16, fa5, v0.t
1137 ; CHECK-NEXT: frflags a0
1138 ; CHECK-NEXT: vsetvli zero, zero, e64, m8, ta, ma
1139 ; CHECK-NEXT: vmv1r.v v0, v24
1140 ; CHECK-NEXT: vfcvt.x.f.v v16, v8, v0.t
1141 ; CHECK-NEXT: vfcvt.f.x.v v16, v16, v0.t
1142 ; CHECK-NEXT: fsflags a0
1143 ; CHECK-NEXT: vsetvli zero, zero, e64, m8, ta, mu
1144 ; CHECK-NEXT: vfsgnj.vv v8, v16, v8, v0.t
1145 ; CHECK-NEXT: csrr a0, vlenb
1146 ; CHECK-NEXT: slli a0, a0, 3
1147 ; CHECK-NEXT: add a0, sp, a0
1148 ; CHECK-NEXT: addi a0, a0, 16
1149 ; CHECK-NEXT: vl8r.v v16, (a0) # Unknown-size Folded Reload
1150 ; CHECK-NEXT: csrr a0, vlenb
1151 ; CHECK-NEXT: slli a0, a0, 4
1152 ; CHECK-NEXT: add sp, sp, a0
1153 ; CHECK-NEXT: addi sp, sp, 16
1155 %v = call <vscale x 16 x double> @llvm.vp.nearbyint.nxv16f64(<vscale x 16 x double> %va, <vscale x 16 x i1> %m, i32 %evl)
1156 ret <vscale x 16 x double> %v
1159 define <vscale x 16 x double> @vp_nearbyint_nxv16f64_unmasked(<vscale x 16 x double> %va, i32 zeroext %evl) {
1160 ; CHECK-LABEL: vp_nearbyint_nxv16f64_unmasked:
1162 ; CHECK-NEXT: csrr a1, vlenb
1163 ; CHECK-NEXT: sub a2, a0, a1
1164 ; CHECK-NEXT: lui a3, %hi(.LCPI33_0)
1165 ; CHECK-NEXT: fld fa5, %lo(.LCPI33_0)(a3)
1166 ; CHECK-NEXT: sltu a3, a0, a2
1167 ; CHECK-NEXT: addi a3, a3, -1
1168 ; CHECK-NEXT: and a2, a3, a2
1169 ; CHECK-NEXT: vsetvli zero, a2, e64, m8, ta, ma
1170 ; CHECK-NEXT: vfabs.v v24, v16
1171 ; CHECK-NEXT: vmflt.vf v0, v24, fa5
1172 ; CHECK-NEXT: frflags a2
1173 ; CHECK-NEXT: vfcvt.x.f.v v24, v16, v0.t
1174 ; CHECK-NEXT: vfcvt.f.x.v v24, v24, v0.t
1175 ; CHECK-NEXT: fsflags a2
1176 ; CHECK-NEXT: vsetvli zero, zero, e64, m8, ta, mu
1177 ; CHECK-NEXT: vfsgnj.vv v16, v24, v16, v0.t
1178 ; CHECK-NEXT: bltu a0, a1, .LBB33_2
1179 ; CHECK-NEXT: # %bb.1:
1180 ; CHECK-NEXT: mv a0, a1
1181 ; CHECK-NEXT: .LBB33_2:
1182 ; CHECK-NEXT: vsetvli zero, a0, e64, m8, ta, ma
1183 ; CHECK-NEXT: vfabs.v v24, v8
1184 ; CHECK-NEXT: vmflt.vf v0, v24, fa5
1185 ; CHECK-NEXT: frflags a0
1186 ; CHECK-NEXT: vfcvt.x.f.v v24, v8, v0.t
1187 ; CHECK-NEXT: vfcvt.f.x.v v24, v24, v0.t
1188 ; CHECK-NEXT: fsflags a0
1189 ; CHECK-NEXT: vsetvli zero, zero, e64, m8, ta, mu
1190 ; CHECK-NEXT: vfsgnj.vv v8, v24, v8, v0.t
1192 %head = insertelement <vscale x 16 x i1> poison, i1 true, i32 0
1193 %m = shufflevector <vscale x 16 x i1> %head, <vscale x 16 x i1> poison, <vscale x 16 x i32> zeroinitializer
1194 %v = call <vscale x 16 x double> @llvm.vp.nearbyint.nxv16f64(<vscale x 16 x double> %va, <vscale x 16 x i1> %m, i32 %evl)
1195 ret <vscale x 16 x double> %v