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
23 ; RV32ZFINX-NEXT: # kill: def $x10_w killed $x10_w killed $x10
26 ; RV64ZFINX-LABEL: float_imm:
28 ; RV64ZFINX-NEXT: lui a0, 263313
29 ; RV64ZFINX-NEXT: addiw a0, a0, -37
30 ; RV64ZFINX-NEXT: # kill: def $x10_w killed $x10_w killed $x10
32 ret float 3.14159274101257324218750
35 define float @float_imm_op(float %a) nounwind {
36 ; CHECK-LABEL: float_imm_op:
38 ; CHECK-NEXT: lui a0, 260096
39 ; CHECK-NEXT: fmv.w.x fa5, a0
40 ; CHECK-NEXT: fadd.s fa0, fa0, fa5
43 ; CHECKZFINX-LABEL: float_imm_op:
44 ; CHECKZFINX: # %bb.0:
45 ; CHECKZFINX-NEXT: lui a1, 260096
46 ; CHECKZFINX-NEXT: fadd.s a0, a0, a1
47 ; CHECKZFINX-NEXT: ret
48 %1 = fadd float %a, 1.0
52 define float @float_positive_zero(ptr %pf) nounwind {
53 ; CHECK-LABEL: float_positive_zero:
55 ; CHECK-NEXT: fmv.w.x fa0, zero
58 ; CHECKZFINX-LABEL: float_positive_zero:
59 ; CHECKZFINX: # %bb.0:
60 ; CHECKZFINX-NEXT: li a0, 0
61 ; CHECKZFINX-NEXT: ret
65 define float @float_negative_zero(ptr %pf) nounwind {
66 ; CHECK-LABEL: float_negative_zero:
68 ; CHECK-NEXT: lui a0, 524288
69 ; CHECK-NEXT: fmv.w.x fa0, a0
72 ; CHECKZFINX-LABEL: float_negative_zero:
73 ; CHECKZFINX: # %bb.0:
74 ; CHECKZFINX-NEXT: lui a0, 524288
75 ; CHECKZFINX-NEXT: ret