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
6
7; TODO: constant pool shouldn't be necessary for RV64IF.
8define float @float_imm() nounwind {
9; RV32IF-LABEL: float_imm:
10; RV32IF:       # %bb.0:
11; RV32IF-NEXT:    lui a0, 263313
12; RV32IF-NEXT:    addi a0, a0, -37
13; RV32IF-NEXT:    ret
14;
15; RV64IF-LABEL: float_imm:
16; RV64IF:       # %bb.0:
17; RV64IF-NEXT:    lui a0, %hi(.LCPI0_0)
18; RV64IF-NEXT:    flw ft0, %lo(.LCPI0_0)(a0)
19; RV64IF-NEXT:    fmv.x.w a0, ft0
20; RV64IF-NEXT:    ret
21  ret float 3.14159274101257324218750
22}
23
24define float @float_imm_op(float %a) nounwind {
25; RV32IF-LABEL: float_imm_op:
26; RV32IF:       # %bb.0:
27; RV32IF-NEXT:    lui a1, %hi(.LCPI1_0)
28; RV32IF-NEXT:    flw ft0, %lo(.LCPI1_0)(a1)
29; RV32IF-NEXT:    fmv.w.x ft1, a0
30; RV32IF-NEXT:    fadd.s ft0, ft1, ft0
31; RV32IF-NEXT:    fmv.x.w a0, ft0
32; RV32IF-NEXT:    ret
33;
34; RV64IF-LABEL: float_imm_op:
35; RV64IF:       # %bb.0:
36; RV64IF-NEXT:    lui a1, %hi(.LCPI1_0)
37; RV64IF-NEXT:    flw ft0, %lo(.LCPI1_0)(a1)
38; RV64IF-NEXT:    fmv.w.x ft1, a0
39; RV64IF-NEXT:    fadd.s ft0, ft1, ft0
40; RV64IF-NEXT:    fmv.x.w a0, ft0
41; RV64IF-NEXT:    ret
42  %1 = fadd float %a, 1.0
43  ret float %1
44}
45