1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=riscv32 -target-abi ilp32f -mattr=+zfa,+zfh < %s \
4 ; RUN: llc -mtriple=riscv64 -target-abi lp64f -mattr=+zfa,+zfh < %s \
6 ; RUN: llc -mtriple=riscv32 -target-abi ilp32f -mattr=+zfa,+zfhmin < %s \
7 ; RUN: | FileCheck %s --check-prefix=ZFHMIN
8 ; RUN: llc -mtriple=riscv64 -target-abi lp64f -mattr=+zfa,+zfhmin < %s \
9 ; RUN: | FileCheck %s --check-prefix=ZFHMIN
11 define half @loadfpimm1() {
12 ; CHECK-LABEL: loadfpimm1:
14 ; CHECK-NEXT: fli.h fa0, 0.0625
17 ; ZFHMIN-LABEL: loadfpimm1:
19 ; ZFHMIN-NEXT: lui a0, %hi(.LCPI0_0)
20 ; ZFHMIN-NEXT: flh fa0, %lo(.LCPI0_0)(a0)
25 define half @loadfpimm2() {
26 ; CHECK-LABEL: loadfpimm2:
28 ; CHECK-NEXT: fli.h fa0, 0.75
31 ; ZFHMIN-LABEL: loadfpimm2:
33 ; ZFHMIN-NEXT: lui a0, %hi(.LCPI1_0)
34 ; ZFHMIN-NEXT: flh fa0, %lo(.LCPI1_0)(a0)
39 define half @loadfpimm3() {
40 ; CHECK-LABEL: loadfpimm3:
42 ; CHECK-NEXT: fli.h fa0, 1.25
45 ; ZFHMIN-LABEL: loadfpimm3:
47 ; ZFHMIN-NEXT: lui a0, %hi(.LCPI2_0)
48 ; ZFHMIN-NEXT: flh fa0, %lo(.LCPI2_0)(a0)
53 define half @loadfpimm4() {
54 ; CHECK-LABEL: loadfpimm4:
56 ; CHECK-NEXT: fli.h fa0, 3.0
59 ; ZFHMIN-LABEL: loadfpimm4:
61 ; ZFHMIN-NEXT: lui a0, %hi(.LCPI3_0)
62 ; ZFHMIN-NEXT: flh fa0, %lo(.LCPI3_0)(a0)
67 define half @loadfpimm5() {
68 ; CHECK-LABEL: loadfpimm5:
70 ; CHECK-NEXT: fli.h fa0, 256.0
73 ; ZFHMIN-LABEL: loadfpimm5:
75 ; ZFHMIN-NEXT: lui a0, %hi(.LCPI4_0)
76 ; ZFHMIN-NEXT: flh fa0, %lo(.LCPI4_0)(a0)
81 define half @loadfpimm6() {
82 ; CHECK-LABEL: loadfpimm6:
84 ; CHECK-NEXT: fli.h fa0, inf
87 ; ZFHMIN-LABEL: loadfpimm6:
89 ; ZFHMIN-NEXT: lui a0, %hi(.LCPI5_0)
90 ; ZFHMIN-NEXT: flh fa0, %lo(.LCPI5_0)(a0)
95 define half @loadfpimm7() {
96 ; CHECK-LABEL: loadfpimm7:
98 ; CHECK-NEXT: fli.h fa0, nan
101 ; ZFHMIN-LABEL: loadfpimm7:
103 ; ZFHMIN-NEXT: lui a0, %hi(.LCPI6_0)
104 ; ZFHMIN-NEXT: flh fa0, %lo(.LCPI6_0)(a0)
109 define half @loadfpimm8() {
110 ; CHECK-LABEL: loadfpimm8:
112 ; CHECK-NEXT: fli.h fa0, min
115 ; ZFHMIN-LABEL: loadfpimm8:
117 ; ZFHMIN-NEXT: li a0, 1024
118 ; ZFHMIN-NEXT: fmv.h.x fa0, a0
123 define half @loadfpimm9() {
124 ; CHECK-LABEL: loadfpimm9:
126 ; CHECK-NEXT: lui a0, %hi(.LCPI8_0)
127 ; CHECK-NEXT: flh fa0, %lo(.LCPI8_0)(a0)
130 ; ZFHMIN-LABEL: loadfpimm9:
132 ; ZFHMIN-NEXT: lui a0, %hi(.LCPI8_0)
133 ; ZFHMIN-NEXT: flh fa0, %lo(.LCPI8_0)(a0)
139 define half @loadfpimm10() {
140 ; CHECK-LABEL: loadfpimm10:
142 ; CHECK-NEXT: fli.h fa0, 1.52587890625e-05
145 ; ZFHMIN-LABEL: loadfpimm10:
147 ; ZFHMIN-NEXT: li a0, 256
148 ; ZFHMIN-NEXT: fmv.h.x fa0, a0
154 define half @loadfpimm11() {
155 ; CHECK-LABEL: loadfpimm11:
157 ; CHECK-NEXT: fli.h fa0, 3.0517578125e-05
160 ; ZFHMIN-LABEL: loadfpimm11:
162 ; ZFHMIN-NEXT: li a0, 512
163 ; ZFHMIN-NEXT: fmv.h.x fa0, a0
168 ; Negative test. This is an snan with payload of 1.
169 define half @loadfpimm12() {
170 ; CHECK-LABEL: loadfpimm12:
172 ; CHECK-NEXT: lui a0, %hi(.LCPI11_0)
173 ; CHECK-NEXT: flh fa0, %lo(.LCPI11_0)(a0)
176 ; ZFHMIN-LABEL: loadfpimm12:
178 ; ZFHMIN-NEXT: lui a0, %hi(.LCPI11_0)
179 ; ZFHMIN-NEXT: flh fa0, %lo(.LCPI11_0)(a0)
184 define half @loadfpimm13() {
185 ; CHECK-LABEL: loadfpimm13:
187 ; CHECK-NEXT: fli.h fa0, -1.0
190 ; ZFHMIN-LABEL: loadfpimm13:
192 ; ZFHMIN-NEXT: lui a0, %hi(.LCPI12_0)
193 ; ZFHMIN-NEXT: flh fa0, %lo(.LCPI12_0)(a0)
198 ; Ensure fli isn't directly used for negated versions of numbers in the fli
200 define half @loadfpimm14() {
201 ; CHECK-LABEL: loadfpimm14:
203 ; CHECK-NEXT: fli.h fa5, 2.0
204 ; CHECK-NEXT: fneg.h fa0, fa5
207 ; ZFHMIN-LABEL: loadfpimm14:
209 ; ZFHMIN-NEXT: lui a0, 1048572
210 ; ZFHMIN-NEXT: fmv.h.x fa0, a0
215 ; Ensure fli isn't directly used for negative min normal value.
216 define half @loadfpimm15() {
217 ; CHECK-LABEL: loadfpimm15:
219 ; CHECK-NEXT: fli.h fa5, min
220 ; CHECK-NEXT: fneg.h fa0, fa5
223 ; ZFHMIN-LABEL: loadfpimm15:
225 ; ZFHMIN-NEXT: lui a0, %hi(.LCPI14_0)
226 ; ZFHMIN-NEXT: flh fa0, %lo(.LCPI14_0)(a0)