1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: sed 's/iXLen/i32/g' %s | llc -mtriple=riscv32 -mattr=+v,+f,+d \
3 ; RUN: -target-abi=ilp32d -verify-machineinstrs | FileCheck %s --check-prefix=RV32
4 ; RUN: sed 's/iXLen/i32/g' %s | llc -mtriple=riscv64 -mattr=+v,+f,+d \
5 ; RUN: -target-abi=lp64d -verify-machineinstrs | FileCheck %s --check-prefix=RV64-i32
6 ; RUN: sed 's/iXLen/i64/g' %s | llc -mtriple=riscv64 -mattr=+v,+f,+d \
7 ; RUN: -target-abi=lp64d -verify-machineinstrs | FileCheck %s --check-prefix=RV64-i64
9 define <1 x iXLen> @lrint_v1f32(<1 x float> %x) {
10 ; RV32-LABEL: lrint_v1f32:
12 ; RV32-NEXT: vsetivli zero, 1, e32, mf2, ta, ma
13 ; RV32-NEXT: vfmv.f.s fa5, v8
14 ; RV32-NEXT: fcvt.w.s a0, fa5
15 ; RV32-NEXT: vmv.s.x v8, a0
18 ; RV64-i32-LABEL: lrint_v1f32:
20 ; RV64-i32-NEXT: vsetivli zero, 1, e32, mf2, ta, ma
21 ; RV64-i32-NEXT: vfmv.f.s fa5, v8
22 ; RV64-i32-NEXT: fcvt.l.s a0, fa5
23 ; RV64-i32-NEXT: vmv.s.x v8, a0
26 ; RV64-i64-LABEL: lrint_v1f32:
28 ; RV64-i64-NEXT: vsetivli zero, 1, e32, mf2, ta, ma
29 ; RV64-i64-NEXT: vfmv.f.s fa5, v8
30 ; RV64-i64-NEXT: fcvt.l.s a0, fa5
31 ; RV64-i64-NEXT: vsetivli zero, 1, e64, m1, ta, ma
32 ; RV64-i64-NEXT: vmv.s.x v8, a0
34 %a = call <1 x iXLen> @llvm.lrint.v1iXLen.v1f32(<1 x float> %x)
37 declare <1 x iXLen> @llvm.lrint.v1iXLen.v1f32(<1 x float>)
39 define <2 x iXLen> @lrint_v2f32(<2 x float> %x) {
40 ; RV32-LABEL: lrint_v2f32:
42 ; RV32-NEXT: vsetivli zero, 1, e32, mf2, ta, ma
43 ; RV32-NEXT: vslidedown.vi v9, v8, 1
44 ; RV32-NEXT: vfmv.f.s fa5, v9
45 ; RV32-NEXT: fcvt.w.s a0, fa5
46 ; RV32-NEXT: vfmv.f.s fa5, v8
47 ; RV32-NEXT: fcvt.w.s a1, fa5
48 ; RV32-NEXT: vsetivli zero, 2, e32, mf2, ta, ma
49 ; RV32-NEXT: vmv.v.x v8, a1
50 ; RV32-NEXT: vslide1down.vx v8, v8, a0
53 ; RV64-i32-LABEL: lrint_v2f32:
55 ; RV64-i32-NEXT: vsetivli zero, 1, e32, mf2, ta, ma
56 ; RV64-i32-NEXT: vslidedown.vi v9, v8, 1
57 ; RV64-i32-NEXT: vfmv.f.s fa5, v9
58 ; RV64-i32-NEXT: fcvt.l.s a0, fa5
59 ; RV64-i32-NEXT: vfmv.f.s fa5, v8
60 ; RV64-i32-NEXT: fcvt.l.s a1, fa5
61 ; RV64-i32-NEXT: vsetivli zero, 2, e32, mf2, ta, ma
62 ; RV64-i32-NEXT: vmv.v.x v8, a1
63 ; RV64-i32-NEXT: vslide1down.vx v8, v8, a0
66 ; RV64-i64-LABEL: lrint_v2f32:
68 ; RV64-i64-NEXT: vsetivli zero, 1, e32, mf2, ta, ma
69 ; RV64-i64-NEXT: vslidedown.vi v9, v8, 1
70 ; RV64-i64-NEXT: vfmv.f.s fa5, v9
71 ; RV64-i64-NEXT: fcvt.l.s a0, fa5
72 ; RV64-i64-NEXT: vfmv.f.s fa5, v8
73 ; RV64-i64-NEXT: fcvt.l.s a1, fa5
74 ; RV64-i64-NEXT: vsetivli zero, 2, e64, m1, ta, ma
75 ; RV64-i64-NEXT: vmv.v.x v8, a1
76 ; RV64-i64-NEXT: vslide1down.vx v8, v8, a0
78 %a = call <2 x iXLen> @llvm.lrint.v2iXLen.v2f32(<2 x float> %x)
81 declare <2 x iXLen> @llvm.lrint.v2iXLen.v2f32(<2 x float>)
83 define <3 x iXLen> @lrint_v3f32(<3 x float> %x) {
84 ; RV32-LABEL: lrint_v3f32:
86 ; RV32-NEXT: vsetivli zero, 1, e32, m1, ta, ma
87 ; RV32-NEXT: vslidedown.vi v9, v8, 1
88 ; RV32-NEXT: vfmv.f.s fa5, v9
89 ; RV32-NEXT: fcvt.w.s a0, fa5
90 ; RV32-NEXT: vfmv.f.s fa5, v8
91 ; RV32-NEXT: fcvt.w.s a1, fa5
92 ; RV32-NEXT: vsetivli zero, 4, e32, m1, ta, ma
93 ; RV32-NEXT: vmv.v.x v9, a1
94 ; RV32-NEXT: vslide1down.vx v9, v9, a0
95 ; RV32-NEXT: vslidedown.vi v10, v8, 2
96 ; RV32-NEXT: vfmv.f.s fa5, v10
97 ; RV32-NEXT: fcvt.w.s a0, fa5
98 ; RV32-NEXT: vslide1down.vx v9, v9, a0
99 ; RV32-NEXT: vslidedown.vi v8, v8, 3
100 ; RV32-NEXT: vfmv.f.s fa5, v8
101 ; RV32-NEXT: fcvt.w.s a0, fa5
102 ; RV32-NEXT: vslide1down.vx v8, v9, a0
105 ; RV64-i32-LABEL: lrint_v3f32:
107 ; RV64-i32-NEXT: vsetivli zero, 1, e32, m1, ta, ma
108 ; RV64-i32-NEXT: vslidedown.vi v9, v8, 1
109 ; RV64-i32-NEXT: vfmv.f.s fa5, v9
110 ; RV64-i32-NEXT: fcvt.l.s a0, fa5
111 ; RV64-i32-NEXT: vfmv.f.s fa5, v8
112 ; RV64-i32-NEXT: fcvt.l.s a1, fa5
113 ; RV64-i32-NEXT: vsetivli zero, 4, e32, m1, ta, ma
114 ; RV64-i32-NEXT: vmv.v.x v9, a1
115 ; RV64-i32-NEXT: vslide1down.vx v9, v9, a0
116 ; RV64-i32-NEXT: vslidedown.vi v10, v8, 2
117 ; RV64-i32-NEXT: vfmv.f.s fa5, v10
118 ; RV64-i32-NEXT: fcvt.l.s a0, fa5
119 ; RV64-i32-NEXT: vslide1down.vx v9, v9, a0
120 ; RV64-i32-NEXT: vslidedown.vi v8, v8, 3
121 ; RV64-i32-NEXT: vfmv.f.s fa5, v8
122 ; RV64-i32-NEXT: fcvt.l.s a0, fa5
123 ; RV64-i32-NEXT: vslide1down.vx v8, v9, a0
126 ; RV64-i64-LABEL: lrint_v3f32:
128 ; RV64-i64-NEXT: vsetivli zero, 1, e32, m1, ta, ma
129 ; RV64-i64-NEXT: vslidedown.vi v9, v8, 1
130 ; RV64-i64-NEXT: vfmv.f.s fa5, v9
131 ; RV64-i64-NEXT: fcvt.l.s a0, fa5
132 ; RV64-i64-NEXT: vfmv.f.s fa5, v8
133 ; RV64-i64-NEXT: fcvt.l.s a1, fa5
134 ; RV64-i64-NEXT: vsetivli zero, 4, e64, m2, ta, ma
135 ; RV64-i64-NEXT: vmv.v.x v10, a1
136 ; RV64-i64-NEXT: vslide1down.vx v10, v10, a0
137 ; RV64-i64-NEXT: vsetivli zero, 1, e32, m1, ta, ma
138 ; RV64-i64-NEXT: vslidedown.vi v9, v8, 2
139 ; RV64-i64-NEXT: vfmv.f.s fa5, v9
140 ; RV64-i64-NEXT: fcvt.l.s a0, fa5
141 ; RV64-i64-NEXT: vsetivli zero, 4, e64, m2, ta, ma
142 ; RV64-i64-NEXT: vslide1down.vx v10, v10, a0
143 ; RV64-i64-NEXT: vsetivli zero, 1, e32, m1, ta, ma
144 ; RV64-i64-NEXT: vslidedown.vi v8, v8, 3
145 ; RV64-i64-NEXT: vfmv.f.s fa5, v8
146 ; RV64-i64-NEXT: fcvt.l.s a0, fa5
147 ; RV64-i64-NEXT: vsetivli zero, 4, e64, m2, ta, ma
148 ; RV64-i64-NEXT: vslide1down.vx v8, v10, a0
150 %a = call <3 x iXLen> @llvm.lrint.v3iXLen.v3f32(<3 x float> %x)
153 declare <3 x iXLen> @llvm.lrint.v3iXLen.v3f32(<3 x float>)
155 define <4 x iXLen> @lrint_v4f32(<4 x float> %x) {
156 ; RV32-LABEL: lrint_v4f32:
158 ; RV32-NEXT: vsetivli zero, 1, e32, m1, ta, ma
159 ; RV32-NEXT: vslidedown.vi v9, v8, 1
160 ; RV32-NEXT: vfmv.f.s fa5, v9
161 ; RV32-NEXT: fcvt.w.s a0, fa5
162 ; RV32-NEXT: vfmv.f.s fa5, v8
163 ; RV32-NEXT: fcvt.w.s a1, fa5
164 ; RV32-NEXT: vsetivli zero, 4, e32, m1, ta, ma
165 ; RV32-NEXT: vmv.v.x v9, a1
166 ; RV32-NEXT: vslide1down.vx v9, v9, a0
167 ; RV32-NEXT: vslidedown.vi v10, v8, 2
168 ; RV32-NEXT: vfmv.f.s fa5, v10
169 ; RV32-NEXT: fcvt.w.s a0, fa5
170 ; RV32-NEXT: vslide1down.vx v9, v9, a0
171 ; RV32-NEXT: vslidedown.vi v8, v8, 3
172 ; RV32-NEXT: vfmv.f.s fa5, v8
173 ; RV32-NEXT: fcvt.w.s a0, fa5
174 ; RV32-NEXT: vslide1down.vx v8, v9, a0
177 ; RV64-i32-LABEL: lrint_v4f32:
179 ; RV64-i32-NEXT: vsetivli zero, 1, e32, m1, ta, ma
180 ; RV64-i32-NEXT: vslidedown.vi v9, v8, 1
181 ; RV64-i32-NEXT: vfmv.f.s fa5, v9
182 ; RV64-i32-NEXT: fcvt.l.s a0, fa5
183 ; RV64-i32-NEXT: vfmv.f.s fa5, v8
184 ; RV64-i32-NEXT: fcvt.l.s a1, fa5
185 ; RV64-i32-NEXT: vsetivli zero, 4, e32, m1, ta, ma
186 ; RV64-i32-NEXT: vmv.v.x v9, a1
187 ; RV64-i32-NEXT: vslide1down.vx v9, v9, a0
188 ; RV64-i32-NEXT: vslidedown.vi v10, v8, 2
189 ; RV64-i32-NEXT: vfmv.f.s fa5, v10
190 ; RV64-i32-NEXT: fcvt.l.s a0, fa5
191 ; RV64-i32-NEXT: vslide1down.vx v9, v9, a0
192 ; RV64-i32-NEXT: vslidedown.vi v8, v8, 3
193 ; RV64-i32-NEXT: vfmv.f.s fa5, v8
194 ; RV64-i32-NEXT: fcvt.l.s a0, fa5
195 ; RV64-i32-NEXT: vslide1down.vx v8, v9, a0
198 ; RV64-i64-LABEL: lrint_v4f32:
200 ; RV64-i64-NEXT: vsetivli zero, 1, e32, m1, ta, ma
201 ; RV64-i64-NEXT: vslidedown.vi v9, v8, 1
202 ; RV64-i64-NEXT: vfmv.f.s fa5, v9
203 ; RV64-i64-NEXT: fcvt.l.s a0, fa5
204 ; RV64-i64-NEXT: vfmv.f.s fa5, v8
205 ; RV64-i64-NEXT: fcvt.l.s a1, fa5
206 ; RV64-i64-NEXT: vsetivli zero, 4, e64, m2, ta, ma
207 ; RV64-i64-NEXT: vmv.v.x v10, a1
208 ; RV64-i64-NEXT: vslide1down.vx v10, v10, a0
209 ; RV64-i64-NEXT: vsetivli zero, 1, e32, m1, ta, ma
210 ; RV64-i64-NEXT: vslidedown.vi v9, v8, 2
211 ; RV64-i64-NEXT: vfmv.f.s fa5, v9
212 ; RV64-i64-NEXT: fcvt.l.s a0, fa5
213 ; RV64-i64-NEXT: vsetivli zero, 4, e64, m2, ta, ma
214 ; RV64-i64-NEXT: vslide1down.vx v10, v10, a0
215 ; RV64-i64-NEXT: vsetivli zero, 1, e32, m1, ta, ma
216 ; RV64-i64-NEXT: vslidedown.vi v8, v8, 3
217 ; RV64-i64-NEXT: vfmv.f.s fa5, v8
218 ; RV64-i64-NEXT: fcvt.l.s a0, fa5
219 ; RV64-i64-NEXT: vsetivli zero, 4, e64, m2, ta, ma
220 ; RV64-i64-NEXT: vslide1down.vx v8, v10, a0
222 %a = call <4 x iXLen> @llvm.lrint.v4iXLen.v4f32(<4 x float> %x)
225 declare <4 x iXLen> @llvm.lrint.v4iXLen.v4f32(<4 x float>)
227 define <8 x iXLen> @lrint_v8f32(<8 x float> %x) {
228 ; RV32-LABEL: lrint_v8f32:
230 ; RV32-NEXT: vsetivli zero, 1, e32, m1, ta, ma
231 ; RV32-NEXT: vslidedown.vi v10, v8, 1
232 ; RV32-NEXT: vfmv.f.s fa5, v10
233 ; RV32-NEXT: fcvt.w.s a0, fa5
234 ; RV32-NEXT: vfmv.f.s fa5, v8
235 ; RV32-NEXT: fcvt.w.s a1, fa5
236 ; RV32-NEXT: vsetivli zero, 8, e32, m2, ta, ma
237 ; RV32-NEXT: vmv.v.x v10, a1
238 ; RV32-NEXT: vslide1down.vx v10, v10, a0
239 ; RV32-NEXT: vsetivli zero, 1, e32, m1, ta, ma
240 ; RV32-NEXT: vslidedown.vi v12, v8, 2
241 ; RV32-NEXT: vfmv.f.s fa5, v12
242 ; RV32-NEXT: fcvt.w.s a0, fa5
243 ; RV32-NEXT: vsetivli zero, 8, e32, m2, ta, ma
244 ; RV32-NEXT: vslide1down.vx v10, v10, a0
245 ; RV32-NEXT: vsetivli zero, 1, e32, m1, ta, ma
246 ; RV32-NEXT: vslidedown.vi v12, v8, 3
247 ; RV32-NEXT: vfmv.f.s fa5, v12
248 ; RV32-NEXT: fcvt.w.s a0, fa5
249 ; RV32-NEXT: vsetivli zero, 8, e32, m2, ta, ma
250 ; RV32-NEXT: vslide1down.vx v10, v10, a0
251 ; RV32-NEXT: vsetivli zero, 1, e32, m2, ta, ma
252 ; RV32-NEXT: vslidedown.vi v12, v8, 4
253 ; RV32-NEXT: vfmv.f.s fa5, v12
254 ; RV32-NEXT: fcvt.w.s a0, fa5
255 ; RV32-NEXT: vsetivli zero, 8, e32, m2, ta, ma
256 ; RV32-NEXT: vslide1down.vx v10, v10, a0
257 ; RV32-NEXT: vsetivli zero, 1, e32, m2, ta, ma
258 ; RV32-NEXT: vslidedown.vi v12, v8, 5
259 ; RV32-NEXT: vfmv.f.s fa5, v12
260 ; RV32-NEXT: fcvt.w.s a0, fa5
261 ; RV32-NEXT: vsetivli zero, 8, e32, m2, ta, ma
262 ; RV32-NEXT: vslide1down.vx v10, v10, a0
263 ; RV32-NEXT: vsetivli zero, 1, e32, m2, ta, ma
264 ; RV32-NEXT: vslidedown.vi v12, v8, 6
265 ; RV32-NEXT: vfmv.f.s fa5, v12
266 ; RV32-NEXT: fcvt.w.s a0, fa5
267 ; RV32-NEXT: vsetivli zero, 8, e32, m2, ta, ma
268 ; RV32-NEXT: vslide1down.vx v10, v10, a0
269 ; RV32-NEXT: vsetivli zero, 1, e32, m2, ta, ma
270 ; RV32-NEXT: vslidedown.vi v8, v8, 7
271 ; RV32-NEXT: vfmv.f.s fa5, v8
272 ; RV32-NEXT: fcvt.w.s a0, fa5
273 ; RV32-NEXT: vsetivli zero, 8, e32, m2, ta, ma
274 ; RV32-NEXT: vslide1down.vx v8, v10, a0
277 ; RV64-i32-LABEL: lrint_v8f32:
279 ; RV64-i32-NEXT: vsetivli zero, 1, e32, m1, ta, ma
280 ; RV64-i32-NEXT: vslidedown.vi v10, v8, 1
281 ; RV64-i32-NEXT: vfmv.f.s fa5, v10
282 ; RV64-i32-NEXT: fcvt.l.s a0, fa5
283 ; RV64-i32-NEXT: vfmv.f.s fa5, v8
284 ; RV64-i32-NEXT: fcvt.l.s a1, fa5
285 ; RV64-i32-NEXT: vsetivli zero, 8, e32, m2, ta, ma
286 ; RV64-i32-NEXT: vmv.v.x v10, a1
287 ; RV64-i32-NEXT: vslide1down.vx v10, v10, a0
288 ; RV64-i32-NEXT: vsetivli zero, 1, e32, m1, ta, ma
289 ; RV64-i32-NEXT: vslidedown.vi v12, v8, 2
290 ; RV64-i32-NEXT: vfmv.f.s fa5, v12
291 ; RV64-i32-NEXT: fcvt.l.s a0, fa5
292 ; RV64-i32-NEXT: vsetivli zero, 8, e32, m2, ta, ma
293 ; RV64-i32-NEXT: vslide1down.vx v10, v10, a0
294 ; RV64-i32-NEXT: vsetivli zero, 1, e32, m1, ta, ma
295 ; RV64-i32-NEXT: vslidedown.vi v12, v8, 3
296 ; RV64-i32-NEXT: vfmv.f.s fa5, v12
297 ; RV64-i32-NEXT: fcvt.l.s a0, fa5
298 ; RV64-i32-NEXT: vsetivli zero, 8, e32, m2, ta, ma
299 ; RV64-i32-NEXT: vslide1down.vx v10, v10, a0
300 ; RV64-i32-NEXT: vsetivli zero, 1, e32, m2, ta, ma
301 ; RV64-i32-NEXT: vslidedown.vi v12, v8, 4
302 ; RV64-i32-NEXT: vfmv.f.s fa5, v12
303 ; RV64-i32-NEXT: fcvt.l.s a0, fa5
304 ; RV64-i32-NEXT: vsetivli zero, 8, e32, m2, ta, ma
305 ; RV64-i32-NEXT: vslide1down.vx v10, v10, a0
306 ; RV64-i32-NEXT: vsetivli zero, 1, e32, m2, ta, ma
307 ; RV64-i32-NEXT: vslidedown.vi v12, v8, 5
308 ; RV64-i32-NEXT: vfmv.f.s fa5, v12
309 ; RV64-i32-NEXT: fcvt.l.s a0, fa5
310 ; RV64-i32-NEXT: vsetivli zero, 8, e32, m2, ta, ma
311 ; RV64-i32-NEXT: vslide1down.vx v10, v10, a0
312 ; RV64-i32-NEXT: vsetivli zero, 1, e32, m2, ta, ma
313 ; RV64-i32-NEXT: vslidedown.vi v12, v8, 6
314 ; RV64-i32-NEXT: vfmv.f.s fa5, v12
315 ; RV64-i32-NEXT: fcvt.l.s a0, fa5
316 ; RV64-i32-NEXT: vsetivli zero, 8, e32, m2, ta, ma
317 ; RV64-i32-NEXT: vslide1down.vx v10, v10, a0
318 ; RV64-i32-NEXT: vsetivli zero, 1, e32, m2, ta, ma
319 ; RV64-i32-NEXT: vslidedown.vi v8, v8, 7
320 ; RV64-i32-NEXT: vfmv.f.s fa5, v8
321 ; RV64-i32-NEXT: fcvt.l.s a0, fa5
322 ; RV64-i32-NEXT: vsetivli zero, 8, e32, m2, ta, ma
323 ; RV64-i32-NEXT: vslide1down.vx v8, v10, a0
326 ; RV64-i64-LABEL: lrint_v8f32:
328 ; RV64-i64-NEXT: addi sp, sp, -128
329 ; RV64-i64-NEXT: .cfi_def_cfa_offset 128
330 ; RV64-i64-NEXT: sd ra, 120(sp) # 8-byte Folded Spill
331 ; RV64-i64-NEXT: sd s0, 112(sp) # 8-byte Folded Spill
332 ; RV64-i64-NEXT: .cfi_offset ra, -8
333 ; RV64-i64-NEXT: .cfi_offset s0, -16
334 ; RV64-i64-NEXT: addi s0, sp, 128
335 ; RV64-i64-NEXT: .cfi_def_cfa s0, 0
336 ; RV64-i64-NEXT: andi sp, sp, -64
337 ; RV64-i64-NEXT: vsetivli zero, 1, e32, m2, ta, ma
338 ; RV64-i64-NEXT: vfmv.f.s fa5, v8
339 ; RV64-i64-NEXT: fcvt.l.s a0, fa5
340 ; RV64-i64-NEXT: sd a0, 0(sp)
341 ; RV64-i64-NEXT: vslidedown.vi v10, v8, 7
342 ; RV64-i64-NEXT: vfmv.f.s fa5, v10
343 ; RV64-i64-NEXT: fcvt.l.s a0, fa5
344 ; RV64-i64-NEXT: sd a0, 56(sp)
345 ; RV64-i64-NEXT: vslidedown.vi v10, v8, 6
346 ; RV64-i64-NEXT: vfmv.f.s fa5, v10
347 ; RV64-i64-NEXT: fcvt.l.s a0, fa5
348 ; RV64-i64-NEXT: sd a0, 48(sp)
349 ; RV64-i64-NEXT: vslidedown.vi v10, v8, 5
350 ; RV64-i64-NEXT: vfmv.f.s fa5, v10
351 ; RV64-i64-NEXT: fcvt.l.s a0, fa5
352 ; RV64-i64-NEXT: sd a0, 40(sp)
353 ; RV64-i64-NEXT: vslidedown.vi v10, v8, 4
354 ; RV64-i64-NEXT: vfmv.f.s fa5, v10
355 ; RV64-i64-NEXT: fcvt.l.s a0, fa5
356 ; RV64-i64-NEXT: sd a0, 32(sp)
357 ; RV64-i64-NEXT: vsetivli zero, 1, e32, m1, ta, ma
358 ; RV64-i64-NEXT: vslidedown.vi v9, v8, 3
359 ; RV64-i64-NEXT: vfmv.f.s fa5, v9
360 ; RV64-i64-NEXT: fcvt.l.s a0, fa5
361 ; RV64-i64-NEXT: sd a0, 24(sp)
362 ; RV64-i64-NEXT: vslidedown.vi v9, v8, 2
363 ; RV64-i64-NEXT: vfmv.f.s fa5, v9
364 ; RV64-i64-NEXT: fcvt.l.s a0, fa5
365 ; RV64-i64-NEXT: sd a0, 16(sp)
366 ; RV64-i64-NEXT: vslidedown.vi v8, v8, 1
367 ; RV64-i64-NEXT: vfmv.f.s fa5, v8
368 ; RV64-i64-NEXT: fcvt.l.s a0, fa5
369 ; RV64-i64-NEXT: sd a0, 8(sp)
370 ; RV64-i64-NEXT: mv a0, sp
371 ; RV64-i64-NEXT: vsetivli zero, 8, e64, m4, ta, ma
372 ; RV64-i64-NEXT: vle64.v v8, (a0)
373 ; RV64-i64-NEXT: addi sp, s0, -128
374 ; RV64-i64-NEXT: ld ra, 120(sp) # 8-byte Folded Reload
375 ; RV64-i64-NEXT: ld s0, 112(sp) # 8-byte Folded Reload
376 ; RV64-i64-NEXT: addi sp, sp, 128
378 %a = call <8 x iXLen> @llvm.lrint.v8iXLen.v8f32(<8 x float> %x)
381 declare <8 x iXLen> @llvm.lrint.v8iXLen.v8f32(<8 x float>)
383 define <16 x iXLen> @lrint_v16iXLen_v16f32(<16 x float> %x) {
384 %a = call <16 x iXLen> @llvm.lrint.v16iXLen.v16f32(<16 x float> %x)
387 declare <16 x iXLen> @llvm.lrint.v16iXLen.v16f32(<16 x float>)
389 define <1 x iXLen> @lrint_v1f64(<1 x double> %x) {
390 ; RV32-LABEL: lrint_v1f64:
392 ; RV32-NEXT: vsetivli zero, 1, e64, m1, ta, ma
393 ; RV32-NEXT: vfmv.f.s fa5, v8
394 ; RV32-NEXT: fcvt.w.d a0, fa5
395 ; RV32-NEXT: vsetivli zero, 1, e32, mf2, ta, ma
396 ; RV32-NEXT: vmv.s.x v8, a0
399 ; RV64-i32-LABEL: lrint_v1f64:
401 ; RV64-i32-NEXT: vsetivli zero, 1, e64, m1, ta, ma
402 ; RV64-i32-NEXT: vfmv.f.s fa5, v8
403 ; RV64-i32-NEXT: fcvt.l.d a0, fa5
404 ; RV64-i32-NEXT: vsetivli zero, 1, e32, mf2, ta, ma
405 ; RV64-i32-NEXT: vmv.s.x v8, a0
408 ; RV64-i64-LABEL: lrint_v1f64:
410 ; RV64-i64-NEXT: vsetivli zero, 1, e64, m1, ta, ma
411 ; RV64-i64-NEXT: vfmv.f.s fa5, v8
412 ; RV64-i64-NEXT: fcvt.l.d a0, fa5
413 ; RV64-i64-NEXT: vmv.s.x v8, a0
415 %a = call <1 x iXLen> @llvm.lrint.v1iXLen.v1f64(<1 x double> %x)
418 declare <1 x iXLen> @llvm.lrint.v1iXLen.v1f64(<1 x double>)
420 define <2 x iXLen> @lrint_v2f64(<2 x double> %x) {
421 ; RV32-LABEL: lrint_v2f64:
423 ; RV32-NEXT: vsetivli zero, 1, e64, m1, ta, ma
424 ; RV32-NEXT: vslidedown.vi v9, v8, 1
425 ; RV32-NEXT: vfmv.f.s fa5, v9
426 ; RV32-NEXT: fcvt.w.d a0, fa5
427 ; RV32-NEXT: vfmv.f.s fa5, v8
428 ; RV32-NEXT: fcvt.w.d a1, fa5
429 ; RV32-NEXT: vsetivli zero, 2, e32, mf2, ta, ma
430 ; RV32-NEXT: vmv.v.x v8, a1
431 ; RV32-NEXT: vslide1down.vx v8, v8, a0
434 ; RV64-i32-LABEL: lrint_v2f64:
436 ; RV64-i32-NEXT: vsetivli zero, 1, e64, m1, ta, ma
437 ; RV64-i32-NEXT: vslidedown.vi v9, v8, 1
438 ; RV64-i32-NEXT: vfmv.f.s fa5, v9
439 ; RV64-i32-NEXT: fcvt.l.d a0, fa5
440 ; RV64-i32-NEXT: vfmv.f.s fa5, v8
441 ; RV64-i32-NEXT: fcvt.l.d a1, fa5
442 ; RV64-i32-NEXT: vsetivli zero, 2, e32, mf2, ta, ma
443 ; RV64-i32-NEXT: vmv.v.x v8, a1
444 ; RV64-i32-NEXT: vslide1down.vx v8, v8, a0
447 ; RV64-i64-LABEL: lrint_v2f64:
449 ; RV64-i64-NEXT: vsetivli zero, 1, e64, m1, ta, ma
450 ; RV64-i64-NEXT: vslidedown.vi v9, v8, 1
451 ; RV64-i64-NEXT: vfmv.f.s fa5, v9
452 ; RV64-i64-NEXT: fcvt.l.d a0, fa5
453 ; RV64-i64-NEXT: vfmv.f.s fa5, v8
454 ; RV64-i64-NEXT: fcvt.l.d a1, fa5
455 ; RV64-i64-NEXT: vsetivli zero, 2, e64, m1, ta, ma
456 ; RV64-i64-NEXT: vmv.v.x v8, a1
457 ; RV64-i64-NEXT: vslide1down.vx v8, v8, a0
459 %a = call <2 x iXLen> @llvm.lrint.v2iXLen.v2f64(<2 x double> %x)
462 declare <2 x iXLen> @llvm.lrint.v2iXLen.v2f64(<2 x double>)
464 define <4 x iXLen> @lrint_v4f64(<4 x double> %x) {
465 ; RV32-LABEL: lrint_v4f64:
467 ; RV32-NEXT: vsetivli zero, 1, e64, m1, ta, ma
468 ; RV32-NEXT: vslidedown.vi v10, v8, 1
469 ; RV32-NEXT: vfmv.f.s fa5, v10
470 ; RV32-NEXT: fcvt.w.d a0, fa5
471 ; RV32-NEXT: vfmv.f.s fa5, v8
472 ; RV32-NEXT: fcvt.w.d a1, fa5
473 ; RV32-NEXT: vsetivli zero, 4, e32, m1, ta, ma
474 ; RV32-NEXT: vmv.v.x v10, a1
475 ; RV32-NEXT: vslide1down.vx v10, v10, a0
476 ; RV32-NEXT: vsetivli zero, 1, e64, m2, ta, ma
477 ; RV32-NEXT: vslidedown.vi v12, v8, 2
478 ; RV32-NEXT: vfmv.f.s fa5, v12
479 ; RV32-NEXT: fcvt.w.d a0, fa5
480 ; RV32-NEXT: vsetivli zero, 4, e32, m1, ta, ma
481 ; RV32-NEXT: vslide1down.vx v10, v10, a0
482 ; RV32-NEXT: vsetivli zero, 1, e64, m2, ta, ma
483 ; RV32-NEXT: vslidedown.vi v8, v8, 3
484 ; RV32-NEXT: vfmv.f.s fa5, v8
485 ; RV32-NEXT: fcvt.w.d a0, fa5
486 ; RV32-NEXT: vsetivli zero, 4, e32, m1, ta, ma
487 ; RV32-NEXT: vslide1down.vx v8, v10, a0
490 ; RV64-i32-LABEL: lrint_v4f64:
492 ; RV64-i32-NEXT: vsetivli zero, 1, e64, m1, ta, ma
493 ; RV64-i32-NEXT: vslidedown.vi v10, v8, 1
494 ; RV64-i32-NEXT: vfmv.f.s fa5, v10
495 ; RV64-i32-NEXT: fcvt.l.d a0, fa5
496 ; RV64-i32-NEXT: vfmv.f.s fa5, v8
497 ; RV64-i32-NEXT: fcvt.l.d a1, fa5
498 ; RV64-i32-NEXT: vsetivli zero, 4, e32, m1, ta, ma
499 ; RV64-i32-NEXT: vmv.v.x v10, a1
500 ; RV64-i32-NEXT: vslide1down.vx v10, v10, a0
501 ; RV64-i32-NEXT: vsetivli zero, 1, e64, m2, ta, ma
502 ; RV64-i32-NEXT: vslidedown.vi v12, v8, 2
503 ; RV64-i32-NEXT: vfmv.f.s fa5, v12
504 ; RV64-i32-NEXT: fcvt.l.d a0, fa5
505 ; RV64-i32-NEXT: vsetivli zero, 4, e32, m1, ta, ma
506 ; RV64-i32-NEXT: vslide1down.vx v10, v10, a0
507 ; RV64-i32-NEXT: vsetivli zero, 1, e64, m2, ta, ma
508 ; RV64-i32-NEXT: vslidedown.vi v8, v8, 3
509 ; RV64-i32-NEXT: vfmv.f.s fa5, v8
510 ; RV64-i32-NEXT: fcvt.l.d a0, fa5
511 ; RV64-i32-NEXT: vsetivli zero, 4, e32, m1, ta, ma
512 ; RV64-i32-NEXT: vslide1down.vx v8, v10, a0
515 ; RV64-i64-LABEL: lrint_v4f64:
517 ; RV64-i64-NEXT: vsetivli zero, 1, e64, m1, ta, ma
518 ; RV64-i64-NEXT: vslidedown.vi v10, v8, 1
519 ; RV64-i64-NEXT: vfmv.f.s fa5, v10
520 ; RV64-i64-NEXT: fcvt.l.d a0, fa5
521 ; RV64-i64-NEXT: vfmv.f.s fa5, v8
522 ; RV64-i64-NEXT: fcvt.l.d a1, fa5
523 ; RV64-i64-NEXT: vsetivli zero, 4, e64, m2, ta, ma
524 ; RV64-i64-NEXT: vmv.v.x v10, a1
525 ; RV64-i64-NEXT: vslide1down.vx v10, v10, a0
526 ; RV64-i64-NEXT: vsetivli zero, 1, e64, m2, ta, ma
527 ; RV64-i64-NEXT: vslidedown.vi v12, v8, 2
528 ; RV64-i64-NEXT: vfmv.f.s fa5, v12
529 ; RV64-i64-NEXT: fcvt.l.d a0, fa5
530 ; RV64-i64-NEXT: vsetivli zero, 4, e64, m2, ta, ma
531 ; RV64-i64-NEXT: vslide1down.vx v10, v10, a0
532 ; RV64-i64-NEXT: vsetivli zero, 1, e64, m2, ta, ma
533 ; RV64-i64-NEXT: vslidedown.vi v8, v8, 3
534 ; RV64-i64-NEXT: vfmv.f.s fa5, v8
535 ; RV64-i64-NEXT: fcvt.l.d a0, fa5
536 ; RV64-i64-NEXT: vsetivli zero, 4, e64, m2, ta, ma
537 ; RV64-i64-NEXT: vslide1down.vx v8, v10, a0
539 %a = call <4 x iXLen> @llvm.lrint.v4iXLen.v4f64(<4 x double> %x)
542 declare <4 x iXLen> @llvm.lrint.v4iXLen.v4f64(<4 x double>)
544 define <8 x iXLen> @lrint_v8f64(<8 x double> %x) {
545 ; RV32-LABEL: lrint_v8f64:
547 ; RV32-NEXT: addi sp, sp, -128
548 ; RV32-NEXT: .cfi_def_cfa_offset 128
549 ; RV32-NEXT: sw ra, 124(sp) # 4-byte Folded Spill
550 ; RV32-NEXT: sw s0, 120(sp) # 4-byte Folded Spill
551 ; RV32-NEXT: .cfi_offset ra, -4
552 ; RV32-NEXT: .cfi_offset s0, -8
553 ; RV32-NEXT: addi s0, sp, 128
554 ; RV32-NEXT: .cfi_def_cfa s0, 0
555 ; RV32-NEXT: andi sp, sp, -64
556 ; RV32-NEXT: mv a0, sp
557 ; RV32-NEXT: vsetivli zero, 8, e64, m4, ta, ma
558 ; RV32-NEXT: vse64.v v8, (a0)
559 ; RV32-NEXT: vsetivli zero, 1, e64, m1, ta, ma
560 ; RV32-NEXT: vslidedown.vi v10, v8, 1
561 ; RV32-NEXT: vfmv.f.s fa5, v10
562 ; RV32-NEXT: fcvt.w.d a0, fa5
563 ; RV32-NEXT: vfmv.f.s fa5, v8
564 ; RV32-NEXT: fcvt.w.d a1, fa5
565 ; RV32-NEXT: vsetivli zero, 8, e32, m2, ta, ma
566 ; RV32-NEXT: vmv.v.x v10, a1
567 ; RV32-NEXT: vslide1down.vx v10, v10, a0
568 ; RV32-NEXT: vsetivli zero, 1, e64, m2, ta, ma
569 ; RV32-NEXT: vslidedown.vi v12, v8, 2
570 ; RV32-NEXT: vfmv.f.s fa5, v12
571 ; RV32-NEXT: fcvt.w.d a0, fa5
572 ; RV32-NEXT: vsetivli zero, 8, e32, m2, ta, ma
573 ; RV32-NEXT: vslide1down.vx v10, v10, a0
574 ; RV32-NEXT: vsetivli zero, 1, e64, m2, ta, ma
575 ; RV32-NEXT: vslidedown.vi v8, v8, 3
576 ; RV32-NEXT: vfmv.f.s fa5, v8
577 ; RV32-NEXT: vsetivli zero, 8, e32, m2, ta, ma
578 ; RV32-NEXT: fld fa4, 32(sp)
579 ; RV32-NEXT: fld fa3, 40(sp)
580 ; RV32-NEXT: fcvt.w.d a0, fa5
581 ; RV32-NEXT: fld fa5, 48(sp)
582 ; RV32-NEXT: fcvt.w.d a1, fa4
583 ; RV32-NEXT: fcvt.w.d a2, fa3
584 ; RV32-NEXT: vslide1down.vx v8, v10, a0
585 ; RV32-NEXT: fcvt.w.d a0, fa5
586 ; RV32-NEXT: fld fa5, 56(sp)
587 ; RV32-NEXT: vslide1down.vx v8, v8, a1
588 ; RV32-NEXT: vslide1down.vx v8, v8, a2
589 ; RV32-NEXT: vslide1down.vx v8, v8, a0
590 ; RV32-NEXT: fcvt.w.d a0, fa5
591 ; RV32-NEXT: vslide1down.vx v8, v8, a0
592 ; RV32-NEXT: addi sp, s0, -128
593 ; RV32-NEXT: lw ra, 124(sp) # 4-byte Folded Reload
594 ; RV32-NEXT: lw s0, 120(sp) # 4-byte Folded Reload
595 ; RV32-NEXT: addi sp, sp, 128
598 ; RV64-i32-LABEL: lrint_v8f64:
600 ; RV64-i32-NEXT: addi sp, sp, -128
601 ; RV64-i32-NEXT: .cfi_def_cfa_offset 128
602 ; RV64-i32-NEXT: sd ra, 120(sp) # 8-byte Folded Spill
603 ; RV64-i32-NEXT: sd s0, 112(sp) # 8-byte Folded Spill
604 ; RV64-i32-NEXT: .cfi_offset ra, -8
605 ; RV64-i32-NEXT: .cfi_offset s0, -16
606 ; RV64-i32-NEXT: addi s0, sp, 128
607 ; RV64-i32-NEXT: .cfi_def_cfa s0, 0
608 ; RV64-i32-NEXT: andi sp, sp, -64
609 ; RV64-i32-NEXT: mv a0, sp
610 ; RV64-i32-NEXT: vsetivli zero, 8, e64, m4, ta, ma
611 ; RV64-i32-NEXT: vse64.v v8, (a0)
612 ; RV64-i32-NEXT: vsetivli zero, 1, e64, m1, ta, ma
613 ; RV64-i32-NEXT: vslidedown.vi v10, v8, 1
614 ; RV64-i32-NEXT: vfmv.f.s fa5, v10
615 ; RV64-i32-NEXT: fcvt.l.d a0, fa5
616 ; RV64-i32-NEXT: vfmv.f.s fa5, v8
617 ; RV64-i32-NEXT: fcvt.l.d a1, fa5
618 ; RV64-i32-NEXT: vsetivli zero, 8, e32, m2, ta, ma
619 ; RV64-i32-NEXT: vmv.v.x v10, a1
620 ; RV64-i32-NEXT: vslide1down.vx v10, v10, a0
621 ; RV64-i32-NEXT: vsetivli zero, 1, e64, m2, ta, ma
622 ; RV64-i32-NEXT: vslidedown.vi v12, v8, 2
623 ; RV64-i32-NEXT: vfmv.f.s fa5, v12
624 ; RV64-i32-NEXT: fcvt.l.d a0, fa5
625 ; RV64-i32-NEXT: vsetivli zero, 8, e32, m2, ta, ma
626 ; RV64-i32-NEXT: vslide1down.vx v10, v10, a0
627 ; RV64-i32-NEXT: vsetivli zero, 1, e64, m2, ta, ma
628 ; RV64-i32-NEXT: vslidedown.vi v8, v8, 3
629 ; RV64-i32-NEXT: vfmv.f.s fa5, v8
630 ; RV64-i32-NEXT: vsetivli zero, 8, e32, m2, ta, ma
631 ; RV64-i32-NEXT: fld fa4, 32(sp)
632 ; RV64-i32-NEXT: fld fa3, 40(sp)
633 ; RV64-i32-NEXT: fcvt.l.d a0, fa5
634 ; RV64-i32-NEXT: fld fa5, 48(sp)
635 ; RV64-i32-NEXT: fcvt.l.d a1, fa4
636 ; RV64-i32-NEXT: fcvt.l.d a2, fa3
637 ; RV64-i32-NEXT: vslide1down.vx v8, v10, a0
638 ; RV64-i32-NEXT: fcvt.l.d a0, fa5
639 ; RV64-i32-NEXT: fld fa5, 56(sp)
640 ; RV64-i32-NEXT: vslide1down.vx v8, v8, a1
641 ; RV64-i32-NEXT: vslide1down.vx v8, v8, a2
642 ; RV64-i32-NEXT: vslide1down.vx v8, v8, a0
643 ; RV64-i32-NEXT: fcvt.l.d a0, fa5
644 ; RV64-i32-NEXT: vslide1down.vx v8, v8, a0
645 ; RV64-i32-NEXT: addi sp, s0, -128
646 ; RV64-i32-NEXT: ld ra, 120(sp) # 8-byte Folded Reload
647 ; RV64-i32-NEXT: ld s0, 112(sp) # 8-byte Folded Reload
648 ; RV64-i32-NEXT: addi sp, sp, 128
651 ; RV64-i64-LABEL: lrint_v8f64:
653 ; RV64-i64-NEXT: addi sp, sp, -192
654 ; RV64-i64-NEXT: .cfi_def_cfa_offset 192
655 ; RV64-i64-NEXT: sd ra, 184(sp) # 8-byte Folded Spill
656 ; RV64-i64-NEXT: sd s0, 176(sp) # 8-byte Folded Spill
657 ; RV64-i64-NEXT: .cfi_offset ra, -8
658 ; RV64-i64-NEXT: .cfi_offset s0, -16
659 ; RV64-i64-NEXT: addi s0, sp, 192
660 ; RV64-i64-NEXT: .cfi_def_cfa s0, 0
661 ; RV64-i64-NEXT: andi sp, sp, -64
662 ; RV64-i64-NEXT: mv a0, sp
663 ; RV64-i64-NEXT: vsetivli zero, 8, e64, m4, ta, ma
664 ; RV64-i64-NEXT: vse64.v v8, (a0)
665 ; RV64-i64-NEXT: fld fa5, 56(sp)
666 ; RV64-i64-NEXT: fcvt.l.d a0, fa5
667 ; RV64-i64-NEXT: sd a0, 120(sp)
668 ; RV64-i64-NEXT: fld fa5, 48(sp)
669 ; RV64-i64-NEXT: fcvt.l.d a0, fa5
670 ; RV64-i64-NEXT: sd a0, 112(sp)
671 ; RV64-i64-NEXT: fld fa5, 40(sp)
672 ; RV64-i64-NEXT: fcvt.l.d a0, fa5
673 ; RV64-i64-NEXT: sd a0, 104(sp)
674 ; RV64-i64-NEXT: fld fa5, 32(sp)
675 ; RV64-i64-NEXT: fcvt.l.d a0, fa5
676 ; RV64-i64-NEXT: sd a0, 96(sp)
677 ; RV64-i64-NEXT: vfmv.f.s fa5, v8
678 ; RV64-i64-NEXT: fcvt.l.d a0, fa5
679 ; RV64-i64-NEXT: sd a0, 64(sp)
680 ; RV64-i64-NEXT: vsetivli zero, 1, e64, m1, ta, ma
681 ; RV64-i64-NEXT: vslidedown.vi v10, v8, 1
682 ; RV64-i64-NEXT: vfmv.f.s fa5, v10
683 ; RV64-i64-NEXT: fcvt.l.d a0, fa5
684 ; RV64-i64-NEXT: sd a0, 72(sp)
685 ; RV64-i64-NEXT: vsetivli zero, 1, e64, m2, ta, ma
686 ; RV64-i64-NEXT: vslidedown.vi v10, v8, 3
687 ; RV64-i64-NEXT: vfmv.f.s fa5, v10
688 ; RV64-i64-NEXT: fcvt.l.d a0, fa5
689 ; RV64-i64-NEXT: sd a0, 88(sp)
690 ; RV64-i64-NEXT: vslidedown.vi v8, v8, 2
691 ; RV64-i64-NEXT: vfmv.f.s fa5, v8
692 ; RV64-i64-NEXT: fcvt.l.d a0, fa5
693 ; RV64-i64-NEXT: sd a0, 80(sp)
694 ; RV64-i64-NEXT: addi a0, sp, 64
695 ; RV64-i64-NEXT: vsetivli zero, 8, e64, m4, ta, ma
696 ; RV64-i64-NEXT: vle64.v v8, (a0)
697 ; RV64-i64-NEXT: addi sp, s0, -192
698 ; RV64-i64-NEXT: ld ra, 184(sp) # 8-byte Folded Reload
699 ; RV64-i64-NEXT: ld s0, 176(sp) # 8-byte Folded Reload
700 ; RV64-i64-NEXT: addi sp, sp, 192
702 %a = call <8 x iXLen> @llvm.lrint.v8iXLen.v8f64(<8 x double> %x)
705 declare <8 x iXLen> @llvm.lrint.v8iXLen.v8f64(<8 x double>)