1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc --mtriple=loongarch32 --mattr=+f,-d < %s | FileCheck %s --check-prefix=LA32
3 ; RUN: llc --mtriple=loongarch64 --mattr=+f,-d < %s | FileCheck %s --check-prefix=LA64
5 declare i1 @llvm.experimental.constrained.fcmps.f32(float, float, metadata, metadata)
6 declare i1 @llvm.experimental.constrained.fcmp.f32(float, float, metadata, metadata)
8 define i32 @fcmps_oeq(float %a, float %b) nounwind strictfp {
9 ; LA32-LABEL: fcmps_oeq:
11 ; LA32-NEXT: fcmp.seq.s $fcc0, $fa0, $fa1
12 ; LA32-NEXT: movcf2gr $a0, $fcc0
15 ; LA64-LABEL: fcmps_oeq:
17 ; LA64-NEXT: fcmp.seq.s $fcc0, $fa0, $fa1
18 ; LA64-NEXT: movcf2gr $a0, $fcc0
20 %1 = call i1 @llvm.experimental.constrained.fcmps.f32(float %a, float %b, metadata !"oeq", metadata !"fpexcept.strict") strictfp
21 %2 = zext i1 %1 to i32
25 define i32 @fcmps_ogt(float %a, float %b) nounwind strictfp {
26 ; LA32-LABEL: fcmps_ogt:
28 ; LA32-NEXT: fcmp.slt.s $fcc0, $fa1, $fa0
29 ; LA32-NEXT: movcf2gr $a0, $fcc0
32 ; LA64-LABEL: fcmps_ogt:
34 ; LA64-NEXT: fcmp.slt.s $fcc0, $fa1, $fa0
35 ; LA64-NEXT: movcf2gr $a0, $fcc0
37 %1 = call i1 @llvm.experimental.constrained.fcmps.f32(float %a, float %b, metadata !"ogt", metadata !"fpexcept.strict") strictfp
38 %2 = zext i1 %1 to i32
42 define i32 @fcmps_oge(float %a, float %b) nounwind strictfp {
43 ; LA32-LABEL: fcmps_oge:
45 ; LA32-NEXT: fcmp.sle.s $fcc0, $fa1, $fa0
46 ; LA32-NEXT: movcf2gr $a0, $fcc0
49 ; LA64-LABEL: fcmps_oge:
51 ; LA64-NEXT: fcmp.sle.s $fcc0, $fa1, $fa0
52 ; LA64-NEXT: movcf2gr $a0, $fcc0
54 %1 = call i1 @llvm.experimental.constrained.fcmps.f32(float %a, float %b, metadata !"oge", metadata !"fpexcept.strict") strictfp
55 %2 = zext i1 %1 to i32
59 define i32 @fcmps_olt(float %a, float %b) nounwind strictfp {
60 ; LA32-LABEL: fcmps_olt:
62 ; LA32-NEXT: fcmp.slt.s $fcc0, $fa0, $fa1
63 ; LA32-NEXT: movcf2gr $a0, $fcc0
66 ; LA64-LABEL: fcmps_olt:
68 ; LA64-NEXT: fcmp.slt.s $fcc0, $fa0, $fa1
69 ; LA64-NEXT: movcf2gr $a0, $fcc0
71 %1 = call i1 @llvm.experimental.constrained.fcmps.f32(float %a, float %b, metadata !"olt", metadata !"fpexcept.strict") strictfp
72 %2 = zext i1 %1 to i32
76 define i32 @fcmps_ole(float %a, float %b) nounwind strictfp {
77 ; LA32-LABEL: fcmps_ole:
79 ; LA32-NEXT: fcmp.sle.s $fcc0, $fa0, $fa1
80 ; LA32-NEXT: movcf2gr $a0, $fcc0
83 ; LA64-LABEL: fcmps_ole:
85 ; LA64-NEXT: fcmp.sle.s $fcc0, $fa0, $fa1
86 ; LA64-NEXT: movcf2gr $a0, $fcc0
88 %1 = call i1 @llvm.experimental.constrained.fcmps.f32(float %a, float %b, metadata !"ole", metadata !"fpexcept.strict") strictfp
89 %2 = zext i1 %1 to i32
93 define i32 @fcmps_one(float %a, float %b) nounwind strictfp {
94 ; LA32-LABEL: fcmps_one:
96 ; LA32-NEXT: fcmp.sne.s $fcc0, $fa0, $fa1
97 ; LA32-NEXT: movcf2gr $a0, $fcc0
100 ; LA64-LABEL: fcmps_one:
102 ; LA64-NEXT: fcmp.sne.s $fcc0, $fa0, $fa1
103 ; LA64-NEXT: movcf2gr $a0, $fcc0
105 %1 = call i1 @llvm.experimental.constrained.fcmps.f32(float %a, float %b, metadata !"one", metadata !"fpexcept.strict") strictfp
106 %2 = zext i1 %1 to i32
110 define i32 @fcmps_ord(float %a, float %b) nounwind strictfp {
111 ; LA32-LABEL: fcmps_ord:
113 ; LA32-NEXT: fcmp.sor.s $fcc0, $fa0, $fa1
114 ; LA32-NEXT: movcf2gr $a0, $fcc0
117 ; LA64-LABEL: fcmps_ord:
119 ; LA64-NEXT: fcmp.sor.s $fcc0, $fa0, $fa1
120 ; LA64-NEXT: movcf2gr $a0, $fcc0
122 %1 = call i1 @llvm.experimental.constrained.fcmps.f32(float %a, float %b, metadata !"ord", metadata !"fpexcept.strict") strictfp
123 %2 = zext i1 %1 to i32
127 define i32 @fcmps_ueq(float %a, float %b) nounwind strictfp {
128 ; LA32-LABEL: fcmps_ueq:
130 ; LA32-NEXT: fcmp.sueq.s $fcc0, $fa0, $fa1
131 ; LA32-NEXT: movcf2gr $a0, $fcc0
134 ; LA64-LABEL: fcmps_ueq:
136 ; LA64-NEXT: fcmp.sueq.s $fcc0, $fa0, $fa1
137 ; LA64-NEXT: movcf2gr $a0, $fcc0
139 %1 = call i1 @llvm.experimental.constrained.fcmps.f32(float %a, float %b, metadata !"ueq", metadata !"fpexcept.strict") strictfp
140 %2 = zext i1 %1 to i32
144 define i32 @fcmps_ugt(float %a, float %b) nounwind strictfp {
145 ; LA32-LABEL: fcmps_ugt:
147 ; LA32-NEXT: fcmp.sult.s $fcc0, $fa1, $fa0
148 ; LA32-NEXT: movcf2gr $a0, $fcc0
151 ; LA64-LABEL: fcmps_ugt:
153 ; LA64-NEXT: fcmp.sult.s $fcc0, $fa1, $fa0
154 ; LA64-NEXT: movcf2gr $a0, $fcc0
156 %1 = call i1 @llvm.experimental.constrained.fcmps.f32(float %a, float %b, metadata !"ugt", metadata !"fpexcept.strict") strictfp
157 %2 = zext i1 %1 to i32
161 define i32 @fcmps_uge(float %a, float %b) nounwind strictfp {
162 ; LA32-LABEL: fcmps_uge:
164 ; LA32-NEXT: fcmp.sule.s $fcc0, $fa1, $fa0
165 ; LA32-NEXT: movcf2gr $a0, $fcc0
168 ; LA64-LABEL: fcmps_uge:
170 ; LA64-NEXT: fcmp.sule.s $fcc0, $fa1, $fa0
171 ; LA64-NEXT: movcf2gr $a0, $fcc0
173 %1 = call i1 @llvm.experimental.constrained.fcmps.f32(float %a, float %b, metadata !"uge", metadata !"fpexcept.strict") strictfp
174 %2 = zext i1 %1 to i32
178 define i32 @fcmps_ult(float %a, float %b) nounwind strictfp {
179 ; LA32-LABEL: fcmps_ult:
181 ; LA32-NEXT: fcmp.sult.s $fcc0, $fa0, $fa1
182 ; LA32-NEXT: movcf2gr $a0, $fcc0
185 ; LA64-LABEL: fcmps_ult:
187 ; LA64-NEXT: fcmp.sult.s $fcc0, $fa0, $fa1
188 ; LA64-NEXT: movcf2gr $a0, $fcc0
190 %1 = call i1 @llvm.experimental.constrained.fcmps.f32(float %a, float %b, metadata !"ult", metadata !"fpexcept.strict") strictfp
191 %2 = zext i1 %1 to i32
195 define i32 @fcmps_ule(float %a, float %b) nounwind strictfp {
196 ; LA32-LABEL: fcmps_ule:
198 ; LA32-NEXT: fcmp.sule.s $fcc0, $fa0, $fa1
199 ; LA32-NEXT: movcf2gr $a0, $fcc0
202 ; LA64-LABEL: fcmps_ule:
204 ; LA64-NEXT: fcmp.sule.s $fcc0, $fa0, $fa1
205 ; LA64-NEXT: movcf2gr $a0, $fcc0
207 %1 = call i1 @llvm.experimental.constrained.fcmps.f32(float %a, float %b, metadata !"ule", metadata !"fpexcept.strict") strictfp
208 %2 = zext i1 %1 to i32
212 define i32 @fcmps_une(float %a, float %b) nounwind strictfp {
213 ; LA32-LABEL: fcmps_une:
215 ; LA32-NEXT: fcmp.sune.s $fcc0, $fa0, $fa1
216 ; LA32-NEXT: movcf2gr $a0, $fcc0
219 ; LA64-LABEL: fcmps_une:
221 ; LA64-NEXT: fcmp.sune.s $fcc0, $fa0, $fa1
222 ; LA64-NEXT: movcf2gr $a0, $fcc0
224 %1 = call i1 @llvm.experimental.constrained.fcmps.f32(float %a, float %b, metadata !"une", metadata !"fpexcept.strict") strictfp
225 %2 = zext i1 %1 to i32
229 define i32 @fcmps_uno(float %a, float %b) nounwind strictfp {
230 ; LA32-LABEL: fcmps_uno:
232 ; LA32-NEXT: fcmp.sun.s $fcc0, $fa0, $fa1
233 ; LA32-NEXT: movcf2gr $a0, $fcc0
236 ; LA64-LABEL: fcmps_uno:
238 ; LA64-NEXT: fcmp.sun.s $fcc0, $fa0, $fa1
239 ; LA64-NEXT: movcf2gr $a0, $fcc0
241 %1 = call i1 @llvm.experimental.constrained.fcmps.f32(float %a, float %b, metadata !"uno", metadata !"fpexcept.strict") strictfp
242 %2 = zext i1 %1 to i32
246 define i32 @fcmp_oeq(float %a, float %b) nounwind strictfp {
247 ; LA32-LABEL: fcmp_oeq:
249 ; LA32-NEXT: fcmp.ceq.s $fcc0, $fa0, $fa1
250 ; LA32-NEXT: movcf2gr $a0, $fcc0
253 ; LA64-LABEL: fcmp_oeq:
255 ; LA64-NEXT: fcmp.ceq.s $fcc0, $fa0, $fa1
256 ; LA64-NEXT: movcf2gr $a0, $fcc0
258 %1 = call i1 @llvm.experimental.constrained.fcmp.f32(float %a, float %b, metadata !"oeq", metadata !"fpexcept.strict") strictfp
259 %2 = zext i1 %1 to i32
263 define i32 @fcmp_ogt(float %a, float %b) nounwind strictfp {
264 ; LA32-LABEL: fcmp_ogt:
266 ; LA32-NEXT: fcmp.clt.s $fcc0, $fa1, $fa0
267 ; LA32-NEXT: movcf2gr $a0, $fcc0
270 ; LA64-LABEL: fcmp_ogt:
272 ; LA64-NEXT: fcmp.clt.s $fcc0, $fa1, $fa0
273 ; LA64-NEXT: movcf2gr $a0, $fcc0
275 %1 = call i1 @llvm.experimental.constrained.fcmp.f32(float %a, float %b, metadata !"ogt", metadata !"fpexcept.strict") strictfp
276 %2 = zext i1 %1 to i32
280 define i32 @fcmp_oge(float %a, float %b) nounwind strictfp {
281 ; LA32-LABEL: fcmp_oge:
283 ; LA32-NEXT: fcmp.cle.s $fcc0, $fa1, $fa0
284 ; LA32-NEXT: movcf2gr $a0, $fcc0
287 ; LA64-LABEL: fcmp_oge:
289 ; LA64-NEXT: fcmp.cle.s $fcc0, $fa1, $fa0
290 ; LA64-NEXT: movcf2gr $a0, $fcc0
292 %1 = call i1 @llvm.experimental.constrained.fcmp.f32(float %a, float %b, metadata !"oge", metadata !"fpexcept.strict") strictfp
293 %2 = zext i1 %1 to i32
297 define i32 @fcmp_olt(float %a, float %b) nounwind strictfp {
298 ; LA32-LABEL: fcmp_olt:
300 ; LA32-NEXT: fcmp.clt.s $fcc0, $fa0, $fa1
301 ; LA32-NEXT: movcf2gr $a0, $fcc0
304 ; LA64-LABEL: fcmp_olt:
306 ; LA64-NEXT: fcmp.clt.s $fcc0, $fa0, $fa1
307 ; LA64-NEXT: movcf2gr $a0, $fcc0
309 %1 = call i1 @llvm.experimental.constrained.fcmp.f32(float %a, float %b, metadata !"olt", metadata !"fpexcept.strict") strictfp
310 %2 = zext i1 %1 to i32
314 define i32 @fcmp_ole(float %a, float %b) nounwind strictfp {
315 ; LA32-LABEL: fcmp_ole:
317 ; LA32-NEXT: fcmp.cle.s $fcc0, $fa0, $fa1
318 ; LA32-NEXT: movcf2gr $a0, $fcc0
321 ; LA64-LABEL: fcmp_ole:
323 ; LA64-NEXT: fcmp.cle.s $fcc0, $fa0, $fa1
324 ; LA64-NEXT: movcf2gr $a0, $fcc0
326 %1 = call i1 @llvm.experimental.constrained.fcmp.f32(float %a, float %b, metadata !"ole", metadata !"fpexcept.strict") strictfp
327 %2 = zext i1 %1 to i32
331 define i32 @fcmp_one(float %a, float %b) nounwind strictfp {
332 ; LA32-LABEL: fcmp_one:
334 ; LA32-NEXT: fcmp.cne.s $fcc0, $fa0, $fa1
335 ; LA32-NEXT: movcf2gr $a0, $fcc0
338 ; LA64-LABEL: fcmp_one:
340 ; LA64-NEXT: fcmp.cne.s $fcc0, $fa0, $fa1
341 ; LA64-NEXT: movcf2gr $a0, $fcc0
343 %1 = call i1 @llvm.experimental.constrained.fcmp.f32(float %a, float %b, metadata !"one", metadata !"fpexcept.strict") strictfp
344 %2 = zext i1 %1 to i32
348 define i32 @fcmp_ord(float %a, float %b) nounwind strictfp {
349 ; LA32-LABEL: fcmp_ord:
351 ; LA32-NEXT: fcmp.cor.s $fcc0, $fa0, $fa1
352 ; LA32-NEXT: movcf2gr $a0, $fcc0
355 ; LA64-LABEL: fcmp_ord:
357 ; LA64-NEXT: fcmp.cor.s $fcc0, $fa0, $fa1
358 ; LA64-NEXT: movcf2gr $a0, $fcc0
360 %1 = call i1 @llvm.experimental.constrained.fcmp.f32(float %a, float %b, metadata !"ord", metadata !"fpexcept.strict") strictfp
361 %2 = zext i1 %1 to i32
365 define i32 @fcmp_ueq(float %a, float %b) nounwind strictfp {
366 ; LA32-LABEL: fcmp_ueq:
368 ; LA32-NEXT: fcmp.cueq.s $fcc0, $fa0, $fa1
369 ; LA32-NEXT: movcf2gr $a0, $fcc0
372 ; LA64-LABEL: fcmp_ueq:
374 ; LA64-NEXT: fcmp.cueq.s $fcc0, $fa0, $fa1
375 ; LA64-NEXT: movcf2gr $a0, $fcc0
377 %1 = call i1 @llvm.experimental.constrained.fcmp.f32(float %a, float %b, metadata !"ueq", metadata !"fpexcept.strict") strictfp
378 %2 = zext i1 %1 to i32
382 define i32 @fcmp_ugt(float %a, float %b) nounwind strictfp {
383 ; LA32-LABEL: fcmp_ugt:
385 ; LA32-NEXT: fcmp.cult.s $fcc0, $fa1, $fa0
386 ; LA32-NEXT: movcf2gr $a0, $fcc0
389 ; LA64-LABEL: fcmp_ugt:
391 ; LA64-NEXT: fcmp.cult.s $fcc0, $fa1, $fa0
392 ; LA64-NEXT: movcf2gr $a0, $fcc0
394 %1 = call i1 @llvm.experimental.constrained.fcmp.f32(float %a, float %b, metadata !"ugt", metadata !"fpexcept.strict") strictfp
395 %2 = zext i1 %1 to i32
399 define i32 @fcmp_uge(float %a, float %b) nounwind strictfp {
400 ; LA32-LABEL: fcmp_uge:
402 ; LA32-NEXT: fcmp.cule.s $fcc0, $fa1, $fa0
403 ; LA32-NEXT: movcf2gr $a0, $fcc0
406 ; LA64-LABEL: fcmp_uge:
408 ; LA64-NEXT: fcmp.cule.s $fcc0, $fa1, $fa0
409 ; LA64-NEXT: movcf2gr $a0, $fcc0
411 %1 = call i1 @llvm.experimental.constrained.fcmp.f32(float %a, float %b, metadata !"uge", metadata !"fpexcept.strict") strictfp
412 %2 = zext i1 %1 to i32
416 define i32 @fcmp_ult(float %a, float %b) nounwind strictfp {
417 ; LA32-LABEL: fcmp_ult:
419 ; LA32-NEXT: fcmp.cult.s $fcc0, $fa0, $fa1
420 ; LA32-NEXT: movcf2gr $a0, $fcc0
423 ; LA64-LABEL: fcmp_ult:
425 ; LA64-NEXT: fcmp.cult.s $fcc0, $fa0, $fa1
426 ; LA64-NEXT: movcf2gr $a0, $fcc0
428 %1 = call i1 @llvm.experimental.constrained.fcmp.f32(float %a, float %b, metadata !"ult", metadata !"fpexcept.strict") strictfp
429 %2 = zext i1 %1 to i32
433 define i32 @fcmp_ule(float %a, float %b) nounwind strictfp {
434 ; LA32-LABEL: fcmp_ule:
436 ; LA32-NEXT: fcmp.cule.s $fcc0, $fa0, $fa1
437 ; LA32-NEXT: movcf2gr $a0, $fcc0
440 ; LA64-LABEL: fcmp_ule:
442 ; LA64-NEXT: fcmp.cule.s $fcc0, $fa0, $fa1
443 ; LA64-NEXT: movcf2gr $a0, $fcc0
445 %1 = call i1 @llvm.experimental.constrained.fcmp.f32(float %a, float %b, metadata !"ule", metadata !"fpexcept.strict") strictfp
446 %2 = zext i1 %1 to i32
450 define i32 @fcmp_une(float %a, float %b) nounwind strictfp {
451 ; LA32-LABEL: fcmp_une:
453 ; LA32-NEXT: fcmp.cune.s $fcc0, $fa0, $fa1
454 ; LA32-NEXT: movcf2gr $a0, $fcc0
457 ; LA64-LABEL: fcmp_une:
459 ; LA64-NEXT: fcmp.cune.s $fcc0, $fa0, $fa1
460 ; LA64-NEXT: movcf2gr $a0, $fcc0
462 %1 = call i1 @llvm.experimental.constrained.fcmp.f32(float %a, float %b, metadata !"une", metadata !"fpexcept.strict") strictfp
463 %2 = zext i1 %1 to i32
467 define i32 @fcmp_uno(float %a, float %b) nounwind strictfp {
468 ; LA32-LABEL: fcmp_uno:
470 ; LA32-NEXT: fcmp.cun.s $fcc0, $fa0, $fa1
471 ; LA32-NEXT: movcf2gr $a0, $fcc0
474 ; LA64-LABEL: fcmp_uno:
476 ; LA64-NEXT: fcmp.cun.s $fcc0, $fa0, $fa1
477 ; LA64-NEXT: movcf2gr $a0, $fcc0
479 %1 = call i1 @llvm.experimental.constrained.fcmp.f32(float %a, float %b, metadata !"uno", metadata !"fpexcept.strict") strictfp
480 %2 = zext i1 %1 to i32