1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=riscv32 -mattr=+experimental-zfh -verify-machineinstrs \
3 ; RUN: -target-abi ilp32f < %s | FileCheck -check-prefix=RV32IZFH %s
4 ; RUN: llc -mtriple=riscv64 -mattr=+experimental-zfh -verify-machineinstrs \
5 ; RUN: -target-abi lp64f < %s | FileCheck -check-prefix=RV64IZFH %s
7 define i32 @fcmp_false(half %a, half %b) nounwind {
8 ; RV32IZFH-LABEL: fcmp_false:
10 ; RV32IZFH-NEXT: mv a0, zero
13 ; RV64IZFH-LABEL: fcmp_false:
15 ; RV64IZFH-NEXT: mv a0, zero
17 %1 = fcmp false half %a, %b
18 %2 = zext i1 %1 to i32
22 define i32 @fcmp_oeq(half %a, half %b) nounwind {
23 ; RV32IZFH-LABEL: fcmp_oeq:
25 ; RV32IZFH-NEXT: feq.h a0, fa0, fa1
28 ; RV64IZFH-LABEL: fcmp_oeq:
30 ; RV64IZFH-NEXT: feq.h a0, fa0, fa1
32 %1 = fcmp oeq half %a, %b
33 %2 = zext i1 %1 to i32
37 define i32 @fcmp_ogt(half %a, half %b) nounwind {
38 ; RV32IZFH-LABEL: fcmp_ogt:
40 ; RV32IZFH-NEXT: flt.h a0, fa1, fa0
43 ; RV64IZFH-LABEL: fcmp_ogt:
45 ; RV64IZFH-NEXT: flt.h a0, fa1, fa0
47 %1 = fcmp ogt half %a, %b
48 %2 = zext i1 %1 to i32
52 define i32 @fcmp_oge(half %a, half %b) nounwind {
53 ; RV32IZFH-LABEL: fcmp_oge:
55 ; RV32IZFH-NEXT: fle.h a0, fa1, fa0
58 ; RV64IZFH-LABEL: fcmp_oge:
60 ; RV64IZFH-NEXT: fle.h a0, fa1, fa0
62 %1 = fcmp oge half %a, %b
63 %2 = zext i1 %1 to i32
67 define i32 @fcmp_olt(half %a, half %b) nounwind {
68 ; RV32IZFH-LABEL: fcmp_olt:
70 ; RV32IZFH-NEXT: flt.h a0, fa0, fa1
73 ; RV64IZFH-LABEL: fcmp_olt:
75 ; RV64IZFH-NEXT: flt.h a0, fa0, fa1
77 %1 = fcmp olt half %a, %b
78 %2 = zext i1 %1 to i32
82 define i32 @fcmp_ole(half %a, half %b) nounwind {
83 ; RV32IZFH-LABEL: fcmp_ole:
85 ; RV32IZFH-NEXT: fle.h a0, fa0, fa1
88 ; RV64IZFH-LABEL: fcmp_ole:
90 ; RV64IZFH-NEXT: fle.h a0, fa0, fa1
92 %1 = fcmp ole half %a, %b
93 %2 = zext i1 %1 to i32
97 define i32 @fcmp_one(half %a, half %b) nounwind {
98 ; RV32IZFH-LABEL: fcmp_one:
100 ; RV32IZFH-NEXT: flt.h a0, fa0, fa1
101 ; RV32IZFH-NEXT: flt.h a1, fa1, fa0
102 ; RV32IZFH-NEXT: or a0, a1, a0
105 ; RV64IZFH-LABEL: fcmp_one:
107 ; RV64IZFH-NEXT: flt.h a0, fa0, fa1
108 ; RV64IZFH-NEXT: flt.h a1, fa1, fa0
109 ; RV64IZFH-NEXT: or a0, a1, a0
111 %1 = fcmp one half %a, %b
112 %2 = zext i1 %1 to i32
116 define i32 @fcmp_ord(half %a, half %b) nounwind {
117 ; RV32IZFH-LABEL: fcmp_ord:
119 ; RV32IZFH-NEXT: feq.h a0, fa1, fa1
120 ; RV32IZFH-NEXT: feq.h a1, fa0, fa0
121 ; RV32IZFH-NEXT: and a0, a1, a0
124 ; RV64IZFH-LABEL: fcmp_ord:
126 ; RV64IZFH-NEXT: feq.h a0, fa1, fa1
127 ; RV64IZFH-NEXT: feq.h a1, fa0, fa0
128 ; RV64IZFH-NEXT: and a0, a1, a0
130 %1 = fcmp ord half %a, %b
131 %2 = zext i1 %1 to i32
135 define i32 @fcmp_ueq(half %a, half %b) nounwind {
136 ; RV32IZFH-LABEL: fcmp_ueq:
138 ; RV32IZFH-NEXT: flt.h a0, fa0, fa1
139 ; RV32IZFH-NEXT: flt.h a1, fa1, fa0
140 ; RV32IZFH-NEXT: or a0, a1, a0
141 ; RV32IZFH-NEXT: xori a0, a0, 1
144 ; RV64IZFH-LABEL: fcmp_ueq:
146 ; RV64IZFH-NEXT: flt.h a0, fa0, fa1
147 ; RV64IZFH-NEXT: flt.h a1, fa1, fa0
148 ; RV64IZFH-NEXT: or a0, a1, a0
149 ; RV64IZFH-NEXT: xori a0, a0, 1
151 %1 = fcmp ueq half %a, %b
152 %2 = zext i1 %1 to i32
156 define i32 @fcmp_ugt(half %a, half %b) nounwind {
157 ; RV32IZFH-LABEL: fcmp_ugt:
159 ; RV32IZFH-NEXT: fle.h a0, fa0, fa1
160 ; RV32IZFH-NEXT: xori a0, a0, 1
163 ; RV64IZFH-LABEL: fcmp_ugt:
165 ; RV64IZFH-NEXT: fle.h a0, fa0, fa1
166 ; RV64IZFH-NEXT: xori a0, a0, 1
168 %1 = fcmp ugt half %a, %b
169 %2 = zext i1 %1 to i32
173 define i32 @fcmp_uge(half %a, half %b) nounwind {
174 ; RV32IZFH-LABEL: fcmp_uge:
176 ; RV32IZFH-NEXT: flt.h a0, fa0, fa1
177 ; RV32IZFH-NEXT: xori a0, a0, 1
180 ; RV64IZFH-LABEL: fcmp_uge:
182 ; RV64IZFH-NEXT: flt.h a0, fa0, fa1
183 ; RV64IZFH-NEXT: xori a0, a0, 1
185 %1 = fcmp uge half %a, %b
186 %2 = zext i1 %1 to i32
190 define i32 @fcmp_ult(half %a, half %b) nounwind {
191 ; RV32IZFH-LABEL: fcmp_ult:
193 ; RV32IZFH-NEXT: fle.h a0, fa1, fa0
194 ; RV32IZFH-NEXT: xori a0, a0, 1
197 ; RV64IZFH-LABEL: fcmp_ult:
199 ; RV64IZFH-NEXT: fle.h a0, fa1, fa0
200 ; RV64IZFH-NEXT: xori a0, a0, 1
202 %1 = fcmp ult half %a, %b
203 %2 = zext i1 %1 to i32
207 define i32 @fcmp_ule(half %a, half %b) nounwind {
208 ; RV32IZFH-LABEL: fcmp_ule:
210 ; RV32IZFH-NEXT: flt.h a0, fa1, fa0
211 ; RV32IZFH-NEXT: xori a0, a0, 1
214 ; RV64IZFH-LABEL: fcmp_ule:
216 ; RV64IZFH-NEXT: flt.h a0, fa1, fa0
217 ; RV64IZFH-NEXT: xori a0, a0, 1
219 %1 = fcmp ule half %a, %b
220 %2 = zext i1 %1 to i32
224 define i32 @fcmp_une(half %a, half %b) nounwind {
225 ; RV32IZFH-LABEL: fcmp_une:
227 ; RV32IZFH-NEXT: feq.h a0, fa0, fa1
228 ; RV32IZFH-NEXT: xori a0, a0, 1
231 ; RV64IZFH-LABEL: fcmp_une:
233 ; RV64IZFH-NEXT: feq.h a0, fa0, fa1
234 ; RV64IZFH-NEXT: xori a0, a0, 1
236 %1 = fcmp une half %a, %b
237 %2 = zext i1 %1 to i32
241 define i32 @fcmp_uno(half %a, half %b) nounwind {
242 ; RV32IZFH-LABEL: fcmp_uno:
244 ; RV32IZFH-NEXT: feq.h a0, fa1, fa1
245 ; RV32IZFH-NEXT: feq.h a1, fa0, fa0
246 ; RV32IZFH-NEXT: and a0, a1, a0
247 ; RV32IZFH-NEXT: xori a0, a0, 1
250 ; RV64IZFH-LABEL: fcmp_uno:
252 ; RV64IZFH-NEXT: feq.h a0, fa1, fa1
253 ; RV64IZFH-NEXT: feq.h a1, fa0, fa0
254 ; RV64IZFH-NEXT: and a0, a1, a0
255 ; RV64IZFH-NEXT: xori a0, a0, 1
257 %1 = fcmp uno half %a, %b
258 %2 = zext i1 %1 to i32
262 define i32 @fcmp_true(half %a, half %b) nounwind {
263 ; RV32IZFH-LABEL: fcmp_true:
265 ; RV32IZFH-NEXT: addi a0, zero, 1
268 ; RV64IZFH-LABEL: fcmp_true:
270 ; RV64IZFH-NEXT: addi a0, zero, 1
272 %1 = fcmp true half %a, %b
273 %2 = zext i1 %1 to i32