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: | FileCheck -check-prefix=RV32IF %s
4 ; RUN: llc -mtriple=riscv64 -mattr=+f -verify-machineinstrs < %s \
5 ; RUN: | FileCheck -check-prefix=RV64IF %s
7 ; TODO: constant pool shouldn't be necessary for RV64IF.
8 define float @float_imm() nounwind {
9 ; RV32IF-LABEL: float_imm:
11 ; RV32IF-NEXT: lui a0, 263313
12 ; RV32IF-NEXT: addi a0, a0, -37
15 ; RV64IF-LABEL: float_imm:
17 ; RV64IF-NEXT: lui a0, %hi(.LCPI0_0)
18 ; RV64IF-NEXT: addi a0, a0, %lo(.LCPI0_0)
19 ; RV64IF-NEXT: flw ft0, 0(a0)
20 ; RV64IF-NEXT: fmv.x.w a0, ft0
22 ret float 3.14159274101257324218750
25 define float @float_imm_op(float %a) nounwind {
26 ; TODO: addi should be folded in to the flw
27 ; RV32IF-LABEL: float_imm_op:
29 ; RV32IF-NEXT: fmv.w.x ft0, a0
30 ; RV32IF-NEXT: lui a0, %hi(.LCPI1_0)
31 ; RV32IF-NEXT: addi a0, a0, %lo(.LCPI1_0)
32 ; RV32IF-NEXT: flw ft1, 0(a0)
33 ; RV32IF-NEXT: fadd.s ft0, ft0, ft1
34 ; RV32IF-NEXT: fmv.x.w a0, ft0
37 ; RV64IF-LABEL: float_imm_op:
39 ; RV64IF-NEXT: fmv.w.x ft0, a0
40 ; RV64IF-NEXT: lui a0, %hi(.LCPI1_0)
41 ; RV64IF-NEXT: addi a0, a0, %lo(.LCPI1_0)
42 ; RV64IF-NEXT: flw ft1, 0(a0)
43 ; RV64IF-NEXT: fadd.s ft0, ft0, ft1
44 ; RV64IF-NEXT: fmv.x.w a0, ft0
46 %1 = fadd float %a, 1.0