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
7 define i32 @fcmp_false(float %a, float %b) nounwind {
8 ; RV32IF-LABEL: fcmp_false:
10 ; RV32IF-NEXT: mv a0, zero
13 ; RV64IF-LABEL: fcmp_false:
15 ; RV64IF-NEXT: mv a0, zero
17 %1 = fcmp false float %a, %b
18 %2 = zext i1 %1 to i32
22 define i32 @fcmp_oeq(float %a, float %b) nounwind {
23 ; RV32IF-LABEL: fcmp_oeq:
25 ; RV32IF-NEXT: fmv.w.x ft0, a1
26 ; RV32IF-NEXT: fmv.w.x ft1, a0
27 ; RV32IF-NEXT: feq.s a0, ft1, ft0
30 ; RV64IF-LABEL: fcmp_oeq:
32 ; RV64IF-NEXT: fmv.w.x ft0, a1
33 ; RV64IF-NEXT: fmv.w.x ft1, a0
34 ; RV64IF-NEXT: feq.s a0, ft1, ft0
36 %1 = fcmp oeq float %a, %b
37 %2 = zext i1 %1 to i32
41 define i32 @fcmp_ogt(float %a, float %b) nounwind {
42 ; RV32IF-LABEL: fcmp_ogt:
44 ; RV32IF-NEXT: fmv.w.x ft0, a0
45 ; RV32IF-NEXT: fmv.w.x ft1, a1
46 ; RV32IF-NEXT: flt.s a0, ft1, ft0
49 ; RV64IF-LABEL: fcmp_ogt:
51 ; RV64IF-NEXT: fmv.w.x ft0, a0
52 ; RV64IF-NEXT: fmv.w.x ft1, a1
53 ; RV64IF-NEXT: flt.s a0, ft1, ft0
55 %1 = fcmp ogt float %a, %b
56 %2 = zext i1 %1 to i32
60 define i32 @fcmp_oge(float %a, float %b) nounwind {
61 ; RV32IF-LABEL: fcmp_oge:
63 ; RV32IF-NEXT: fmv.w.x ft0, a0
64 ; RV32IF-NEXT: fmv.w.x ft1, a1
65 ; RV32IF-NEXT: fle.s a0, ft1, ft0
68 ; RV64IF-LABEL: fcmp_oge:
70 ; RV64IF-NEXT: fmv.w.x ft0, a0
71 ; RV64IF-NEXT: fmv.w.x ft1, a1
72 ; RV64IF-NEXT: fle.s a0, ft1, ft0
74 %1 = fcmp oge float %a, %b
75 %2 = zext i1 %1 to i32
79 define i32 @fcmp_olt(float %a, float %b) nounwind {
80 ; RV32IF-LABEL: fcmp_olt:
82 ; RV32IF-NEXT: fmv.w.x ft0, a1
83 ; RV32IF-NEXT: fmv.w.x ft1, a0
84 ; RV32IF-NEXT: flt.s a0, ft1, ft0
87 ; RV64IF-LABEL: fcmp_olt:
89 ; RV64IF-NEXT: fmv.w.x ft0, a1
90 ; RV64IF-NEXT: fmv.w.x ft1, a0
91 ; RV64IF-NEXT: flt.s a0, ft1, ft0
93 %1 = fcmp olt float %a, %b
94 %2 = zext i1 %1 to i32
98 define i32 @fcmp_ole(float %a, float %b) nounwind {
99 ; RV32IF-LABEL: fcmp_ole:
101 ; RV32IF-NEXT: fmv.w.x ft0, a1
102 ; RV32IF-NEXT: fmv.w.x ft1, a0
103 ; RV32IF-NEXT: fle.s a0, ft1, ft0
106 ; RV64IF-LABEL: fcmp_ole:
108 ; RV64IF-NEXT: fmv.w.x ft0, a1
109 ; RV64IF-NEXT: fmv.w.x ft1, a0
110 ; RV64IF-NEXT: fle.s a0, ft1, ft0
112 %1 = fcmp ole float %a, %b
113 %2 = zext i1 %1 to i32
117 define i32 @fcmp_one(float %a, float %b) nounwind {
118 ; RV32IF-LABEL: fcmp_one:
120 ; RV32IF-NEXT: fmv.w.x ft0, a1
121 ; RV32IF-NEXT: fmv.w.x ft1, a0
122 ; RV32IF-NEXT: flt.s a0, ft1, ft0
123 ; RV32IF-NEXT: flt.s a1, ft0, ft1
124 ; RV32IF-NEXT: or a0, a1, a0
127 ; RV64IF-LABEL: fcmp_one:
129 ; RV64IF-NEXT: fmv.w.x ft0, a1
130 ; RV64IF-NEXT: fmv.w.x ft1, a0
131 ; RV64IF-NEXT: flt.s a0, ft1, ft0
132 ; RV64IF-NEXT: flt.s a1, ft0, ft1
133 ; RV64IF-NEXT: or a0, a1, a0
135 %1 = fcmp one float %a, %b
136 %2 = zext i1 %1 to i32
140 define i32 @fcmp_ord(float %a, float %b) nounwind {
141 ; RV32IF-LABEL: fcmp_ord:
143 ; RV32IF-NEXT: fmv.w.x ft0, a0
144 ; RV32IF-NEXT: fmv.w.x ft1, a1
145 ; RV32IF-NEXT: feq.s a0, ft1, ft1
146 ; RV32IF-NEXT: feq.s a1, ft0, ft0
147 ; RV32IF-NEXT: and a0, a1, a0
150 ; RV64IF-LABEL: fcmp_ord:
152 ; RV64IF-NEXT: fmv.w.x ft0, a0
153 ; RV64IF-NEXT: fmv.w.x ft1, a1
154 ; RV64IF-NEXT: feq.s a0, ft1, ft1
155 ; RV64IF-NEXT: feq.s a1, ft0, ft0
156 ; RV64IF-NEXT: and a0, a1, a0
158 %1 = fcmp ord float %a, %b
159 %2 = zext i1 %1 to i32
163 define i32 @fcmp_ueq(float %a, float %b) nounwind {
164 ; RV32IF-LABEL: fcmp_ueq:
166 ; RV32IF-NEXT: fmv.w.x ft0, a1
167 ; RV32IF-NEXT: fmv.w.x ft1, a0
168 ; RV32IF-NEXT: flt.s a0, ft1, ft0
169 ; RV32IF-NEXT: flt.s a1, ft0, ft1
170 ; RV32IF-NEXT: or a0, a1, a0
171 ; RV32IF-NEXT: xori a0, a0, 1
174 ; RV64IF-LABEL: fcmp_ueq:
176 ; RV64IF-NEXT: fmv.w.x ft0, a1
177 ; RV64IF-NEXT: fmv.w.x ft1, a0
178 ; RV64IF-NEXT: flt.s a0, ft1, ft0
179 ; RV64IF-NEXT: flt.s a1, ft0, ft1
180 ; RV64IF-NEXT: or a0, a1, a0
181 ; RV64IF-NEXT: xori a0, a0, 1
183 %1 = fcmp ueq float %a, %b
184 %2 = zext i1 %1 to i32
188 define i32 @fcmp_ugt(float %a, float %b) nounwind {
189 ; RV32IF-LABEL: fcmp_ugt:
191 ; RV32IF-NEXT: fmv.w.x ft0, a1
192 ; RV32IF-NEXT: fmv.w.x ft1, a0
193 ; RV32IF-NEXT: fle.s a0, ft1, ft0
194 ; RV32IF-NEXT: xori a0, a0, 1
197 ; RV64IF-LABEL: fcmp_ugt:
199 ; RV64IF-NEXT: fmv.w.x ft0, a1
200 ; RV64IF-NEXT: fmv.w.x ft1, a0
201 ; RV64IF-NEXT: fle.s a0, ft1, ft0
202 ; RV64IF-NEXT: xori a0, a0, 1
204 %1 = fcmp ugt float %a, %b
205 %2 = zext i1 %1 to i32
209 define i32 @fcmp_uge(float %a, float %b) nounwind {
210 ; RV32IF-LABEL: fcmp_uge:
212 ; RV32IF-NEXT: fmv.w.x ft0, a1
213 ; RV32IF-NEXT: fmv.w.x ft1, a0
214 ; RV32IF-NEXT: flt.s a0, ft1, ft0
215 ; RV32IF-NEXT: xori a0, a0, 1
218 ; RV64IF-LABEL: fcmp_uge:
220 ; RV64IF-NEXT: fmv.w.x ft0, a1
221 ; RV64IF-NEXT: fmv.w.x ft1, a0
222 ; RV64IF-NEXT: flt.s a0, ft1, ft0
223 ; RV64IF-NEXT: xori a0, a0, 1
225 %1 = fcmp uge float %a, %b
226 %2 = zext i1 %1 to i32
230 define i32 @fcmp_ult(float %a, float %b) nounwind {
231 ; RV32IF-LABEL: fcmp_ult:
233 ; RV32IF-NEXT: fmv.w.x ft0, a0
234 ; RV32IF-NEXT: fmv.w.x ft1, a1
235 ; RV32IF-NEXT: fle.s a0, ft1, ft0
236 ; RV32IF-NEXT: xori a0, a0, 1
239 ; RV64IF-LABEL: fcmp_ult:
241 ; RV64IF-NEXT: fmv.w.x ft0, a0
242 ; RV64IF-NEXT: fmv.w.x ft1, a1
243 ; RV64IF-NEXT: fle.s a0, ft1, ft0
244 ; RV64IF-NEXT: xori a0, a0, 1
246 %1 = fcmp ult float %a, %b
247 %2 = zext i1 %1 to i32
251 define i32 @fcmp_ule(float %a, float %b) nounwind {
252 ; RV32IF-LABEL: fcmp_ule:
254 ; RV32IF-NEXT: fmv.w.x ft0, a0
255 ; RV32IF-NEXT: fmv.w.x ft1, a1
256 ; RV32IF-NEXT: flt.s a0, ft1, ft0
257 ; RV32IF-NEXT: xori a0, a0, 1
260 ; RV64IF-LABEL: fcmp_ule:
262 ; RV64IF-NEXT: fmv.w.x ft0, a0
263 ; RV64IF-NEXT: fmv.w.x ft1, a1
264 ; RV64IF-NEXT: flt.s a0, ft1, ft0
265 ; RV64IF-NEXT: xori a0, a0, 1
267 %1 = fcmp ule float %a, %b
268 %2 = zext i1 %1 to i32
272 define i32 @fcmp_une(float %a, float %b) nounwind {
273 ; RV32IF-LABEL: fcmp_une:
275 ; RV32IF-NEXT: fmv.w.x ft0, a1
276 ; RV32IF-NEXT: fmv.w.x ft1, a0
277 ; RV32IF-NEXT: feq.s a0, ft1, ft0
278 ; RV32IF-NEXT: xori a0, a0, 1
281 ; RV64IF-LABEL: fcmp_une:
283 ; RV64IF-NEXT: fmv.w.x ft0, a1
284 ; RV64IF-NEXT: fmv.w.x ft1, a0
285 ; RV64IF-NEXT: feq.s a0, ft1, ft0
286 ; RV64IF-NEXT: xori a0, a0, 1
288 %1 = fcmp une float %a, %b
289 %2 = zext i1 %1 to i32
293 define i32 @fcmp_uno(float %a, float %b) nounwind {
294 ; RV32IF-LABEL: fcmp_uno:
296 ; RV32IF-NEXT: fmv.w.x ft0, a0
297 ; RV32IF-NEXT: fmv.w.x ft1, a1
298 ; RV32IF-NEXT: feq.s a0, ft1, ft1
299 ; RV32IF-NEXT: feq.s a1, ft0, ft0
300 ; RV32IF-NEXT: and a0, a1, a0
301 ; RV32IF-NEXT: xori a0, a0, 1
304 ; RV64IF-LABEL: fcmp_uno:
306 ; RV64IF-NEXT: fmv.w.x ft0, a0
307 ; RV64IF-NEXT: fmv.w.x ft1, a1
308 ; RV64IF-NEXT: feq.s a0, ft1, ft1
309 ; RV64IF-NEXT: feq.s a1, ft0, ft0
310 ; RV64IF-NEXT: and a0, a1, a0
311 ; RV64IF-NEXT: xori a0, a0, 1
313 %1 = fcmp uno float %a, %b
314 %2 = zext i1 %1 to i32
318 define i32 @fcmp_true(float %a, float %b) nounwind {
319 ; RV32IF-LABEL: fcmp_true:
321 ; RV32IF-NEXT: addi a0, zero, 1
324 ; RV64IF-LABEL: fcmp_true:
326 ; RV64IF-NEXT: addi a0, zero, 1
328 %1 = fcmp true float %a, %b
329 %2 = zext i1 %1 to i32