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 %s
4 ; RUN: llc -mtriple=riscv64 -mattr=+f -verify-machineinstrs < %s \
5 ; RUN: -target-abi=lp64f | FileCheck %s
6 ; RUN: llc -mtriple=riscv32 -mattr=+zfinx -verify-machineinstrs < %s \
7 ; RUN: -target-abi=ilp32 | FileCheck --check-prefixes=CHECKZFINX,RV32ZFINX %s
8 ; RUN: llc -mtriple=riscv64 -mattr=+zfinx -verify-machineinstrs < %s \
9 ; RUN: -target-abi=lp64 | FileCheck --check-prefixes=CHECKZFINX,RV64ZFINX %s
11 ; TODO: constant pool shouldn't be necessary for RV64IF.
12 define float @float_imm() nounwind {
13 ; CHECK-LABEL: float_imm:
15 ; CHECK-NEXT: lui a0, %hi(.LCPI0_0)
16 ; CHECK-NEXT: flw fa0, %lo(.LCPI0_0)(a0)
19 ; RV32ZFINX-LABEL: float_imm:
21 ; RV32ZFINX-NEXT: lui a0, 263313
22 ; RV32ZFINX-NEXT: addi a0, a0, -37
25 ; RV64ZFINX-LABEL: float_imm:
27 ; RV64ZFINX-NEXT: lui a0, %hi(.LCPI0_0)
28 ; RV64ZFINX-NEXT: lw a0, %lo(.LCPI0_0)(a0)
30 ret float 3.14159274101257324218750
33 define float @float_imm_op(float %a) nounwind {
34 ; CHECK-LABEL: float_imm_op:
36 ; CHECK-NEXT: lui a0, 260096
37 ; CHECK-NEXT: fmv.w.x fa5, a0
38 ; CHECK-NEXT: fadd.s fa0, fa0, fa5
41 ; CHECKZFINX-LABEL: float_imm_op:
42 ; CHECKZFINX: # %bb.0:
43 ; CHECKZFINX-NEXT: lui a1, 260096
44 ; CHECKZFINX-NEXT: fadd.s a0, a0, a1
45 ; CHECKZFINX-NEXT: ret
46 %1 = fadd float %a, 1.0
50 define float @float_positive_zero(ptr %pf) nounwind {
51 ; CHECK-LABEL: float_positive_zero:
53 ; CHECK-NEXT: fmv.w.x fa0, zero
56 ; CHECKZFINX-LABEL: float_positive_zero:
57 ; CHECKZFINX: # %bb.0:
58 ; CHECKZFINX-NEXT: li a0, 0
59 ; CHECKZFINX-NEXT: ret
63 define float @float_negative_zero(ptr %pf) nounwind {
64 ; CHECK-LABEL: float_negative_zero:
66 ; CHECK-NEXT: lui a0, 524288
67 ; CHECK-NEXT: fmv.w.x fa0, a0
70 ; CHECKZFINX-LABEL: float_negative_zero:
71 ; CHECKZFINX: # %bb.0:
72 ; CHECKZFINX-NEXT: lui a0, 524288
73 ; CHECKZFINX-NEXT: ret