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=+f \
3 ; RUN: -verify-machineinstrs | FileCheck -check-prefix=RV32IF %s
4 ; RUN: sed 's/iXLen/i32/g' %s | llc -mtriple=riscv32 -mattr=+d \
5 ; RUN: -verify-machineinstrs | FileCheck -check-prefix=RV32IF %s
6 ; RUN: sed 's/iXLen/i64/g' %s | llc -mtriple=riscv64 -mattr=+f \
7 ; RUN: -verify-machineinstrs | FileCheck -check-prefix=RV64IF %s
8 ; RUN: sed 's/iXLen/i64/g' %s | llc -mtriple=riscv64 -mattr=+d \
9 ; RUN: -verify-machineinstrs | FileCheck -check-prefix=RV64IF %s
11 declare float @llvm.sqrt.f32(float)
13 define float @sqrt_f32(float %a) nounwind {
14 ; RV32IF-LABEL: sqrt_f32:
16 ; RV32IF-NEXT: fmv.w.x ft0, a0
17 ; RV32IF-NEXT: fsqrt.s ft0, ft0
18 ; RV32IF-NEXT: fmv.x.w a0, ft0
21 ; RV64IF-LABEL: sqrt_f32:
23 ; RV64IF-NEXT: fmv.w.x ft0, a0
24 ; RV64IF-NEXT: fsqrt.s ft0, ft0
25 ; RV64IF-NEXT: fmv.x.w a0, ft0
27 %1 = call float @llvm.sqrt.f32(float %a)
31 declare float @llvm.powi.f32.i32(float, i32)
33 define float @powi_f32(float %a, i32 %b) nounwind {
34 ; RV32IF-LABEL: powi_f32:
36 ; RV32IF-NEXT: addi sp, sp, -16
37 ; RV32IF-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
38 ; RV32IF-NEXT: call __powisf2@plt
39 ; RV32IF-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
40 ; RV32IF-NEXT: addi sp, sp, 16
43 ; RV64IF-LABEL: powi_f32:
45 ; RV64IF-NEXT: addi sp, sp, -16
46 ; RV64IF-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
47 ; RV64IF-NEXT: sext.w a1, a1
48 ; RV64IF-NEXT: call __powisf2@plt
49 ; RV64IF-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
50 ; RV64IF-NEXT: addi sp, sp, 16
52 %1 = call float @llvm.powi.f32.i32(float %a, i32 %b)
56 declare float @llvm.sin.f32(float)
58 define float @sin_f32(float %a) nounwind {
59 ; RV32IF-LABEL: sin_f32:
61 ; RV32IF-NEXT: addi sp, sp, -16
62 ; RV32IF-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
63 ; RV32IF-NEXT: call sinf@plt
64 ; RV32IF-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
65 ; RV32IF-NEXT: addi sp, sp, 16
68 ; RV64IF-LABEL: sin_f32:
70 ; RV64IF-NEXT: addi sp, sp, -16
71 ; RV64IF-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
72 ; RV64IF-NEXT: call sinf@plt
73 ; RV64IF-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
74 ; RV64IF-NEXT: addi sp, sp, 16
76 %1 = call float @llvm.sin.f32(float %a)
80 declare float @llvm.cos.f32(float)
82 define float @cos_f32(float %a) nounwind {
83 ; RV32IF-LABEL: cos_f32:
85 ; RV32IF-NEXT: addi sp, sp, -16
86 ; RV32IF-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
87 ; RV32IF-NEXT: call cosf@plt
88 ; RV32IF-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
89 ; RV32IF-NEXT: addi sp, sp, 16
92 ; RV64IF-LABEL: cos_f32:
94 ; RV64IF-NEXT: addi sp, sp, -16
95 ; RV64IF-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
96 ; RV64IF-NEXT: call cosf@plt
97 ; RV64IF-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
98 ; RV64IF-NEXT: addi sp, sp, 16
100 %1 = call float @llvm.cos.f32(float %a)
104 ; The sin+cos combination results in an FSINCOS SelectionDAG node.
105 define float @sincos_f32(float %a) nounwind {
106 ; RV32IF-LABEL: sincos_f32:
108 ; RV32IF-NEXT: addi sp, sp, -16
109 ; RV32IF-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
110 ; RV32IF-NEXT: sw s0, 8(sp) # 4-byte Folded Spill
111 ; RV32IF-NEXT: mv s0, a0
112 ; RV32IF-NEXT: call sinf@plt
113 ; RV32IF-NEXT: fmv.w.x ft0, a0
114 ; RV32IF-NEXT: fsw ft0, 4(sp) # 4-byte Folded Spill
115 ; RV32IF-NEXT: mv a0, s0
116 ; RV32IF-NEXT: call cosf@plt
117 ; RV32IF-NEXT: fmv.w.x ft0, a0
118 ; RV32IF-NEXT: flw ft1, 4(sp) # 4-byte Folded Reload
119 ; RV32IF-NEXT: fadd.s ft0, ft1, ft0
120 ; RV32IF-NEXT: fmv.x.w a0, ft0
121 ; RV32IF-NEXT: lw s0, 8(sp) # 4-byte Folded Reload
122 ; RV32IF-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
123 ; RV32IF-NEXT: addi sp, sp, 16
126 ; RV64IF-LABEL: sincos_f32:
128 ; RV64IF-NEXT: addi sp, sp, -32
129 ; RV64IF-NEXT: sd ra, 24(sp) # 8-byte Folded Spill
130 ; RV64IF-NEXT: sd s0, 16(sp) # 8-byte Folded Spill
131 ; RV64IF-NEXT: mv s0, a0
132 ; RV64IF-NEXT: call sinf@plt
133 ; RV64IF-NEXT: fmv.w.x ft0, a0
134 ; RV64IF-NEXT: fsw ft0, 12(sp) # 4-byte Folded Spill
135 ; RV64IF-NEXT: mv a0, s0
136 ; RV64IF-NEXT: call cosf@plt
137 ; RV64IF-NEXT: fmv.w.x ft0, a0
138 ; RV64IF-NEXT: flw ft1, 12(sp) # 4-byte Folded Reload
139 ; RV64IF-NEXT: fadd.s ft0, ft1, ft0
140 ; RV64IF-NEXT: fmv.x.w a0, ft0
141 ; RV64IF-NEXT: ld s0, 16(sp) # 8-byte Folded Reload
142 ; RV64IF-NEXT: ld ra, 24(sp) # 8-byte Folded Reload
143 ; RV64IF-NEXT: addi sp, sp, 32
145 %1 = call float @llvm.sin.f32(float %a)
146 %2 = call float @llvm.cos.f32(float %a)
147 %3 = fadd float %1, %2
151 declare float @llvm.pow.f32(float, float)
153 define float @pow_f32(float %a, float %b) nounwind {
154 ; RV32IF-LABEL: pow_f32:
156 ; RV32IF-NEXT: addi sp, sp, -16
157 ; RV32IF-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
158 ; RV32IF-NEXT: call powf@plt
159 ; RV32IF-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
160 ; RV32IF-NEXT: addi sp, sp, 16
163 ; RV64IF-LABEL: pow_f32:
165 ; RV64IF-NEXT: addi sp, sp, -16
166 ; RV64IF-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
167 ; RV64IF-NEXT: call powf@plt
168 ; RV64IF-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
169 ; RV64IF-NEXT: addi sp, sp, 16
171 %1 = call float @llvm.pow.f32(float %a, float %b)
175 declare float @llvm.exp.f32(float)
177 define float @exp_f32(float %a) nounwind {
178 ; RV32IF-LABEL: exp_f32:
180 ; RV32IF-NEXT: addi sp, sp, -16
181 ; RV32IF-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
182 ; RV32IF-NEXT: call expf@plt
183 ; RV32IF-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
184 ; RV32IF-NEXT: addi sp, sp, 16
187 ; RV64IF-LABEL: exp_f32:
189 ; RV64IF-NEXT: addi sp, sp, -16
190 ; RV64IF-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
191 ; RV64IF-NEXT: call expf@plt
192 ; RV64IF-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
193 ; RV64IF-NEXT: addi sp, sp, 16
195 %1 = call float @llvm.exp.f32(float %a)
199 declare float @llvm.exp2.f32(float)
201 define float @exp2_f32(float %a) nounwind {
202 ; RV32IF-LABEL: exp2_f32:
204 ; RV32IF-NEXT: addi sp, sp, -16
205 ; RV32IF-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
206 ; RV32IF-NEXT: call exp2f@plt
207 ; RV32IF-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
208 ; RV32IF-NEXT: addi sp, sp, 16
211 ; RV64IF-LABEL: exp2_f32:
213 ; RV64IF-NEXT: addi sp, sp, -16
214 ; RV64IF-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
215 ; RV64IF-NEXT: call exp2f@plt
216 ; RV64IF-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
217 ; RV64IF-NEXT: addi sp, sp, 16
219 %1 = call float @llvm.exp2.f32(float %a)
223 declare float @llvm.log.f32(float)
225 define float @log_f32(float %a) nounwind {
226 ; RV32IF-LABEL: log_f32:
228 ; RV32IF-NEXT: addi sp, sp, -16
229 ; RV32IF-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
230 ; RV32IF-NEXT: call logf@plt
231 ; RV32IF-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
232 ; RV32IF-NEXT: addi sp, sp, 16
235 ; RV64IF-LABEL: log_f32:
237 ; RV64IF-NEXT: addi sp, sp, -16
238 ; RV64IF-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
239 ; RV64IF-NEXT: call logf@plt
240 ; RV64IF-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
241 ; RV64IF-NEXT: addi sp, sp, 16
243 %1 = call float @llvm.log.f32(float %a)
247 declare float @llvm.log10.f32(float)
249 define float @log10_f32(float %a) nounwind {
250 ; RV32IF-LABEL: log10_f32:
252 ; RV32IF-NEXT: addi sp, sp, -16
253 ; RV32IF-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
254 ; RV32IF-NEXT: call log10f@plt
255 ; RV32IF-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
256 ; RV32IF-NEXT: addi sp, sp, 16
259 ; RV64IF-LABEL: log10_f32:
261 ; RV64IF-NEXT: addi sp, sp, -16
262 ; RV64IF-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
263 ; RV64IF-NEXT: call log10f@plt
264 ; RV64IF-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
265 ; RV64IF-NEXT: addi sp, sp, 16
267 %1 = call float @llvm.log10.f32(float %a)
271 declare float @llvm.log2.f32(float)
273 define float @log2_f32(float %a) nounwind {
274 ; RV32IF-LABEL: log2_f32:
276 ; RV32IF-NEXT: addi sp, sp, -16
277 ; RV32IF-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
278 ; RV32IF-NEXT: call log2f@plt
279 ; RV32IF-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
280 ; RV32IF-NEXT: addi sp, sp, 16
283 ; RV64IF-LABEL: log2_f32:
285 ; RV64IF-NEXT: addi sp, sp, -16
286 ; RV64IF-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
287 ; RV64IF-NEXT: call log2f@plt
288 ; RV64IF-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
289 ; RV64IF-NEXT: addi sp, sp, 16
291 %1 = call float @llvm.log2.f32(float %a)
295 declare float @llvm.fma.f32(float, float, float)
297 define float @fma_f32(float %a, float %b, float %c) nounwind {
298 ; RV32IF-LABEL: fma_f32:
300 ; RV32IF-NEXT: fmv.w.x ft0, a2
301 ; RV32IF-NEXT: fmv.w.x ft1, a1
302 ; RV32IF-NEXT: fmv.w.x ft2, a0
303 ; RV32IF-NEXT: fmadd.s ft0, ft2, ft1, ft0
304 ; RV32IF-NEXT: fmv.x.w a0, ft0
307 ; RV64IF-LABEL: fma_f32:
309 ; RV64IF-NEXT: fmv.w.x ft0, a2
310 ; RV64IF-NEXT: fmv.w.x ft1, a1
311 ; RV64IF-NEXT: fmv.w.x ft2, a0
312 ; RV64IF-NEXT: fmadd.s ft0, ft2, ft1, ft0
313 ; RV64IF-NEXT: fmv.x.w a0, ft0
315 %1 = call float @llvm.fma.f32(float %a, float %b, float %c)
319 declare float @llvm.fmuladd.f32(float, float, float)
321 define float @fmuladd_f32(float %a, float %b, float %c) nounwind {
322 ; RV32IF-LABEL: fmuladd_f32:
324 ; RV32IF-NEXT: fmv.w.x ft0, a2
325 ; RV32IF-NEXT: fmv.w.x ft1, a1
326 ; RV32IF-NEXT: fmv.w.x ft2, a0
327 ; RV32IF-NEXT: fmadd.s ft0, ft2, ft1, ft0
328 ; RV32IF-NEXT: fmv.x.w a0, ft0
331 ; RV64IF-LABEL: fmuladd_f32:
333 ; RV64IF-NEXT: fmv.w.x ft0, a2
334 ; RV64IF-NEXT: fmv.w.x ft1, a1
335 ; RV64IF-NEXT: fmv.w.x ft2, a0
336 ; RV64IF-NEXT: fmadd.s ft0, ft2, ft1, ft0
337 ; RV64IF-NEXT: fmv.x.w a0, ft0
339 %1 = call float @llvm.fmuladd.f32(float %a, float %b, float %c)
343 declare float @llvm.fabs.f32(float)
345 define float @fabs_f32(float %a) nounwind {
346 ; RV32IF-LABEL: fabs_f32:
348 ; RV32IF-NEXT: lui a1, 524288
349 ; RV32IF-NEXT: addi a1, a1, -1
350 ; RV32IF-NEXT: and a0, a0, a1
353 ; RV64IF-LABEL: fabs_f32:
355 ; RV64IF-NEXT: lui a1, 524288
356 ; RV64IF-NEXT: addiw a1, a1, -1
357 ; RV64IF-NEXT: and a0, a0, a1
359 %1 = call float @llvm.fabs.f32(float %a)
363 declare float @llvm.minnum.f32(float, float)
365 define float @minnum_f32(float %a, float %b) nounwind {
366 ; RV32IF-LABEL: minnum_f32:
368 ; RV32IF-NEXT: fmv.w.x ft0, a1
369 ; RV32IF-NEXT: fmv.w.x ft1, a0
370 ; RV32IF-NEXT: fmin.s ft0, ft1, ft0
371 ; RV32IF-NEXT: fmv.x.w a0, ft0
374 ; RV64IF-LABEL: minnum_f32:
376 ; RV64IF-NEXT: fmv.w.x ft0, a1
377 ; RV64IF-NEXT: fmv.w.x ft1, a0
378 ; RV64IF-NEXT: fmin.s ft0, ft1, ft0
379 ; RV64IF-NEXT: fmv.x.w a0, ft0
381 %1 = call float @llvm.minnum.f32(float %a, float %b)
385 declare float @llvm.maxnum.f32(float, float)
387 define float @maxnum_f32(float %a, float %b) nounwind {
388 ; RV32IF-LABEL: maxnum_f32:
390 ; RV32IF-NEXT: fmv.w.x ft0, a1
391 ; RV32IF-NEXT: fmv.w.x ft1, a0
392 ; RV32IF-NEXT: fmax.s ft0, ft1, ft0
393 ; RV32IF-NEXT: fmv.x.w a0, ft0
396 ; RV64IF-LABEL: maxnum_f32:
398 ; RV64IF-NEXT: fmv.w.x ft0, a1
399 ; RV64IF-NEXT: fmv.w.x ft1, a0
400 ; RV64IF-NEXT: fmax.s ft0, ft1, ft0
401 ; RV64IF-NEXT: fmv.x.w a0, ft0
403 %1 = call float @llvm.maxnum.f32(float %a, float %b)
407 ; TODO: FMINNAN and FMAXNAN aren't handled in
408 ; SelectionDAGLegalize::ExpandNode.
410 ; declare float @llvm.minimum.f32(float, float)
412 ; define float @fminimum_f32(float %a, float %b) nounwind {
413 ; %1 = call float @llvm.minimum.f32(float %a, float %b)
417 ; declare float @llvm.maximum.f32(float, float)
419 ; define float @fmaximum_f32(float %a, float %b) nounwind {
420 ; %1 = call float @llvm.maximum.f32(float %a, float %b)
424 declare float @llvm.copysign.f32(float, float)
426 define float @copysign_f32(float %a, float %b) nounwind {
427 ; RV32IF-LABEL: copysign_f32:
429 ; RV32IF-NEXT: fmv.w.x ft0, a1
430 ; RV32IF-NEXT: fmv.w.x ft1, a0
431 ; RV32IF-NEXT: fsgnj.s ft0, ft1, ft0
432 ; RV32IF-NEXT: fmv.x.w a0, ft0
435 ; RV64IF-LABEL: copysign_f32:
437 ; RV64IF-NEXT: fmv.w.x ft0, a1
438 ; RV64IF-NEXT: fmv.w.x ft1, a0
439 ; RV64IF-NEXT: fsgnj.s ft0, ft1, ft0
440 ; RV64IF-NEXT: fmv.x.w a0, ft0
442 %1 = call float @llvm.copysign.f32(float %a, float %b)
446 declare float @llvm.floor.f32(float)
448 define float @floor_f32(float %a) nounwind {
449 ; RV32IF-LABEL: floor_f32:
451 ; RV32IF-NEXT: addi sp, sp, -16
452 ; RV32IF-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
453 ; RV32IF-NEXT: call floorf@plt
454 ; RV32IF-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
455 ; RV32IF-NEXT: addi sp, sp, 16
458 ; RV64IF-LABEL: floor_f32:
460 ; RV64IF-NEXT: addi sp, sp, -16
461 ; RV64IF-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
462 ; RV64IF-NEXT: call floorf@plt
463 ; RV64IF-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
464 ; RV64IF-NEXT: addi sp, sp, 16
466 %1 = call float @llvm.floor.f32(float %a)
470 declare float @llvm.ceil.f32(float)
472 define float @ceil_f32(float %a) nounwind {
473 ; RV32IF-LABEL: ceil_f32:
475 ; RV32IF-NEXT: addi sp, sp, -16
476 ; RV32IF-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
477 ; RV32IF-NEXT: call ceilf@plt
478 ; RV32IF-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
479 ; RV32IF-NEXT: addi sp, sp, 16
482 ; RV64IF-LABEL: ceil_f32:
484 ; RV64IF-NEXT: addi sp, sp, -16
485 ; RV64IF-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
486 ; RV64IF-NEXT: call ceilf@plt
487 ; RV64IF-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
488 ; RV64IF-NEXT: addi sp, sp, 16
490 %1 = call float @llvm.ceil.f32(float %a)
494 declare float @llvm.trunc.f32(float)
496 define float @trunc_f32(float %a) nounwind {
497 ; RV32IF-LABEL: trunc_f32:
499 ; RV32IF-NEXT: addi sp, sp, -16
500 ; RV32IF-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
501 ; RV32IF-NEXT: call truncf@plt
502 ; RV32IF-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
503 ; RV32IF-NEXT: addi sp, sp, 16
506 ; RV64IF-LABEL: trunc_f32:
508 ; RV64IF-NEXT: addi sp, sp, -16
509 ; RV64IF-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
510 ; RV64IF-NEXT: call truncf@plt
511 ; RV64IF-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
512 ; RV64IF-NEXT: addi sp, sp, 16
514 %1 = call float @llvm.trunc.f32(float %a)
518 declare float @llvm.rint.f32(float)
520 define float @rint_f32(float %a) nounwind {
521 ; RV32IF-LABEL: rint_f32:
523 ; RV32IF-NEXT: addi sp, sp, -16
524 ; RV32IF-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
525 ; RV32IF-NEXT: call rintf@plt
526 ; RV32IF-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
527 ; RV32IF-NEXT: addi sp, sp, 16
530 ; RV64IF-LABEL: rint_f32:
532 ; RV64IF-NEXT: addi sp, sp, -16
533 ; RV64IF-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
534 ; RV64IF-NEXT: call rintf@plt
535 ; RV64IF-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
536 ; RV64IF-NEXT: addi sp, sp, 16
538 %1 = call float @llvm.rint.f32(float %a)
542 declare float @llvm.nearbyint.f32(float)
544 define float @nearbyint_f32(float %a) nounwind {
545 ; RV32IF-LABEL: nearbyint_f32:
547 ; RV32IF-NEXT: addi sp, sp, -16
548 ; RV32IF-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
549 ; RV32IF-NEXT: call nearbyintf@plt
550 ; RV32IF-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
551 ; RV32IF-NEXT: addi sp, sp, 16
554 ; RV64IF-LABEL: nearbyint_f32:
556 ; RV64IF-NEXT: addi sp, sp, -16
557 ; RV64IF-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
558 ; RV64IF-NEXT: call nearbyintf@plt
559 ; RV64IF-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
560 ; RV64IF-NEXT: addi sp, sp, 16
562 %1 = call float @llvm.nearbyint.f32(float %a)
566 declare float @llvm.round.f32(float)
568 define float @round_f32(float %a) nounwind {
569 ; RV32IF-LABEL: round_f32:
571 ; RV32IF-NEXT: addi sp, sp, -16
572 ; RV32IF-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
573 ; RV32IF-NEXT: call roundf@plt
574 ; RV32IF-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
575 ; RV32IF-NEXT: addi sp, sp, 16
578 ; RV64IF-LABEL: round_f32:
580 ; RV64IF-NEXT: addi sp, sp, -16
581 ; RV64IF-NEXT: sd ra, 8(sp) # 8-byte Folded Spill
582 ; RV64IF-NEXT: call roundf@plt
583 ; RV64IF-NEXT: ld ra, 8(sp) # 8-byte Folded Reload
584 ; RV64IF-NEXT: addi sp, sp, 16
586 %1 = call float @llvm.round.f32(float %a)
590 declare iXLen @llvm.lrint.iXLen.f32(float)
592 define iXLen @lrint_f32(float %a) nounwind {
593 ; RV32IF-LABEL: lrint_f32:
595 ; RV32IF-NEXT: fmv.w.x ft0, a0
596 ; RV32IF-NEXT: fcvt.w.s a0, ft0
599 ; RV64IF-LABEL: lrint_f32:
601 ; RV64IF-NEXT: fmv.w.x ft0, a0
602 ; RV64IF-NEXT: fcvt.l.s a0, ft0
604 %1 = call iXLen @llvm.lrint.iXLen.f32(float %a)
608 declare iXLen @llvm.lround.iXLen.f32(float)
610 define iXLen @lround_f32(float %a) nounwind {
611 ; RV32IF-LABEL: lround_f32:
613 ; RV32IF-NEXT: fmv.w.x ft0, a0
614 ; RV32IF-NEXT: fcvt.w.s a0, ft0, rmm
617 ; RV64IF-LABEL: lround_f32:
619 ; RV64IF-NEXT: fmv.w.x ft0, a0
620 ; RV64IF-NEXT: fcvt.l.s a0, ft0, rmm
622 %1 = call iXLen @llvm.lround.iXLen.f32(float %a)
626 declare i64 @llvm.llrint.i64.f32(float)
628 define i64 @llrint_f32(float %a) nounwind {
629 ; RV32IF-LABEL: llrint_f32:
631 ; RV32IF-NEXT: addi sp, sp, -16
632 ; RV32IF-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
633 ; RV32IF-NEXT: call llrintf@plt
634 ; RV32IF-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
635 ; RV32IF-NEXT: addi sp, sp, 16
638 ; RV64IF-LABEL: llrint_f32:
640 ; RV64IF-NEXT: fmv.w.x ft0, a0
641 ; RV64IF-NEXT: fcvt.l.s a0, ft0
643 %1 = call i64 @llvm.llrint.i64.f32(float %a)
647 declare i64 @llvm.llround.i64.f32(float)
649 define i64 @llround_f32(float %a) nounwind {
650 ; RV32IF-LABEL: llround_f32:
652 ; RV32IF-NEXT: addi sp, sp, -16
653 ; RV32IF-NEXT: sw ra, 12(sp) # 4-byte Folded Spill
654 ; RV32IF-NEXT: call llroundf@plt
655 ; RV32IF-NEXT: lw ra, 12(sp) # 4-byte Folded Reload
656 ; RV32IF-NEXT: addi sp, sp, 16
659 ; RV64IF-LABEL: llround_f32:
661 ; RV64IF-NEXT: fmv.w.x ft0, a0
662 ; RV64IF-NEXT: fcvt.l.s a0, ft0, rmm
664 %1 = call i64 @llvm.llround.i64.f32(float %a)