1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=riscv32 -mattr=+f -verify-machineinstrs < %s \
3 ; RUN: -target-abi=ilp32f | FileCheck -check-prefix=RV32IF %s
4 ; RUN: llc -mtriple=riscv64 -mattr=+f -verify-machineinstrs < %s \
5 ; RUN: -target-abi=lp64f | FileCheck -check-prefix=RV64IF %s
6 ; RUN: llc -mtriple=riscv32 -mattr=+zfinx -verify-machineinstrs < %s \
7 ; RUN: -target-abi=ilp32 | FileCheck -check-prefix=RV32IZFINX %s
8 ; RUN: llc -mtriple=riscv64 -mattr=+zfinx -verify-machineinstrs < %s \
9 ; RUN: -target-abi=lp64 | FileCheck -check-prefix=RV64IZFINX %s
11 define signext i8 @test_floor_si8(float %x) {
12 ; RV32IF-LABEL: test_floor_si8:
14 ; RV32IF-NEXT: fcvt.w.s a0, fa0, rdn
17 ; RV64IF-LABEL: test_floor_si8:
19 ; RV64IF-NEXT: fcvt.l.s a0, fa0, rdn
22 ; RV32IZFINX-LABEL: test_floor_si8:
23 ; RV32IZFINX: # %bb.0:
24 ; RV32IZFINX-NEXT: fcvt.w.s a0, a0, rdn
25 ; RV32IZFINX-NEXT: ret
27 ; RV64IZFINX-LABEL: test_floor_si8:
28 ; RV64IZFINX: # %bb.0:
29 ; RV64IZFINX-NEXT: fcvt.l.s a0, a0, rdn
30 ; RV64IZFINX-NEXT: ret
31 %a = call float @llvm.floor.f32(float %x)
32 %b = fptosi float %a to i8
36 define signext i16 @test_floor_si16(float %x) {
37 ; RV32IF-LABEL: test_floor_si16:
39 ; RV32IF-NEXT: fcvt.w.s a0, fa0, rdn
42 ; RV64IF-LABEL: test_floor_si16:
44 ; RV64IF-NEXT: fcvt.l.s a0, fa0, rdn
47 ; RV32IZFINX-LABEL: test_floor_si16:
48 ; RV32IZFINX: # %bb.0:
49 ; RV32IZFINX-NEXT: fcvt.w.s a0, a0, rdn
50 ; RV32IZFINX-NEXT: ret
52 ; RV64IZFINX-LABEL: test_floor_si16:
53 ; RV64IZFINX: # %bb.0:
54 ; RV64IZFINX-NEXT: fcvt.l.s a0, a0, rdn
55 ; RV64IZFINX-NEXT: ret
56 %a = call float @llvm.floor.f32(float %x)
57 %b = fptosi float %a to i16
61 define signext i32 @test_floor_si32(float %x) {
62 ; RV32IF-LABEL: test_floor_si32:
64 ; RV32IF-NEXT: fcvt.w.s a0, fa0, rdn
67 ; RV64IF-LABEL: test_floor_si32:
69 ; RV64IF-NEXT: fcvt.w.s a0, fa0, rdn
72 ; RV32IZFINX-LABEL: test_floor_si32:
73 ; RV32IZFINX: # %bb.0:
74 ; RV32IZFINX-NEXT: fcvt.w.s a0, a0, rdn
75 ; RV32IZFINX-NEXT: ret
77 ; RV64IZFINX-LABEL: test_floor_si32:
78 ; RV64IZFINX: # %bb.0:
79 ; RV64IZFINX-NEXT: fcvt.w.s a0, a0, rdn
80 ; RV64IZFINX-NEXT: ret
81 %a = call float @llvm.floor.f32(float %x)
82 %b = fptosi float %a to i32
86 define i64 @test_floor_si64(float %x) {
87 ; RV32IF-LABEL: test_floor_si64:
89 ; RV32IF-NEXT: lui a0, 307200
90 ; RV32IF-NEXT: fmv.w.x fa5, a0
91 ; RV32IF-NEXT: fabs.s fa4, fa0
92 ; RV32IF-NEXT: flt.s a0, fa4, fa5
93 ; RV32IF-NEXT: beqz a0, .LBB3_2
94 ; RV32IF-NEXT: # %bb.1:
95 ; RV32IF-NEXT: fcvt.w.s a0, fa0, rdn
96 ; RV32IF-NEXT: fcvt.s.w fa5, a0, rdn
97 ; RV32IF-NEXT: fsgnj.s fa0, fa5, fa0
98 ; RV32IF-NEXT: .LBB3_2:
99 ; RV32IF-NEXT: addi sp, sp, -16
100 ; RV32IF-NEXT: .cfi_def_cfa_offset 16
101 ; RV32IF-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
102 ; RV32IF-NEXT: .cfi_offset ra, -4
103 ; RV32IF-NEXT: call __fixsfdi
104 ; RV32IF-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
105 ; RV32IF-NEXT: addi sp, sp, 16
108 ; RV64IF-LABEL: test_floor_si64:
110 ; RV64IF-NEXT: fcvt.l.s a0, fa0, rdn
113 ; RV32IZFINX-LABEL: test_floor_si64:
114 ; RV32IZFINX: # %bb.0:
115 ; RV32IZFINX-NEXT: lui a1, 307200
116 ; RV32IZFINX-NEXT: fabs.s a2, a0
117 ; RV32IZFINX-NEXT: flt.s a1, a2, a1
118 ; RV32IZFINX-NEXT: beqz a1, .LBB3_2
119 ; RV32IZFINX-NEXT: # %bb.1:
120 ; RV32IZFINX-NEXT: fcvt.w.s a1, a0, rdn
121 ; RV32IZFINX-NEXT: fcvt.s.w a1, a1, rdn
122 ; RV32IZFINX-NEXT: fsgnj.s a0, a1, a0
123 ; RV32IZFINX-NEXT: .LBB3_2:
124 ; RV32IZFINX-NEXT: addi sp, sp, -16
125 ; RV32IZFINX-NEXT: .cfi_def_cfa_offset 16
126 ; RV32IZFINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
127 ; RV32IZFINX-NEXT: .cfi_offset ra, -4
128 ; RV32IZFINX-NEXT: call __fixsfdi
129 ; RV32IZFINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
130 ; RV32IZFINX-NEXT: addi sp, sp, 16
131 ; RV32IZFINX-NEXT: ret
133 ; RV64IZFINX-LABEL: test_floor_si64:
134 ; RV64IZFINX: # %bb.0:
135 ; RV64IZFINX-NEXT: fcvt.l.s a0, a0, rdn
136 ; RV64IZFINX-NEXT: ret
137 %a = call float @llvm.floor.f32(float %x)
138 %b = fptosi float %a to i64
142 define zeroext i8 @test_floor_ui8(float %x) {
143 ; RV32IF-LABEL: test_floor_ui8:
145 ; RV32IF-NEXT: fcvt.wu.s a0, fa0, rdn
148 ; RV64IF-LABEL: test_floor_ui8:
150 ; RV64IF-NEXT: fcvt.lu.s a0, fa0, rdn
153 ; RV32IZFINX-LABEL: test_floor_ui8:
154 ; RV32IZFINX: # %bb.0:
155 ; RV32IZFINX-NEXT: fcvt.wu.s a0, a0, rdn
156 ; RV32IZFINX-NEXT: ret
158 ; RV64IZFINX-LABEL: test_floor_ui8:
159 ; RV64IZFINX: # %bb.0:
160 ; RV64IZFINX-NEXT: fcvt.lu.s a0, a0, rdn
161 ; RV64IZFINX-NEXT: ret
162 %a = call float @llvm.floor.f32(float %x)
163 %b = fptoui float %a to i8
167 define zeroext i16 @test_floor_ui16(float %x) {
168 ; RV32IF-LABEL: test_floor_ui16:
170 ; RV32IF-NEXT: fcvt.wu.s a0, fa0, rdn
173 ; RV64IF-LABEL: test_floor_ui16:
175 ; RV64IF-NEXT: fcvt.lu.s a0, fa0, rdn
178 ; RV32IZFINX-LABEL: test_floor_ui16:
179 ; RV32IZFINX: # %bb.0:
180 ; RV32IZFINX-NEXT: fcvt.wu.s a0, a0, rdn
181 ; RV32IZFINX-NEXT: ret
183 ; RV64IZFINX-LABEL: test_floor_ui16:
184 ; RV64IZFINX: # %bb.0:
185 ; RV64IZFINX-NEXT: fcvt.lu.s a0, a0, rdn
186 ; RV64IZFINX-NEXT: ret
187 %a = call float @llvm.floor.f32(float %x)
188 %b = fptoui float %a to i16
192 define signext i32 @test_floor_ui32(float %x) {
193 ; RV32IF-LABEL: test_floor_ui32:
195 ; RV32IF-NEXT: fcvt.wu.s a0, fa0, rdn
198 ; RV64IF-LABEL: test_floor_ui32:
200 ; RV64IF-NEXT: fcvt.wu.s a0, fa0, rdn
203 ; RV32IZFINX-LABEL: test_floor_ui32:
204 ; RV32IZFINX: # %bb.0:
205 ; RV32IZFINX-NEXT: fcvt.wu.s a0, a0, rdn
206 ; RV32IZFINX-NEXT: ret
208 ; RV64IZFINX-LABEL: test_floor_ui32:
209 ; RV64IZFINX: # %bb.0:
210 ; RV64IZFINX-NEXT: fcvt.wu.s a0, a0, rdn
211 ; RV64IZFINX-NEXT: ret
212 %a = call float @llvm.floor.f32(float %x)
213 %b = fptoui float %a to i32
217 define i64 @test_floor_ui64(float %x) {
218 ; RV32IF-LABEL: test_floor_ui64:
220 ; RV32IF-NEXT: lui a0, 307200
221 ; RV32IF-NEXT: fmv.w.x fa5, a0
222 ; RV32IF-NEXT: fabs.s fa4, fa0
223 ; RV32IF-NEXT: flt.s a0, fa4, fa5
224 ; RV32IF-NEXT: beqz a0, .LBB7_2
225 ; RV32IF-NEXT: # %bb.1:
226 ; RV32IF-NEXT: fcvt.w.s a0, fa0, rdn
227 ; RV32IF-NEXT: fcvt.s.w fa5, a0, rdn
228 ; RV32IF-NEXT: fsgnj.s fa0, fa5, fa0
229 ; RV32IF-NEXT: .LBB7_2:
230 ; RV32IF-NEXT: addi sp, sp, -16
231 ; RV32IF-NEXT: .cfi_def_cfa_offset 16
232 ; RV32IF-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
233 ; RV32IF-NEXT: .cfi_offset ra, -4
234 ; RV32IF-NEXT: call __fixunssfdi
235 ; RV32IF-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
236 ; RV32IF-NEXT: addi sp, sp, 16
239 ; RV64IF-LABEL: test_floor_ui64:
241 ; RV64IF-NEXT: fcvt.lu.s a0, fa0, rdn
244 ; RV32IZFINX-LABEL: test_floor_ui64:
245 ; RV32IZFINX: # %bb.0:
246 ; RV32IZFINX-NEXT: lui a1, 307200
247 ; RV32IZFINX-NEXT: fabs.s a2, a0
248 ; RV32IZFINX-NEXT: flt.s a1, a2, a1
249 ; RV32IZFINX-NEXT: beqz a1, .LBB7_2
250 ; RV32IZFINX-NEXT: # %bb.1:
251 ; RV32IZFINX-NEXT: fcvt.w.s a1, a0, rdn
252 ; RV32IZFINX-NEXT: fcvt.s.w a1, a1, rdn
253 ; RV32IZFINX-NEXT: fsgnj.s a0, a1, a0
254 ; RV32IZFINX-NEXT: .LBB7_2:
255 ; RV32IZFINX-NEXT: addi sp, sp, -16
256 ; RV32IZFINX-NEXT: .cfi_def_cfa_offset 16
257 ; RV32IZFINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
258 ; RV32IZFINX-NEXT: .cfi_offset ra, -4
259 ; RV32IZFINX-NEXT: call __fixunssfdi
260 ; RV32IZFINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
261 ; RV32IZFINX-NEXT: addi sp, sp, 16
262 ; RV32IZFINX-NEXT: ret
264 ; RV64IZFINX-LABEL: test_floor_ui64:
265 ; RV64IZFINX: # %bb.0:
266 ; RV64IZFINX-NEXT: fcvt.lu.s a0, a0, rdn
267 ; RV64IZFINX-NEXT: ret
268 %a = call float @llvm.floor.f32(float %x)
269 %b = fptoui float %a to i64
273 define signext i8 @test_ceil_si8(float %x) {
274 ; RV32IF-LABEL: test_ceil_si8:
276 ; RV32IF-NEXT: fcvt.w.s a0, fa0, rup
279 ; RV64IF-LABEL: test_ceil_si8:
281 ; RV64IF-NEXT: fcvt.l.s a0, fa0, rup
284 ; RV32IZFINX-LABEL: test_ceil_si8:
285 ; RV32IZFINX: # %bb.0:
286 ; RV32IZFINX-NEXT: fcvt.w.s a0, a0, rup
287 ; RV32IZFINX-NEXT: ret
289 ; RV64IZFINX-LABEL: test_ceil_si8:
290 ; RV64IZFINX: # %bb.0:
291 ; RV64IZFINX-NEXT: fcvt.l.s a0, a0, rup
292 ; RV64IZFINX-NEXT: ret
293 %a = call float @llvm.ceil.f32(float %x)
294 %b = fptosi float %a to i8
298 define signext i16 @test_ceil_si16(float %x) {
299 ; RV32IF-LABEL: test_ceil_si16:
301 ; RV32IF-NEXT: fcvt.w.s a0, fa0, rup
304 ; RV64IF-LABEL: test_ceil_si16:
306 ; RV64IF-NEXT: fcvt.l.s a0, fa0, rup
309 ; RV32IZFINX-LABEL: test_ceil_si16:
310 ; RV32IZFINX: # %bb.0:
311 ; RV32IZFINX-NEXT: fcvt.w.s a0, a0, rup
312 ; RV32IZFINX-NEXT: ret
314 ; RV64IZFINX-LABEL: test_ceil_si16:
315 ; RV64IZFINX: # %bb.0:
316 ; RV64IZFINX-NEXT: fcvt.l.s a0, a0, rup
317 ; RV64IZFINX-NEXT: ret
318 %a = call float @llvm.ceil.f32(float %x)
319 %b = fptosi float %a to i16
323 define signext i32 @test_ceil_si32(float %x) {
324 ; RV32IF-LABEL: test_ceil_si32:
326 ; RV32IF-NEXT: fcvt.w.s a0, fa0, rup
329 ; RV64IF-LABEL: test_ceil_si32:
331 ; RV64IF-NEXT: fcvt.w.s a0, fa0, rup
334 ; RV32IZFINX-LABEL: test_ceil_si32:
335 ; RV32IZFINX: # %bb.0:
336 ; RV32IZFINX-NEXT: fcvt.w.s a0, a0, rup
337 ; RV32IZFINX-NEXT: ret
339 ; RV64IZFINX-LABEL: test_ceil_si32:
340 ; RV64IZFINX: # %bb.0:
341 ; RV64IZFINX-NEXT: fcvt.w.s a0, a0, rup
342 ; RV64IZFINX-NEXT: ret
343 %a = call float @llvm.ceil.f32(float %x)
344 %b = fptosi float %a to i32
348 define i64 @test_ceil_si64(float %x) {
349 ; RV32IF-LABEL: test_ceil_si64:
351 ; RV32IF-NEXT: lui a0, 307200
352 ; RV32IF-NEXT: fmv.w.x fa5, a0
353 ; RV32IF-NEXT: fabs.s fa4, fa0
354 ; RV32IF-NEXT: flt.s a0, fa4, fa5
355 ; RV32IF-NEXT: beqz a0, .LBB11_2
356 ; RV32IF-NEXT: # %bb.1:
357 ; RV32IF-NEXT: fcvt.w.s a0, fa0, rup
358 ; RV32IF-NEXT: fcvt.s.w fa5, a0, rup
359 ; RV32IF-NEXT: fsgnj.s fa0, fa5, fa0
360 ; RV32IF-NEXT: .LBB11_2:
361 ; RV32IF-NEXT: addi sp, sp, -16
362 ; RV32IF-NEXT: .cfi_def_cfa_offset 16
363 ; RV32IF-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
364 ; RV32IF-NEXT: .cfi_offset ra, -4
365 ; RV32IF-NEXT: call __fixsfdi
366 ; RV32IF-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
367 ; RV32IF-NEXT: addi sp, sp, 16
370 ; RV64IF-LABEL: test_ceil_si64:
372 ; RV64IF-NEXT: fcvt.l.s a0, fa0, rup
375 ; RV32IZFINX-LABEL: test_ceil_si64:
376 ; RV32IZFINX: # %bb.0:
377 ; RV32IZFINX-NEXT: lui a1, 307200
378 ; RV32IZFINX-NEXT: fabs.s a2, a0
379 ; RV32IZFINX-NEXT: flt.s a1, a2, a1
380 ; RV32IZFINX-NEXT: beqz a1, .LBB11_2
381 ; RV32IZFINX-NEXT: # %bb.1:
382 ; RV32IZFINX-NEXT: fcvt.w.s a1, a0, rup
383 ; RV32IZFINX-NEXT: fcvt.s.w a1, a1, rup
384 ; RV32IZFINX-NEXT: fsgnj.s a0, a1, a0
385 ; RV32IZFINX-NEXT: .LBB11_2:
386 ; RV32IZFINX-NEXT: addi sp, sp, -16
387 ; RV32IZFINX-NEXT: .cfi_def_cfa_offset 16
388 ; RV32IZFINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
389 ; RV32IZFINX-NEXT: .cfi_offset ra, -4
390 ; RV32IZFINX-NEXT: call __fixsfdi
391 ; RV32IZFINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
392 ; RV32IZFINX-NEXT: addi sp, sp, 16
393 ; RV32IZFINX-NEXT: ret
395 ; RV64IZFINX-LABEL: test_ceil_si64:
396 ; RV64IZFINX: # %bb.0:
397 ; RV64IZFINX-NEXT: fcvt.l.s a0, a0, rup
398 ; RV64IZFINX-NEXT: ret
399 %a = call float @llvm.ceil.f32(float %x)
400 %b = fptosi float %a to i64
404 define zeroext i8 @test_ceil_ui8(float %x) {
405 ; RV32IF-LABEL: test_ceil_ui8:
407 ; RV32IF-NEXT: fcvt.wu.s a0, fa0, rup
410 ; RV64IF-LABEL: test_ceil_ui8:
412 ; RV64IF-NEXT: fcvt.lu.s a0, fa0, rup
415 ; RV32IZFINX-LABEL: test_ceil_ui8:
416 ; RV32IZFINX: # %bb.0:
417 ; RV32IZFINX-NEXT: fcvt.wu.s a0, a0, rup
418 ; RV32IZFINX-NEXT: ret
420 ; RV64IZFINX-LABEL: test_ceil_ui8:
421 ; RV64IZFINX: # %bb.0:
422 ; RV64IZFINX-NEXT: fcvt.lu.s a0, a0, rup
423 ; RV64IZFINX-NEXT: ret
424 %a = call float @llvm.ceil.f32(float %x)
425 %b = fptoui float %a to i8
429 define zeroext i16 @test_ceil_ui16(float %x) {
430 ; RV32IF-LABEL: test_ceil_ui16:
432 ; RV32IF-NEXT: fcvt.wu.s a0, fa0, rup
435 ; RV64IF-LABEL: test_ceil_ui16:
437 ; RV64IF-NEXT: fcvt.lu.s a0, fa0, rup
440 ; RV32IZFINX-LABEL: test_ceil_ui16:
441 ; RV32IZFINX: # %bb.0:
442 ; RV32IZFINX-NEXT: fcvt.wu.s a0, a0, rup
443 ; RV32IZFINX-NEXT: ret
445 ; RV64IZFINX-LABEL: test_ceil_ui16:
446 ; RV64IZFINX: # %bb.0:
447 ; RV64IZFINX-NEXT: fcvt.lu.s a0, a0, rup
448 ; RV64IZFINX-NEXT: ret
449 %a = call float @llvm.ceil.f32(float %x)
450 %b = fptoui float %a to i16
454 define signext i32 @test_ceil_ui32(float %x) {
455 ; RV32IF-LABEL: test_ceil_ui32:
457 ; RV32IF-NEXT: fcvt.wu.s a0, fa0, rup
460 ; RV64IF-LABEL: test_ceil_ui32:
462 ; RV64IF-NEXT: fcvt.wu.s a0, fa0, rup
465 ; RV32IZFINX-LABEL: test_ceil_ui32:
466 ; RV32IZFINX: # %bb.0:
467 ; RV32IZFINX-NEXT: fcvt.wu.s a0, a0, rup
468 ; RV32IZFINX-NEXT: ret
470 ; RV64IZFINX-LABEL: test_ceil_ui32:
471 ; RV64IZFINX: # %bb.0:
472 ; RV64IZFINX-NEXT: fcvt.wu.s a0, a0, rup
473 ; RV64IZFINX-NEXT: ret
474 %a = call float @llvm.ceil.f32(float %x)
475 %b = fptoui float %a to i32
479 define i64 @test_ceil_ui64(float %x) {
480 ; RV32IF-LABEL: test_ceil_ui64:
482 ; RV32IF-NEXT: lui a0, 307200
483 ; RV32IF-NEXT: fmv.w.x fa5, a0
484 ; RV32IF-NEXT: fabs.s fa4, fa0
485 ; RV32IF-NEXT: flt.s a0, fa4, fa5
486 ; RV32IF-NEXT: beqz a0, .LBB15_2
487 ; RV32IF-NEXT: # %bb.1:
488 ; RV32IF-NEXT: fcvt.w.s a0, fa0, rup
489 ; RV32IF-NEXT: fcvt.s.w fa5, a0, rup
490 ; RV32IF-NEXT: fsgnj.s fa0, fa5, fa0
491 ; RV32IF-NEXT: .LBB15_2:
492 ; RV32IF-NEXT: addi sp, sp, -16
493 ; RV32IF-NEXT: .cfi_def_cfa_offset 16
494 ; RV32IF-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
495 ; RV32IF-NEXT: .cfi_offset ra, -4
496 ; RV32IF-NEXT: call __fixunssfdi
497 ; RV32IF-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
498 ; RV32IF-NEXT: addi sp, sp, 16
501 ; RV64IF-LABEL: test_ceil_ui64:
503 ; RV64IF-NEXT: fcvt.lu.s a0, fa0, rup
506 ; RV32IZFINX-LABEL: test_ceil_ui64:
507 ; RV32IZFINX: # %bb.0:
508 ; RV32IZFINX-NEXT: lui a1, 307200
509 ; RV32IZFINX-NEXT: fabs.s a2, a0
510 ; RV32IZFINX-NEXT: flt.s a1, a2, a1
511 ; RV32IZFINX-NEXT: beqz a1, .LBB15_2
512 ; RV32IZFINX-NEXT: # %bb.1:
513 ; RV32IZFINX-NEXT: fcvt.w.s a1, a0, rup
514 ; RV32IZFINX-NEXT: fcvt.s.w a1, a1, rup
515 ; RV32IZFINX-NEXT: fsgnj.s a0, a1, a0
516 ; RV32IZFINX-NEXT: .LBB15_2:
517 ; RV32IZFINX-NEXT: addi sp, sp, -16
518 ; RV32IZFINX-NEXT: .cfi_def_cfa_offset 16
519 ; RV32IZFINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
520 ; RV32IZFINX-NEXT: .cfi_offset ra, -4
521 ; RV32IZFINX-NEXT: call __fixunssfdi
522 ; RV32IZFINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
523 ; RV32IZFINX-NEXT: addi sp, sp, 16
524 ; RV32IZFINX-NEXT: ret
526 ; RV64IZFINX-LABEL: test_ceil_ui64:
527 ; RV64IZFINX: # %bb.0:
528 ; RV64IZFINX-NEXT: fcvt.lu.s a0, a0, rup
529 ; RV64IZFINX-NEXT: ret
530 %a = call float @llvm.ceil.f32(float %x)
531 %b = fptoui float %a to i64
535 define signext i8 @test_trunc_si8(float %x) {
536 ; RV32IF-LABEL: test_trunc_si8:
538 ; RV32IF-NEXT: fcvt.w.s a0, fa0, rtz
541 ; RV64IF-LABEL: test_trunc_si8:
543 ; RV64IF-NEXT: fcvt.l.s a0, fa0, rtz
546 ; RV32IZFINX-LABEL: test_trunc_si8:
547 ; RV32IZFINX: # %bb.0:
548 ; RV32IZFINX-NEXT: fcvt.w.s a0, a0, rtz
549 ; RV32IZFINX-NEXT: ret
551 ; RV64IZFINX-LABEL: test_trunc_si8:
552 ; RV64IZFINX: # %bb.0:
553 ; RV64IZFINX-NEXT: fcvt.l.s a0, a0, rtz
554 ; RV64IZFINX-NEXT: ret
555 %a = call float @llvm.trunc.f32(float %x)
556 %b = fptosi float %a to i8
560 define signext i16 @test_trunc_si16(float %x) {
561 ; RV32IF-LABEL: test_trunc_si16:
563 ; RV32IF-NEXT: fcvt.w.s a0, fa0, rtz
566 ; RV64IF-LABEL: test_trunc_si16:
568 ; RV64IF-NEXT: fcvt.l.s a0, fa0, rtz
571 ; RV32IZFINX-LABEL: test_trunc_si16:
572 ; RV32IZFINX: # %bb.0:
573 ; RV32IZFINX-NEXT: fcvt.w.s a0, a0, rtz
574 ; RV32IZFINX-NEXT: ret
576 ; RV64IZFINX-LABEL: test_trunc_si16:
577 ; RV64IZFINX: # %bb.0:
578 ; RV64IZFINX-NEXT: fcvt.l.s a0, a0, rtz
579 ; RV64IZFINX-NEXT: ret
580 %a = call float @llvm.trunc.f32(float %x)
581 %b = fptosi float %a to i16
585 define signext i32 @test_trunc_si32(float %x) {
586 ; RV32IF-LABEL: test_trunc_si32:
588 ; RV32IF-NEXT: fcvt.w.s a0, fa0, rtz
591 ; RV64IF-LABEL: test_trunc_si32:
593 ; RV64IF-NEXT: fcvt.w.s a0, fa0, rtz
596 ; RV32IZFINX-LABEL: test_trunc_si32:
597 ; RV32IZFINX: # %bb.0:
598 ; RV32IZFINX-NEXT: fcvt.w.s a0, a0, rtz
599 ; RV32IZFINX-NEXT: ret
601 ; RV64IZFINX-LABEL: test_trunc_si32:
602 ; RV64IZFINX: # %bb.0:
603 ; RV64IZFINX-NEXT: fcvt.w.s a0, a0, rtz
604 ; RV64IZFINX-NEXT: ret
605 %a = call float @llvm.trunc.f32(float %x)
606 %b = fptosi float %a to i32
610 define i64 @test_trunc_si64(float %x) {
611 ; RV32IF-LABEL: test_trunc_si64:
613 ; RV32IF-NEXT: lui a0, 307200
614 ; RV32IF-NEXT: fmv.w.x fa5, a0
615 ; RV32IF-NEXT: fabs.s fa4, fa0
616 ; RV32IF-NEXT: flt.s a0, fa4, fa5
617 ; RV32IF-NEXT: beqz a0, .LBB19_2
618 ; RV32IF-NEXT: # %bb.1:
619 ; RV32IF-NEXT: fcvt.w.s a0, fa0, rtz
620 ; RV32IF-NEXT: fcvt.s.w fa5, a0, rtz
621 ; RV32IF-NEXT: fsgnj.s fa0, fa5, fa0
622 ; RV32IF-NEXT: .LBB19_2:
623 ; RV32IF-NEXT: addi sp, sp, -16
624 ; RV32IF-NEXT: .cfi_def_cfa_offset 16
625 ; RV32IF-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
626 ; RV32IF-NEXT: .cfi_offset ra, -4
627 ; RV32IF-NEXT: call __fixsfdi
628 ; RV32IF-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
629 ; RV32IF-NEXT: addi sp, sp, 16
632 ; RV64IF-LABEL: test_trunc_si64:
634 ; RV64IF-NEXT: fcvt.l.s a0, fa0, rtz
637 ; RV32IZFINX-LABEL: test_trunc_si64:
638 ; RV32IZFINX: # %bb.0:
639 ; RV32IZFINX-NEXT: lui a1, 307200
640 ; RV32IZFINX-NEXT: fabs.s a2, a0
641 ; RV32IZFINX-NEXT: flt.s a1, a2, a1
642 ; RV32IZFINX-NEXT: beqz a1, .LBB19_2
643 ; RV32IZFINX-NEXT: # %bb.1:
644 ; RV32IZFINX-NEXT: fcvt.w.s a1, a0, rtz
645 ; RV32IZFINX-NEXT: fcvt.s.w a1, a1, rtz
646 ; RV32IZFINX-NEXT: fsgnj.s a0, a1, a0
647 ; RV32IZFINX-NEXT: .LBB19_2:
648 ; RV32IZFINX-NEXT: addi sp, sp, -16
649 ; RV32IZFINX-NEXT: .cfi_def_cfa_offset 16
650 ; RV32IZFINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
651 ; RV32IZFINX-NEXT: .cfi_offset ra, -4
652 ; RV32IZFINX-NEXT: call __fixsfdi
653 ; RV32IZFINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
654 ; RV32IZFINX-NEXT: addi sp, sp, 16
655 ; RV32IZFINX-NEXT: ret
657 ; RV64IZFINX-LABEL: test_trunc_si64:
658 ; RV64IZFINX: # %bb.0:
659 ; RV64IZFINX-NEXT: fcvt.l.s a0, a0, rtz
660 ; RV64IZFINX-NEXT: ret
661 %a = call float @llvm.trunc.f32(float %x)
662 %b = fptosi float %a to i64
666 define zeroext i8 @test_trunc_ui8(float %x) {
667 ; RV32IF-LABEL: test_trunc_ui8:
669 ; RV32IF-NEXT: fcvt.wu.s a0, fa0, rtz
672 ; RV64IF-LABEL: test_trunc_ui8:
674 ; RV64IF-NEXT: fcvt.lu.s a0, fa0, rtz
677 ; RV32IZFINX-LABEL: test_trunc_ui8:
678 ; RV32IZFINX: # %bb.0:
679 ; RV32IZFINX-NEXT: fcvt.wu.s a0, a0, rtz
680 ; RV32IZFINX-NEXT: ret
682 ; RV64IZFINX-LABEL: test_trunc_ui8:
683 ; RV64IZFINX: # %bb.0:
684 ; RV64IZFINX-NEXT: fcvt.lu.s a0, a0, rtz
685 ; RV64IZFINX-NEXT: ret
686 %a = call float @llvm.trunc.f32(float %x)
687 %b = fptoui float %a to i8
691 define zeroext i16 @test_trunc_ui16(float %x) {
692 ; RV32IF-LABEL: test_trunc_ui16:
694 ; RV32IF-NEXT: fcvt.wu.s a0, fa0, rtz
697 ; RV64IF-LABEL: test_trunc_ui16:
699 ; RV64IF-NEXT: fcvt.lu.s a0, fa0, rtz
702 ; RV32IZFINX-LABEL: test_trunc_ui16:
703 ; RV32IZFINX: # %bb.0:
704 ; RV32IZFINX-NEXT: fcvt.wu.s a0, a0, rtz
705 ; RV32IZFINX-NEXT: ret
707 ; RV64IZFINX-LABEL: test_trunc_ui16:
708 ; RV64IZFINX: # %bb.0:
709 ; RV64IZFINX-NEXT: fcvt.lu.s a0, a0, rtz
710 ; RV64IZFINX-NEXT: ret
711 %a = call float @llvm.trunc.f32(float %x)
712 %b = fptoui float %a to i16
716 define signext i32 @test_trunc_ui32(float %x) {
717 ; RV32IF-LABEL: test_trunc_ui32:
719 ; RV32IF-NEXT: fcvt.wu.s a0, fa0, rtz
722 ; RV64IF-LABEL: test_trunc_ui32:
724 ; RV64IF-NEXT: fcvt.wu.s a0, fa0, rtz
727 ; RV32IZFINX-LABEL: test_trunc_ui32:
728 ; RV32IZFINX: # %bb.0:
729 ; RV32IZFINX-NEXT: fcvt.wu.s a0, a0, rtz
730 ; RV32IZFINX-NEXT: ret
732 ; RV64IZFINX-LABEL: test_trunc_ui32:
733 ; RV64IZFINX: # %bb.0:
734 ; RV64IZFINX-NEXT: fcvt.wu.s a0, a0, rtz
735 ; RV64IZFINX-NEXT: ret
736 %a = call float @llvm.trunc.f32(float %x)
737 %b = fptoui float %a to i32
741 define i64 @test_trunc_ui64(float %x) {
742 ; RV32IF-LABEL: test_trunc_ui64:
744 ; RV32IF-NEXT: lui a0, 307200
745 ; RV32IF-NEXT: fmv.w.x fa5, a0
746 ; RV32IF-NEXT: fabs.s fa4, fa0
747 ; RV32IF-NEXT: flt.s a0, fa4, fa5
748 ; RV32IF-NEXT: beqz a0, .LBB23_2
749 ; RV32IF-NEXT: # %bb.1:
750 ; RV32IF-NEXT: fcvt.w.s a0, fa0, rtz
751 ; RV32IF-NEXT: fcvt.s.w fa5, a0, rtz
752 ; RV32IF-NEXT: fsgnj.s fa0, fa5, fa0
753 ; RV32IF-NEXT: .LBB23_2:
754 ; RV32IF-NEXT: addi sp, sp, -16
755 ; RV32IF-NEXT: .cfi_def_cfa_offset 16
756 ; RV32IF-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
757 ; RV32IF-NEXT: .cfi_offset ra, -4
758 ; RV32IF-NEXT: call __fixunssfdi
759 ; RV32IF-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
760 ; RV32IF-NEXT: addi sp, sp, 16
763 ; RV64IF-LABEL: test_trunc_ui64:
765 ; RV64IF-NEXT: fcvt.lu.s a0, fa0, rtz
768 ; RV32IZFINX-LABEL: test_trunc_ui64:
769 ; RV32IZFINX: # %bb.0:
770 ; RV32IZFINX-NEXT: lui a1, 307200
771 ; RV32IZFINX-NEXT: fabs.s a2, a0
772 ; RV32IZFINX-NEXT: flt.s a1, a2, a1
773 ; RV32IZFINX-NEXT: beqz a1, .LBB23_2
774 ; RV32IZFINX-NEXT: # %bb.1:
775 ; RV32IZFINX-NEXT: fcvt.w.s a1, a0, rtz
776 ; RV32IZFINX-NEXT: fcvt.s.w a1, a1, rtz
777 ; RV32IZFINX-NEXT: fsgnj.s a0, a1, a0
778 ; RV32IZFINX-NEXT: .LBB23_2:
779 ; RV32IZFINX-NEXT: addi sp, sp, -16
780 ; RV32IZFINX-NEXT: .cfi_def_cfa_offset 16
781 ; RV32IZFINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
782 ; RV32IZFINX-NEXT: .cfi_offset ra, -4
783 ; RV32IZFINX-NEXT: call __fixunssfdi
784 ; RV32IZFINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
785 ; RV32IZFINX-NEXT: addi sp, sp, 16
786 ; RV32IZFINX-NEXT: ret
788 ; RV64IZFINX-LABEL: test_trunc_ui64:
789 ; RV64IZFINX: # %bb.0:
790 ; RV64IZFINX-NEXT: fcvt.lu.s a0, a0, rtz
791 ; RV64IZFINX-NEXT: ret
792 %a = call float @llvm.trunc.f32(float %x)
793 %b = fptoui float %a to i64
797 define signext i8 @test_round_si8(float %x) {
798 ; RV32IF-LABEL: test_round_si8:
800 ; RV32IF-NEXT: fcvt.w.s a0, fa0, rmm
803 ; RV64IF-LABEL: test_round_si8:
805 ; RV64IF-NEXT: fcvt.l.s a0, fa0, rmm
808 ; RV32IZFINX-LABEL: test_round_si8:
809 ; RV32IZFINX: # %bb.0:
810 ; RV32IZFINX-NEXT: fcvt.w.s a0, a0, rmm
811 ; RV32IZFINX-NEXT: ret
813 ; RV64IZFINX-LABEL: test_round_si8:
814 ; RV64IZFINX: # %bb.0:
815 ; RV64IZFINX-NEXT: fcvt.l.s a0, a0, rmm
816 ; RV64IZFINX-NEXT: ret
817 %a = call float @llvm.round.f32(float %x)
818 %b = fptosi float %a to i8
822 define signext i16 @test_round_si16(float %x) {
823 ; RV32IF-LABEL: test_round_si16:
825 ; RV32IF-NEXT: fcvt.w.s a0, fa0, rmm
828 ; RV64IF-LABEL: test_round_si16:
830 ; RV64IF-NEXT: fcvt.l.s a0, fa0, rmm
833 ; RV32IZFINX-LABEL: test_round_si16:
834 ; RV32IZFINX: # %bb.0:
835 ; RV32IZFINX-NEXT: fcvt.w.s a0, a0, rmm
836 ; RV32IZFINX-NEXT: ret
838 ; RV64IZFINX-LABEL: test_round_si16:
839 ; RV64IZFINX: # %bb.0:
840 ; RV64IZFINX-NEXT: fcvt.l.s a0, a0, rmm
841 ; RV64IZFINX-NEXT: ret
842 %a = call float @llvm.round.f32(float %x)
843 %b = fptosi float %a to i16
847 define signext i32 @test_round_si32(float %x) {
848 ; RV32IF-LABEL: test_round_si32:
850 ; RV32IF-NEXT: fcvt.w.s a0, fa0, rmm
853 ; RV64IF-LABEL: test_round_si32:
855 ; RV64IF-NEXT: fcvt.w.s a0, fa0, rmm
858 ; RV32IZFINX-LABEL: test_round_si32:
859 ; RV32IZFINX: # %bb.0:
860 ; RV32IZFINX-NEXT: fcvt.w.s a0, a0, rmm
861 ; RV32IZFINX-NEXT: ret
863 ; RV64IZFINX-LABEL: test_round_si32:
864 ; RV64IZFINX: # %bb.0:
865 ; RV64IZFINX-NEXT: fcvt.w.s a0, a0, rmm
866 ; RV64IZFINX-NEXT: ret
867 %a = call float @llvm.round.f32(float %x)
868 %b = fptosi float %a to i32
872 define i64 @test_round_si64(float %x) {
873 ; RV32IF-LABEL: test_round_si64:
875 ; RV32IF-NEXT: lui a0, 307200
876 ; RV32IF-NEXT: fmv.w.x fa5, a0
877 ; RV32IF-NEXT: fabs.s fa4, fa0
878 ; RV32IF-NEXT: flt.s a0, fa4, fa5
879 ; RV32IF-NEXT: beqz a0, .LBB27_2
880 ; RV32IF-NEXT: # %bb.1:
881 ; RV32IF-NEXT: fcvt.w.s a0, fa0, rmm
882 ; RV32IF-NEXT: fcvt.s.w fa5, a0, rmm
883 ; RV32IF-NEXT: fsgnj.s fa0, fa5, fa0
884 ; RV32IF-NEXT: .LBB27_2:
885 ; RV32IF-NEXT: addi sp, sp, -16
886 ; RV32IF-NEXT: .cfi_def_cfa_offset 16
887 ; RV32IF-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
888 ; RV32IF-NEXT: .cfi_offset ra, -4
889 ; RV32IF-NEXT: call __fixsfdi
890 ; RV32IF-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
891 ; RV32IF-NEXT: addi sp, sp, 16
894 ; RV64IF-LABEL: test_round_si64:
896 ; RV64IF-NEXT: fcvt.l.s a0, fa0, rmm
899 ; RV32IZFINX-LABEL: test_round_si64:
900 ; RV32IZFINX: # %bb.0:
901 ; RV32IZFINX-NEXT: lui a1, 307200
902 ; RV32IZFINX-NEXT: fabs.s a2, a0
903 ; RV32IZFINX-NEXT: flt.s a1, a2, a1
904 ; RV32IZFINX-NEXT: beqz a1, .LBB27_2
905 ; RV32IZFINX-NEXT: # %bb.1:
906 ; RV32IZFINX-NEXT: fcvt.w.s a1, a0, rmm
907 ; RV32IZFINX-NEXT: fcvt.s.w a1, a1, rmm
908 ; RV32IZFINX-NEXT: fsgnj.s a0, a1, a0
909 ; RV32IZFINX-NEXT: .LBB27_2:
910 ; RV32IZFINX-NEXT: addi sp, sp, -16
911 ; RV32IZFINX-NEXT: .cfi_def_cfa_offset 16
912 ; RV32IZFINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
913 ; RV32IZFINX-NEXT: .cfi_offset ra, -4
914 ; RV32IZFINX-NEXT: call __fixsfdi
915 ; RV32IZFINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
916 ; RV32IZFINX-NEXT: addi sp, sp, 16
917 ; RV32IZFINX-NEXT: ret
919 ; RV64IZFINX-LABEL: test_round_si64:
920 ; RV64IZFINX: # %bb.0:
921 ; RV64IZFINX-NEXT: fcvt.l.s a0, a0, rmm
922 ; RV64IZFINX-NEXT: ret
923 %a = call float @llvm.round.f32(float %x)
924 %b = fptosi float %a to i64
928 define zeroext i8 @test_round_ui8(float %x) {
929 ; RV32IF-LABEL: test_round_ui8:
931 ; RV32IF-NEXT: fcvt.wu.s a0, fa0, rmm
934 ; RV64IF-LABEL: test_round_ui8:
936 ; RV64IF-NEXT: fcvt.lu.s a0, fa0, rmm
939 ; RV32IZFINX-LABEL: test_round_ui8:
940 ; RV32IZFINX: # %bb.0:
941 ; RV32IZFINX-NEXT: fcvt.wu.s a0, a0, rmm
942 ; RV32IZFINX-NEXT: ret
944 ; RV64IZFINX-LABEL: test_round_ui8:
945 ; RV64IZFINX: # %bb.0:
946 ; RV64IZFINX-NEXT: fcvt.lu.s a0, a0, rmm
947 ; RV64IZFINX-NEXT: ret
948 %a = call float @llvm.round.f32(float %x)
949 %b = fptoui float %a to i8
953 define zeroext i16 @test_round_ui16(float %x) {
954 ; RV32IF-LABEL: test_round_ui16:
956 ; RV32IF-NEXT: fcvt.wu.s a0, fa0, rmm
959 ; RV64IF-LABEL: test_round_ui16:
961 ; RV64IF-NEXT: fcvt.lu.s a0, fa0, rmm
964 ; RV32IZFINX-LABEL: test_round_ui16:
965 ; RV32IZFINX: # %bb.0:
966 ; RV32IZFINX-NEXT: fcvt.wu.s a0, a0, rmm
967 ; RV32IZFINX-NEXT: ret
969 ; RV64IZFINX-LABEL: test_round_ui16:
970 ; RV64IZFINX: # %bb.0:
971 ; RV64IZFINX-NEXT: fcvt.lu.s a0, a0, rmm
972 ; RV64IZFINX-NEXT: ret
973 %a = call float @llvm.round.f32(float %x)
974 %b = fptoui float %a to i16
978 define signext i32 @test_round_ui32(float %x) {
979 ; RV32IF-LABEL: test_round_ui32:
981 ; RV32IF-NEXT: fcvt.wu.s a0, fa0, rmm
984 ; RV64IF-LABEL: test_round_ui32:
986 ; RV64IF-NEXT: fcvt.wu.s a0, fa0, rmm
989 ; RV32IZFINX-LABEL: test_round_ui32:
990 ; RV32IZFINX: # %bb.0:
991 ; RV32IZFINX-NEXT: fcvt.wu.s a0, a0, rmm
992 ; RV32IZFINX-NEXT: ret
994 ; RV64IZFINX-LABEL: test_round_ui32:
995 ; RV64IZFINX: # %bb.0:
996 ; RV64IZFINX-NEXT: fcvt.wu.s a0, a0, rmm
997 ; RV64IZFINX-NEXT: ret
998 %a = call float @llvm.round.f32(float %x)
999 %b = fptoui float %a to i32
1003 define i64 @test_round_ui64(float %x) {
1004 ; RV32IF-LABEL: test_round_ui64:
1006 ; RV32IF-NEXT: lui a0, 307200
1007 ; RV32IF-NEXT: fmv.w.x fa5, a0
1008 ; RV32IF-NEXT: fabs.s fa4, fa0
1009 ; RV32IF-NEXT: flt.s a0, fa4, fa5
1010 ; RV32IF-NEXT: beqz a0, .LBB31_2
1011 ; RV32IF-NEXT: # %bb.1:
1012 ; RV32IF-NEXT: fcvt.w.s a0, fa0, rmm
1013 ; RV32IF-NEXT: fcvt.s.w fa5, a0, rmm
1014 ; RV32IF-NEXT: fsgnj.s fa0, fa5, fa0
1015 ; RV32IF-NEXT: .LBB31_2:
1016 ; RV32IF-NEXT: addi sp, sp, -16
1017 ; RV32IF-NEXT: .cfi_def_cfa_offset 16
1018 ; RV32IF-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
1019 ; RV32IF-NEXT: .cfi_offset ra, -4
1020 ; RV32IF-NEXT: call __fixunssfdi
1021 ; RV32IF-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
1022 ; RV32IF-NEXT: addi sp, sp, 16
1025 ; RV64IF-LABEL: test_round_ui64:
1027 ; RV64IF-NEXT: fcvt.lu.s a0, fa0, rmm
1030 ; RV32IZFINX-LABEL: test_round_ui64:
1031 ; RV32IZFINX: # %bb.0:
1032 ; RV32IZFINX-NEXT: lui a1, 307200
1033 ; RV32IZFINX-NEXT: fabs.s a2, a0
1034 ; RV32IZFINX-NEXT: flt.s a1, a2, a1
1035 ; RV32IZFINX-NEXT: beqz a1, .LBB31_2
1036 ; RV32IZFINX-NEXT: # %bb.1:
1037 ; RV32IZFINX-NEXT: fcvt.w.s a1, a0, rmm
1038 ; RV32IZFINX-NEXT: fcvt.s.w a1, a1, rmm
1039 ; RV32IZFINX-NEXT: fsgnj.s a0, a1, a0
1040 ; RV32IZFINX-NEXT: .LBB31_2:
1041 ; RV32IZFINX-NEXT: addi sp, sp, -16
1042 ; RV32IZFINX-NEXT: .cfi_def_cfa_offset 16
1043 ; RV32IZFINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
1044 ; RV32IZFINX-NEXT: .cfi_offset ra, -4
1045 ; RV32IZFINX-NEXT: call __fixunssfdi
1046 ; RV32IZFINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
1047 ; RV32IZFINX-NEXT: addi sp, sp, 16
1048 ; RV32IZFINX-NEXT: ret
1050 ; RV64IZFINX-LABEL: test_round_ui64:
1051 ; RV64IZFINX: # %bb.0:
1052 ; RV64IZFINX-NEXT: fcvt.lu.s a0, a0, rmm
1053 ; RV64IZFINX-NEXT: ret
1054 %a = call float @llvm.round.f32(float %x)
1055 %b = fptoui float %a to i64
1059 define signext i8 @test_roundeven_si8(float %x) {
1060 ; RV32IF-LABEL: test_roundeven_si8:
1062 ; RV32IF-NEXT: fcvt.w.s a0, fa0, rne
1065 ; RV64IF-LABEL: test_roundeven_si8:
1067 ; RV64IF-NEXT: fcvt.l.s a0, fa0, rne
1070 ; RV32IZFINX-LABEL: test_roundeven_si8:
1071 ; RV32IZFINX: # %bb.0:
1072 ; RV32IZFINX-NEXT: fcvt.w.s a0, a0, rne
1073 ; RV32IZFINX-NEXT: ret
1075 ; RV64IZFINX-LABEL: test_roundeven_si8:
1076 ; RV64IZFINX: # %bb.0:
1077 ; RV64IZFINX-NEXT: fcvt.l.s a0, a0, rne
1078 ; RV64IZFINX-NEXT: ret
1079 %a = call float @llvm.roundeven.f32(float %x)
1080 %b = fptosi float %a to i8
1084 define signext i16 @test_roundeven_si16(float %x) {
1085 ; RV32IF-LABEL: test_roundeven_si16:
1087 ; RV32IF-NEXT: fcvt.w.s a0, fa0, rne
1090 ; RV64IF-LABEL: test_roundeven_si16:
1092 ; RV64IF-NEXT: fcvt.l.s a0, fa0, rne
1095 ; RV32IZFINX-LABEL: test_roundeven_si16:
1096 ; RV32IZFINX: # %bb.0:
1097 ; RV32IZFINX-NEXT: fcvt.w.s a0, a0, rne
1098 ; RV32IZFINX-NEXT: ret
1100 ; RV64IZFINX-LABEL: test_roundeven_si16:
1101 ; RV64IZFINX: # %bb.0:
1102 ; RV64IZFINX-NEXT: fcvt.l.s a0, a0, rne
1103 ; RV64IZFINX-NEXT: ret
1104 %a = call float @llvm.roundeven.f32(float %x)
1105 %b = fptosi float %a to i16
1109 define signext i32 @test_roundeven_si32(float %x) {
1110 ; RV32IF-LABEL: test_roundeven_si32:
1112 ; RV32IF-NEXT: fcvt.w.s a0, fa0, rne
1115 ; RV64IF-LABEL: test_roundeven_si32:
1117 ; RV64IF-NEXT: fcvt.w.s a0, fa0, rne
1120 ; RV32IZFINX-LABEL: test_roundeven_si32:
1121 ; RV32IZFINX: # %bb.0:
1122 ; RV32IZFINX-NEXT: fcvt.w.s a0, a0, rne
1123 ; RV32IZFINX-NEXT: ret
1125 ; RV64IZFINX-LABEL: test_roundeven_si32:
1126 ; RV64IZFINX: # %bb.0:
1127 ; RV64IZFINX-NEXT: fcvt.w.s a0, a0, rne
1128 ; RV64IZFINX-NEXT: ret
1129 %a = call float @llvm.roundeven.f32(float %x)
1130 %b = fptosi float %a to i32
1134 define i64 @test_roundeven_si64(float %x) {
1135 ; RV32IF-LABEL: test_roundeven_si64:
1137 ; RV32IF-NEXT: lui a0, 307200
1138 ; RV32IF-NEXT: fmv.w.x fa5, a0
1139 ; RV32IF-NEXT: fabs.s fa4, fa0
1140 ; RV32IF-NEXT: flt.s a0, fa4, fa5
1141 ; RV32IF-NEXT: beqz a0, .LBB35_2
1142 ; RV32IF-NEXT: # %bb.1:
1143 ; RV32IF-NEXT: fcvt.w.s a0, fa0, rne
1144 ; RV32IF-NEXT: fcvt.s.w fa5, a0, rne
1145 ; RV32IF-NEXT: fsgnj.s fa0, fa5, fa0
1146 ; RV32IF-NEXT: .LBB35_2:
1147 ; RV32IF-NEXT: addi sp, sp, -16
1148 ; RV32IF-NEXT: .cfi_def_cfa_offset 16
1149 ; RV32IF-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
1150 ; RV32IF-NEXT: .cfi_offset ra, -4
1151 ; RV32IF-NEXT: call __fixsfdi
1152 ; RV32IF-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
1153 ; RV32IF-NEXT: addi sp, sp, 16
1156 ; RV64IF-LABEL: test_roundeven_si64:
1158 ; RV64IF-NEXT: fcvt.l.s a0, fa0, rne
1161 ; RV32IZFINX-LABEL: test_roundeven_si64:
1162 ; RV32IZFINX: # %bb.0:
1163 ; RV32IZFINX-NEXT: lui a1, 307200
1164 ; RV32IZFINX-NEXT: fabs.s a2, a0
1165 ; RV32IZFINX-NEXT: flt.s a1, a2, a1
1166 ; RV32IZFINX-NEXT: beqz a1, .LBB35_2
1167 ; RV32IZFINX-NEXT: # %bb.1:
1168 ; RV32IZFINX-NEXT: fcvt.w.s a1, a0, rne
1169 ; RV32IZFINX-NEXT: fcvt.s.w a1, a1, rne
1170 ; RV32IZFINX-NEXT: fsgnj.s a0, a1, a0
1171 ; RV32IZFINX-NEXT: .LBB35_2:
1172 ; RV32IZFINX-NEXT: addi sp, sp, -16
1173 ; RV32IZFINX-NEXT: .cfi_def_cfa_offset 16
1174 ; RV32IZFINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
1175 ; RV32IZFINX-NEXT: .cfi_offset ra, -4
1176 ; RV32IZFINX-NEXT: call __fixsfdi
1177 ; RV32IZFINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
1178 ; RV32IZFINX-NEXT: addi sp, sp, 16
1179 ; RV32IZFINX-NEXT: ret
1181 ; RV64IZFINX-LABEL: test_roundeven_si64:
1182 ; RV64IZFINX: # %bb.0:
1183 ; RV64IZFINX-NEXT: fcvt.l.s a0, a0, rne
1184 ; RV64IZFINX-NEXT: ret
1185 %a = call float @llvm.roundeven.f32(float %x)
1186 %b = fptosi float %a to i64
1190 define zeroext i8 @test_roundeven_ui8(float %x) {
1191 ; RV32IF-LABEL: test_roundeven_ui8:
1193 ; RV32IF-NEXT: fcvt.wu.s a0, fa0, rne
1196 ; RV64IF-LABEL: test_roundeven_ui8:
1198 ; RV64IF-NEXT: fcvt.lu.s a0, fa0, rne
1201 ; RV32IZFINX-LABEL: test_roundeven_ui8:
1202 ; RV32IZFINX: # %bb.0:
1203 ; RV32IZFINX-NEXT: fcvt.wu.s a0, a0, rne
1204 ; RV32IZFINX-NEXT: ret
1206 ; RV64IZFINX-LABEL: test_roundeven_ui8:
1207 ; RV64IZFINX: # %bb.0:
1208 ; RV64IZFINX-NEXT: fcvt.lu.s a0, a0, rne
1209 ; RV64IZFINX-NEXT: ret
1210 %a = call float @llvm.roundeven.f32(float %x)
1211 %b = fptoui float %a to i8
1215 define zeroext i16 @test_roundeven_ui16(float %x) {
1216 ; RV32IF-LABEL: test_roundeven_ui16:
1218 ; RV32IF-NEXT: fcvt.wu.s a0, fa0, rne
1221 ; RV64IF-LABEL: test_roundeven_ui16:
1223 ; RV64IF-NEXT: fcvt.lu.s a0, fa0, rne
1226 ; RV32IZFINX-LABEL: test_roundeven_ui16:
1227 ; RV32IZFINX: # %bb.0:
1228 ; RV32IZFINX-NEXT: fcvt.wu.s a0, a0, rne
1229 ; RV32IZFINX-NEXT: ret
1231 ; RV64IZFINX-LABEL: test_roundeven_ui16:
1232 ; RV64IZFINX: # %bb.0:
1233 ; RV64IZFINX-NEXT: fcvt.lu.s a0, a0, rne
1234 ; RV64IZFINX-NEXT: ret
1235 %a = call float @llvm.roundeven.f32(float %x)
1236 %b = fptoui float %a to i16
1240 define signext i32 @test_roundeven_ui32(float %x) {
1241 ; RV32IF-LABEL: test_roundeven_ui32:
1243 ; RV32IF-NEXT: fcvt.wu.s a0, fa0, rne
1246 ; RV64IF-LABEL: test_roundeven_ui32:
1248 ; RV64IF-NEXT: fcvt.wu.s a0, fa0, rne
1251 ; RV32IZFINX-LABEL: test_roundeven_ui32:
1252 ; RV32IZFINX: # %bb.0:
1253 ; RV32IZFINX-NEXT: fcvt.wu.s a0, a0, rne
1254 ; RV32IZFINX-NEXT: ret
1256 ; RV64IZFINX-LABEL: test_roundeven_ui32:
1257 ; RV64IZFINX: # %bb.0:
1258 ; RV64IZFINX-NEXT: fcvt.wu.s a0, a0, rne
1259 ; RV64IZFINX-NEXT: ret
1260 %a = call float @llvm.roundeven.f32(float %x)
1261 %b = fptoui float %a to i32
1265 define i64 @test_roundeven_ui64(float %x) {
1266 ; RV32IF-LABEL: test_roundeven_ui64:
1268 ; RV32IF-NEXT: lui a0, 307200
1269 ; RV32IF-NEXT: fmv.w.x fa5, a0
1270 ; RV32IF-NEXT: fabs.s fa4, fa0
1271 ; RV32IF-NEXT: flt.s a0, fa4, fa5
1272 ; RV32IF-NEXT: beqz a0, .LBB39_2
1273 ; RV32IF-NEXT: # %bb.1:
1274 ; RV32IF-NEXT: fcvt.w.s a0, fa0, rne
1275 ; RV32IF-NEXT: fcvt.s.w fa5, a0, rne
1276 ; RV32IF-NEXT: fsgnj.s fa0, fa5, fa0
1277 ; RV32IF-NEXT: .LBB39_2:
1278 ; RV32IF-NEXT: addi sp, sp, -16
1279 ; RV32IF-NEXT: .cfi_def_cfa_offset 16
1280 ; RV32IF-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
1281 ; RV32IF-NEXT: .cfi_offset ra, -4
1282 ; RV32IF-NEXT: call __fixunssfdi
1283 ; RV32IF-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
1284 ; RV32IF-NEXT: addi sp, sp, 16
1287 ; RV64IF-LABEL: test_roundeven_ui64:
1289 ; RV64IF-NEXT: fcvt.lu.s a0, fa0, rne
1292 ; RV32IZFINX-LABEL: test_roundeven_ui64:
1293 ; RV32IZFINX: # %bb.0:
1294 ; RV32IZFINX-NEXT: lui a1, 307200
1295 ; RV32IZFINX-NEXT: fabs.s a2, a0
1296 ; RV32IZFINX-NEXT: flt.s a1, a2, a1
1297 ; RV32IZFINX-NEXT: beqz a1, .LBB39_2
1298 ; RV32IZFINX-NEXT: # %bb.1:
1299 ; RV32IZFINX-NEXT: fcvt.w.s a1, a0, rne
1300 ; RV32IZFINX-NEXT: fcvt.s.w a1, a1, rne
1301 ; RV32IZFINX-NEXT: fsgnj.s a0, a1, a0
1302 ; RV32IZFINX-NEXT: .LBB39_2:
1303 ; RV32IZFINX-NEXT: addi sp, sp, -16
1304 ; RV32IZFINX-NEXT: .cfi_def_cfa_offset 16
1305 ; RV32IZFINX-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
1306 ; RV32IZFINX-NEXT: .cfi_offset ra, -4
1307 ; RV32IZFINX-NEXT: call __fixunssfdi
1308 ; RV32IZFINX-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
1309 ; RV32IZFINX-NEXT: addi sp, sp, 16
1310 ; RV32IZFINX-NEXT: ret
1312 ; RV64IZFINX-LABEL: test_roundeven_ui64:
1313 ; RV64IZFINX: # %bb.0:
1314 ; RV64IZFINX-NEXT: fcvt.lu.s a0, a0, rne
1315 ; RV64IZFINX-NEXT: ret
1316 %a = call float @llvm.roundeven.f32(float %x)
1317 %b = fptoui float %a to i64
1321 define float @test_floor_float(float %x) {
1322 ; RV32IFD-LABEL: test_floor_float:
1324 ; RV32IFD-NEXT: addi sp, sp, -16
1325 ; RV32IFD-NEXT: .cfi_def_cfa_offset 16
1326 ; RV32IFD-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
1327 ; RV32IFD-NEXT: .cfi_offset ra, -4
1328 ; RV32IFD-NEXT: call floor@plt
1329 ; RV32IFD-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
1330 ; RV32IFD-NEXT: addi sp, sp, 16
1333 ; RV64IFD-LABEL: test_floor_float:
1335 ; RV64IFD-NEXT: addi sp, sp, -16
1336 ; RV64IFD-NEXT: .cfi_def_cfa_offset 16
1337 ; RV64IFD-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
1338 ; RV64IFD-NEXT: .cfi_offset ra, -8
1339 ; RV64IFD-NEXT: call floor@plt
1340 ; RV64IFD-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
1341 ; RV64IFD-NEXT: addi sp, sp, 16
1343 ; RV32IF-LABEL: test_floor_float:
1345 ; RV32IF-NEXT: lui a0, 307200
1346 ; RV32IF-NEXT: fmv.w.x fa5, a0
1347 ; RV32IF-NEXT: fabs.s fa4, fa0
1348 ; RV32IF-NEXT: flt.s a0, fa4, fa5
1349 ; RV32IF-NEXT: beqz a0, .LBB40_2
1350 ; RV32IF-NEXT: # %bb.1:
1351 ; RV32IF-NEXT: fcvt.w.s a0, fa0, rdn
1352 ; RV32IF-NEXT: fcvt.s.w fa5, a0, rdn
1353 ; RV32IF-NEXT: fsgnj.s fa0, fa5, fa0
1354 ; RV32IF-NEXT: .LBB40_2:
1357 ; RV64IF-LABEL: test_floor_float:
1359 ; RV64IF-NEXT: lui a0, 307200
1360 ; RV64IF-NEXT: fmv.w.x fa5, a0
1361 ; RV64IF-NEXT: fabs.s fa4, fa0
1362 ; RV64IF-NEXT: flt.s a0, fa4, fa5
1363 ; RV64IF-NEXT: beqz a0, .LBB40_2
1364 ; RV64IF-NEXT: # %bb.1:
1365 ; RV64IF-NEXT: fcvt.w.s a0, fa0, rdn
1366 ; RV64IF-NEXT: fcvt.s.w fa5, a0, rdn
1367 ; RV64IF-NEXT: fsgnj.s fa0, fa5, fa0
1368 ; RV64IF-NEXT: .LBB40_2:
1371 ; RV32IZFINX-LABEL: test_floor_float:
1372 ; RV32IZFINX: # %bb.0:
1373 ; RV32IZFINX-NEXT: lui a1, 307200
1374 ; RV32IZFINX-NEXT: fabs.s a2, a0
1375 ; RV32IZFINX-NEXT: flt.s a1, a2, a1
1376 ; RV32IZFINX-NEXT: beqz a1, .LBB40_2
1377 ; RV32IZFINX-NEXT: # %bb.1:
1378 ; RV32IZFINX-NEXT: fcvt.w.s a1, a0, rdn
1379 ; RV32IZFINX-NEXT: fcvt.s.w a1, a1, rdn
1380 ; RV32IZFINX-NEXT: fsgnj.s a0, a1, a0
1381 ; RV32IZFINX-NEXT: .LBB40_2:
1382 ; RV32IZFINX-NEXT: ret
1384 ; RV64IZFINX-LABEL: test_floor_float:
1385 ; RV64IZFINX: # %bb.0:
1386 ; RV64IZFINX-NEXT: lui a1, 307200
1387 ; RV64IZFINX-NEXT: fabs.s a2, a0
1388 ; RV64IZFINX-NEXT: flt.s a1, a2, a1
1389 ; RV64IZFINX-NEXT: beqz a1, .LBB40_2
1390 ; RV64IZFINX-NEXT: # %bb.1:
1391 ; RV64IZFINX-NEXT: fcvt.w.s a1, a0, rdn
1392 ; RV64IZFINX-NEXT: fcvt.s.w a1, a1, rdn
1393 ; RV64IZFINX-NEXT: fsgnj.s a0, a1, a0
1394 ; RV64IZFINX-NEXT: .LBB40_2:
1395 ; RV64IZFINX-NEXT: ret
1396 %a = call float @llvm.floor.f32(float %x)
1400 define float @test_ceil_float(float %x) {
1401 ; RV32IFD-LABEL: test_ceil_float:
1403 ; RV32IFD-NEXT: addi sp, sp, -16
1404 ; RV32IFD-NEXT: .cfi_def_cfa_offset 16
1405 ; RV32IFD-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
1406 ; RV32IFD-NEXT: .cfi_offset ra, -4
1407 ; RV32IFD-NEXT: call ceil@plt
1408 ; RV32IFD-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
1409 ; RV32IFD-NEXT: addi sp, sp, 16
1412 ; RV64IFD-LABEL: test_ceil_float:
1414 ; RV64IFD-NEXT: addi sp, sp, -16
1415 ; RV64IFD-NEXT: .cfi_def_cfa_offset 16
1416 ; RV64IFD-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
1417 ; RV64IFD-NEXT: .cfi_offset ra, -8
1418 ; RV64IFD-NEXT: call ceil@plt
1419 ; RV64IFD-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
1420 ; RV64IFD-NEXT: addi sp, sp, 16
1422 ; RV32IF-LABEL: test_ceil_float:
1424 ; RV32IF-NEXT: lui a0, 307200
1425 ; RV32IF-NEXT: fmv.w.x fa5, a0
1426 ; RV32IF-NEXT: fabs.s fa4, fa0
1427 ; RV32IF-NEXT: flt.s a0, fa4, fa5
1428 ; RV32IF-NEXT: beqz a0, .LBB41_2
1429 ; RV32IF-NEXT: # %bb.1:
1430 ; RV32IF-NEXT: fcvt.w.s a0, fa0, rup
1431 ; RV32IF-NEXT: fcvt.s.w fa5, a0, rup
1432 ; RV32IF-NEXT: fsgnj.s fa0, fa5, fa0
1433 ; RV32IF-NEXT: .LBB41_2:
1436 ; RV64IF-LABEL: test_ceil_float:
1438 ; RV64IF-NEXT: lui a0, 307200
1439 ; RV64IF-NEXT: fmv.w.x fa5, a0
1440 ; RV64IF-NEXT: fabs.s fa4, fa0
1441 ; RV64IF-NEXT: flt.s a0, fa4, fa5
1442 ; RV64IF-NEXT: beqz a0, .LBB41_2
1443 ; RV64IF-NEXT: # %bb.1:
1444 ; RV64IF-NEXT: fcvt.w.s a0, fa0, rup
1445 ; RV64IF-NEXT: fcvt.s.w fa5, a0, rup
1446 ; RV64IF-NEXT: fsgnj.s fa0, fa5, fa0
1447 ; RV64IF-NEXT: .LBB41_2:
1450 ; RV32IZFINX-LABEL: test_ceil_float:
1451 ; RV32IZFINX: # %bb.0:
1452 ; RV32IZFINX-NEXT: lui a1, 307200
1453 ; RV32IZFINX-NEXT: fabs.s a2, a0
1454 ; RV32IZFINX-NEXT: flt.s a1, a2, a1
1455 ; RV32IZFINX-NEXT: beqz a1, .LBB41_2
1456 ; RV32IZFINX-NEXT: # %bb.1:
1457 ; RV32IZFINX-NEXT: fcvt.w.s a1, a0, rup
1458 ; RV32IZFINX-NEXT: fcvt.s.w a1, a1, rup
1459 ; RV32IZFINX-NEXT: fsgnj.s a0, a1, a0
1460 ; RV32IZFINX-NEXT: .LBB41_2:
1461 ; RV32IZFINX-NEXT: ret
1463 ; RV64IZFINX-LABEL: test_ceil_float:
1464 ; RV64IZFINX: # %bb.0:
1465 ; RV64IZFINX-NEXT: lui a1, 307200
1466 ; RV64IZFINX-NEXT: fabs.s a2, a0
1467 ; RV64IZFINX-NEXT: flt.s a1, a2, a1
1468 ; RV64IZFINX-NEXT: beqz a1, .LBB41_2
1469 ; RV64IZFINX-NEXT: # %bb.1:
1470 ; RV64IZFINX-NEXT: fcvt.w.s a1, a0, rup
1471 ; RV64IZFINX-NEXT: fcvt.s.w a1, a1, rup
1472 ; RV64IZFINX-NEXT: fsgnj.s a0, a1, a0
1473 ; RV64IZFINX-NEXT: .LBB41_2:
1474 ; RV64IZFINX-NEXT: ret
1475 %a = call float @llvm.ceil.f32(float %x)
1479 define float @test_trunc_float(float %x) {
1480 ; RV32IFD-LABEL: test_trunc_float:
1482 ; RV32IFD-NEXT: addi sp, sp, -16
1483 ; RV32IFD-NEXT: .cfi_def_cfa_offset 16
1484 ; RV32IFD-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
1485 ; RV32IFD-NEXT: .cfi_offset ra, -4
1486 ; RV32IFD-NEXT: call trunc@plt
1487 ; RV32IFD-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
1488 ; RV32IFD-NEXT: addi sp, sp, 16
1491 ; RV64IFD-LABEL: test_trunc_float:
1493 ; RV64IFD-NEXT: addi sp, sp, -16
1494 ; RV64IFD-NEXT: .cfi_def_cfa_offset 16
1495 ; RV64IFD-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
1496 ; RV64IFD-NEXT: .cfi_offset ra, -8
1497 ; RV64IFD-NEXT: call trunc@plt
1498 ; RV64IFD-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
1499 ; RV64IFD-NEXT: addi sp, sp, 16
1501 ; RV32IF-LABEL: test_trunc_float:
1503 ; RV32IF-NEXT: lui a0, 307200
1504 ; RV32IF-NEXT: fmv.w.x fa5, a0
1505 ; RV32IF-NEXT: fabs.s fa4, fa0
1506 ; RV32IF-NEXT: flt.s a0, fa4, fa5
1507 ; RV32IF-NEXT: beqz a0, .LBB42_2
1508 ; RV32IF-NEXT: # %bb.1:
1509 ; RV32IF-NEXT: fcvt.w.s a0, fa0, rtz
1510 ; RV32IF-NEXT: fcvt.s.w fa5, a0, rtz
1511 ; RV32IF-NEXT: fsgnj.s fa0, fa5, fa0
1512 ; RV32IF-NEXT: .LBB42_2:
1515 ; RV64IF-LABEL: test_trunc_float:
1517 ; RV64IF-NEXT: lui a0, 307200
1518 ; RV64IF-NEXT: fmv.w.x fa5, a0
1519 ; RV64IF-NEXT: fabs.s fa4, fa0
1520 ; RV64IF-NEXT: flt.s a0, fa4, fa5
1521 ; RV64IF-NEXT: beqz a0, .LBB42_2
1522 ; RV64IF-NEXT: # %bb.1:
1523 ; RV64IF-NEXT: fcvt.w.s a0, fa0, rtz
1524 ; RV64IF-NEXT: fcvt.s.w fa5, a0, rtz
1525 ; RV64IF-NEXT: fsgnj.s fa0, fa5, fa0
1526 ; RV64IF-NEXT: .LBB42_2:
1529 ; RV32IZFINX-LABEL: test_trunc_float:
1530 ; RV32IZFINX: # %bb.0:
1531 ; RV32IZFINX-NEXT: lui a1, 307200
1532 ; RV32IZFINX-NEXT: fabs.s a2, a0
1533 ; RV32IZFINX-NEXT: flt.s a1, a2, a1
1534 ; RV32IZFINX-NEXT: beqz a1, .LBB42_2
1535 ; RV32IZFINX-NEXT: # %bb.1:
1536 ; RV32IZFINX-NEXT: fcvt.w.s a1, a0, rtz
1537 ; RV32IZFINX-NEXT: fcvt.s.w a1, a1, rtz
1538 ; RV32IZFINX-NEXT: fsgnj.s a0, a1, a0
1539 ; RV32IZFINX-NEXT: .LBB42_2:
1540 ; RV32IZFINX-NEXT: ret
1542 ; RV64IZFINX-LABEL: test_trunc_float:
1543 ; RV64IZFINX: # %bb.0:
1544 ; RV64IZFINX-NEXT: lui a1, 307200
1545 ; RV64IZFINX-NEXT: fabs.s a2, a0
1546 ; RV64IZFINX-NEXT: flt.s a1, a2, a1
1547 ; RV64IZFINX-NEXT: beqz a1, .LBB42_2
1548 ; RV64IZFINX-NEXT: # %bb.1:
1549 ; RV64IZFINX-NEXT: fcvt.w.s a1, a0, rtz
1550 ; RV64IZFINX-NEXT: fcvt.s.w a1, a1, rtz
1551 ; RV64IZFINX-NEXT: fsgnj.s a0, a1, a0
1552 ; RV64IZFINX-NEXT: .LBB42_2:
1553 ; RV64IZFINX-NEXT: ret
1554 %a = call float @llvm.trunc.f32(float %x)
1558 define float @test_round_float(float %x) {
1559 ; RV32IFD-LABEL: test_round_float:
1561 ; RV32IFD-NEXT: addi sp, sp, -16
1562 ; RV32IFD-NEXT: .cfi_def_cfa_offset 16
1563 ; RV32IFD-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
1564 ; RV32IFD-NEXT: .cfi_offset ra, -4
1565 ; RV32IFD-NEXT: call round@plt
1566 ; RV32IFD-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
1567 ; RV32IFD-NEXT: addi sp, sp, 16
1570 ; RV64IFD-LABEL: test_round_float:
1572 ; RV64IFD-NEXT: addi sp, sp, -16
1573 ; RV64IFD-NEXT: .cfi_def_cfa_offset 16
1574 ; RV64IFD-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
1575 ; RV64IFD-NEXT: .cfi_offset ra, -8
1576 ; RV64IFD-NEXT: call round@plt
1577 ; RV64IFD-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
1578 ; RV64IFD-NEXT: addi sp, sp, 16
1580 ; RV32IF-LABEL: test_round_float:
1582 ; RV32IF-NEXT: lui a0, 307200
1583 ; RV32IF-NEXT: fmv.w.x fa5, a0
1584 ; RV32IF-NEXT: fabs.s fa4, fa0
1585 ; RV32IF-NEXT: flt.s a0, fa4, fa5
1586 ; RV32IF-NEXT: beqz a0, .LBB43_2
1587 ; RV32IF-NEXT: # %bb.1:
1588 ; RV32IF-NEXT: fcvt.w.s a0, fa0, rmm
1589 ; RV32IF-NEXT: fcvt.s.w fa5, a0, rmm
1590 ; RV32IF-NEXT: fsgnj.s fa0, fa5, fa0
1591 ; RV32IF-NEXT: .LBB43_2:
1594 ; RV64IF-LABEL: test_round_float:
1596 ; RV64IF-NEXT: lui a0, 307200
1597 ; RV64IF-NEXT: fmv.w.x fa5, a0
1598 ; RV64IF-NEXT: fabs.s fa4, fa0
1599 ; RV64IF-NEXT: flt.s a0, fa4, fa5
1600 ; RV64IF-NEXT: beqz a0, .LBB43_2
1601 ; RV64IF-NEXT: # %bb.1:
1602 ; RV64IF-NEXT: fcvt.w.s a0, fa0, rmm
1603 ; RV64IF-NEXT: fcvt.s.w fa5, a0, rmm
1604 ; RV64IF-NEXT: fsgnj.s fa0, fa5, fa0
1605 ; RV64IF-NEXT: .LBB43_2:
1608 ; RV32IZFINX-LABEL: test_round_float:
1609 ; RV32IZFINX: # %bb.0:
1610 ; RV32IZFINX-NEXT: lui a1, 307200
1611 ; RV32IZFINX-NEXT: fabs.s a2, a0
1612 ; RV32IZFINX-NEXT: flt.s a1, a2, a1
1613 ; RV32IZFINX-NEXT: beqz a1, .LBB43_2
1614 ; RV32IZFINX-NEXT: # %bb.1:
1615 ; RV32IZFINX-NEXT: fcvt.w.s a1, a0, rmm
1616 ; RV32IZFINX-NEXT: fcvt.s.w a1, a1, rmm
1617 ; RV32IZFINX-NEXT: fsgnj.s a0, a1, a0
1618 ; RV32IZFINX-NEXT: .LBB43_2:
1619 ; RV32IZFINX-NEXT: ret
1621 ; RV64IZFINX-LABEL: test_round_float:
1622 ; RV64IZFINX: # %bb.0:
1623 ; RV64IZFINX-NEXT: lui a1, 307200
1624 ; RV64IZFINX-NEXT: fabs.s a2, a0
1625 ; RV64IZFINX-NEXT: flt.s a1, a2, a1
1626 ; RV64IZFINX-NEXT: beqz a1, .LBB43_2
1627 ; RV64IZFINX-NEXT: # %bb.1:
1628 ; RV64IZFINX-NEXT: fcvt.w.s a1, a0, rmm
1629 ; RV64IZFINX-NEXT: fcvt.s.w a1, a1, rmm
1630 ; RV64IZFINX-NEXT: fsgnj.s a0, a1, a0
1631 ; RV64IZFINX-NEXT: .LBB43_2:
1632 ; RV64IZFINX-NEXT: ret
1633 %a = call float @llvm.round.f32(float %x)
1637 define float @test_roundeven_float(float %x) {
1638 ; RV32IFD-LABEL: test_roundeven_float:
1640 ; RV32IFD-NEXT: addi sp, sp, -16
1641 ; RV32IFD-NEXT: .cfi_def_cfa_offset 16
1642 ; RV32IFD-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
1643 ; RV32IFD-NEXT: .cfi_offset ra, -4
1644 ; RV32IFD-NEXT: call roundeven@plt
1645 ; RV32IFD-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
1646 ; RV32IFD-NEXT: addi sp, sp, 16
1649 ; RV64IFD-LABEL: test_roundeven_float:
1651 ; RV64IFD-NEXT: addi sp, sp, -16
1652 ; RV64IFD-NEXT: .cfi_def_cfa_offset 16
1653 ; RV64IFD-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
1654 ; RV64IFD-NEXT: .cfi_offset ra, -8
1655 ; RV64IFD-NEXT: call roundeven@plt
1656 ; RV64IFD-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
1657 ; RV64IFD-NEXT: addi sp, sp, 16
1659 ; RV32IF-LABEL: test_roundeven_float:
1661 ; RV32IF-NEXT: lui a0, 307200
1662 ; RV32IF-NEXT: fmv.w.x fa5, a0
1663 ; RV32IF-NEXT: fabs.s fa4, fa0
1664 ; RV32IF-NEXT: flt.s a0, fa4, fa5
1665 ; RV32IF-NEXT: beqz a0, .LBB44_2
1666 ; RV32IF-NEXT: # %bb.1:
1667 ; RV32IF-NEXT: fcvt.w.s a0, fa0, rne
1668 ; RV32IF-NEXT: fcvt.s.w fa5, a0, rne
1669 ; RV32IF-NEXT: fsgnj.s fa0, fa5, fa0
1670 ; RV32IF-NEXT: .LBB44_2:
1673 ; RV64IF-LABEL: test_roundeven_float:
1675 ; RV64IF-NEXT: lui a0, 307200
1676 ; RV64IF-NEXT: fmv.w.x fa5, a0
1677 ; RV64IF-NEXT: fabs.s fa4, fa0
1678 ; RV64IF-NEXT: flt.s a0, fa4, fa5
1679 ; RV64IF-NEXT: beqz a0, .LBB44_2
1680 ; RV64IF-NEXT: # %bb.1:
1681 ; RV64IF-NEXT: fcvt.w.s a0, fa0, rne
1682 ; RV64IF-NEXT: fcvt.s.w fa5, a0, rne
1683 ; RV64IF-NEXT: fsgnj.s fa0, fa5, fa0
1684 ; RV64IF-NEXT: .LBB44_2:
1687 ; RV32IZFINX-LABEL: test_roundeven_float:
1688 ; RV32IZFINX: # %bb.0:
1689 ; RV32IZFINX-NEXT: lui a1, 307200
1690 ; RV32IZFINX-NEXT: fabs.s a2, a0
1691 ; RV32IZFINX-NEXT: flt.s a1, a2, a1
1692 ; RV32IZFINX-NEXT: beqz a1, .LBB44_2
1693 ; RV32IZFINX-NEXT: # %bb.1:
1694 ; RV32IZFINX-NEXT: fcvt.w.s a1, a0, rne
1695 ; RV32IZFINX-NEXT: fcvt.s.w a1, a1, rne
1696 ; RV32IZFINX-NEXT: fsgnj.s a0, a1, a0
1697 ; RV32IZFINX-NEXT: .LBB44_2:
1698 ; RV32IZFINX-NEXT: ret
1700 ; RV64IZFINX-LABEL: test_roundeven_float:
1701 ; RV64IZFINX: # %bb.0:
1702 ; RV64IZFINX-NEXT: lui a1, 307200
1703 ; RV64IZFINX-NEXT: fabs.s a2, a0
1704 ; RV64IZFINX-NEXT: flt.s a1, a2, a1
1705 ; RV64IZFINX-NEXT: beqz a1, .LBB44_2
1706 ; RV64IZFINX-NEXT: # %bb.1:
1707 ; RV64IZFINX-NEXT: fcvt.w.s a1, a0, rne
1708 ; RV64IZFINX-NEXT: fcvt.s.w a1, a1, rne
1709 ; RV64IZFINX-NEXT: fsgnj.s a0, a1, a0
1710 ; RV64IZFINX-NEXT: .LBB44_2:
1711 ; RV64IZFINX-NEXT: ret
1712 %a = call float @llvm.roundeven.f32(float %x)
1716 declare float @llvm.floor.f32(float)
1717 declare float @llvm.ceil.f32(float)
1718 declare float @llvm.trunc.f32(float)
1719 declare float @llvm.round.f32(float)
1720 declare float @llvm.roundeven.f32(float)