; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py ; RUN: llc -mtriple=riscv32 -mattr=+zfh -verify-machineinstrs \ ; RUN: -target-abi ilp32f -disable-strictnode-mutation < %s | FileCheck %s ; RUN: llc -mtriple=riscv64 -mattr=+zfh -verify-machineinstrs \ ; RUN: -target-abi lp64f -disable-strictnode-mutation < %s | FileCheck %s define i32 @fcmp_oeq(half %a, half %b) nounwind strictfp { ; CHECK-LABEL: fcmp_oeq: ; CHECK: # %bb.0: ; CHECK-NEXT: feq.h a0, fa0, fa1 ; CHECK-NEXT: ret %1 = call i1 @llvm.experimental.constrained.fcmp.f16(half %a, half %b, metadata !"oeq", metadata !"fpexcept.strict") strictfp %2 = zext i1 %1 to i32 ret i32 %2 } declare i1 @llvm.experimental.constrained.fcmp.f16(half, half, metadata, metadata) define i32 @fcmp_ogt(half %a, half %b) nounwind strictfp { ; CHECK-LABEL: fcmp_ogt: ; CHECK: # %bb.0: ; CHECK-NEXT: frflags a1 ; CHECK-NEXT: flt.h a0, fa1, fa0 ; CHECK-NEXT: fsflags a1 ; CHECK-NEXT: feq.h zero, fa1, fa0 ; CHECK-NEXT: ret %1 = call i1 @llvm.experimental.constrained.fcmp.f16(half %a, half %b, metadata !"ogt", metadata !"fpexcept.strict") strictfp %2 = zext i1 %1 to i32 ret i32 %2 } define i32 @fcmp_oge(half %a, half %b) nounwind strictfp { ; CHECK-LABEL: fcmp_oge: ; CHECK: # %bb.0: ; CHECK-NEXT: frflags a1 ; CHECK-NEXT: fle.h a0, fa1, fa0 ; CHECK-NEXT: fsflags a1 ; CHECK-NEXT: feq.h zero, fa1, fa0 ; CHECK-NEXT: ret %1 = call i1 @llvm.experimental.constrained.fcmp.f16(half %a, half %b, metadata !"oge", metadata !"fpexcept.strict") strictfp %2 = zext i1 %1 to i32 ret i32 %2 } define i32 @fcmp_olt(half %a, half %b) nounwind strictfp { ; CHECK-LABEL: fcmp_olt: ; CHECK: # %bb.0: ; CHECK-NEXT: frflags a1 ; CHECK-NEXT: flt.h a0, fa0, fa1 ; CHECK-NEXT: fsflags a1 ; CHECK-NEXT: feq.h zero, fa0, fa1 ; CHECK-NEXT: ret %1 = call i1 @llvm.experimental.constrained.fcmp.f16(half %a, half %b, metadata !"olt", metadata !"fpexcept.strict") strictfp %2 = zext i1 %1 to i32 ret i32 %2 } define i32 @fcmp_ole(half %a, half %b) nounwind strictfp { ; CHECK-LABEL: fcmp_ole: ; CHECK: # %bb.0: ; CHECK-NEXT: frflags a1 ; CHECK-NEXT: fle.h a0, fa0, fa1 ; CHECK-NEXT: fsflags a1 ; CHECK-NEXT: feq.h zero, fa0, fa1 ; CHECK-NEXT: ret %1 = call i1 @llvm.experimental.constrained.fcmp.f16(half %a, half %b, metadata !"ole", metadata !"fpexcept.strict") strictfp %2 = zext i1 %1 to i32 ret i32 %2 } ; FIXME: We only need one frflags before the two flts and one fsflags after the ; two flts. define i32 @fcmp_one(half %a, half %b) nounwind strictfp { ; CHECK-LABEL: fcmp_one: ; CHECK: # %bb.0: ; CHECK-NEXT: frflags a0 ; CHECK-NEXT: flt.h a1, fa0, fa1 ; CHECK-NEXT: fsflags a0 ; CHECK-NEXT: feq.h zero, fa0, fa1 ; CHECK-NEXT: frflags a0 ; CHECK-NEXT: flt.h a2, fa1, fa0 ; CHECK-NEXT: fsflags a0 ; CHECK-NEXT: or a0, a2, a1 ; CHECK-NEXT: feq.h zero, fa1, fa0 ; CHECK-NEXT: ret %1 = call i1 @llvm.experimental.constrained.fcmp.f16(half %a, half %b, metadata !"one", metadata !"fpexcept.strict") strictfp %2 = zext i1 %1 to i32 ret i32 %2 } define i32 @fcmp_ord(half %a, half %b) nounwind strictfp { ; CHECK-LABEL: fcmp_ord: ; CHECK: # %bb.0: ; CHECK-NEXT: feq.h a0, fa1, fa1 ; CHECK-NEXT: feq.h a1, fa0, fa0 ; CHECK-NEXT: and a0, a1, a0 ; CHECK-NEXT: ret %1 = call i1 @llvm.experimental.constrained.fcmp.f16(half %a, half %b, metadata !"ord", metadata !"fpexcept.strict") strictfp %2 = zext i1 %1 to i32 ret i32 %2 } ; FIXME: We only need one frflags before the two flts and one fsflags after the ; two flts. define i32 @fcmp_ueq(half %a, half %b) nounwind strictfp { ; CHECK-LABEL: fcmp_ueq: ; CHECK: # %bb.0: ; CHECK-NEXT: frflags a0 ; CHECK-NEXT: flt.h a1, fa0, fa1 ; CHECK-NEXT: fsflags a0 ; CHECK-NEXT: feq.h zero, fa0, fa1 ; CHECK-NEXT: frflags a0 ; CHECK-NEXT: flt.h a2, fa1, fa0 ; CHECK-NEXT: fsflags a0 ; CHECK-NEXT: or a0, a2, a1 ; CHECK-NEXT: xori a0, a0, 1 ; CHECK-NEXT: feq.h zero, fa1, fa0 ; CHECK-NEXT: ret %1 = call i1 @llvm.experimental.constrained.fcmp.f16(half %a, half %b, metadata !"ueq", metadata !"fpexcept.strict") strictfp %2 = zext i1 %1 to i32 ret i32 %2 } define i32 @fcmp_ugt(half %a, half %b) nounwind strictfp { ; CHECK-LABEL: fcmp_ugt: ; CHECK: # %bb.0: ; CHECK-NEXT: frflags a0 ; CHECK-NEXT: fle.h a1, fa0, fa1 ; CHECK-NEXT: fsflags a0 ; CHECK-NEXT: xori a0, a1, 1 ; CHECK-NEXT: feq.h zero, fa0, fa1 ; CHECK-NEXT: ret %1 = call i1 @llvm.experimental.constrained.fcmp.f16(half %a, half %b, metadata !"ugt", metadata !"fpexcept.strict") strictfp %2 = zext i1 %1 to i32 ret i32 %2 } define i32 @fcmp_uge(half %a, half %b) nounwind strictfp { ; CHECK-LABEL: fcmp_uge: ; CHECK: # %bb.0: ; CHECK-NEXT: frflags a0 ; CHECK-NEXT: flt.h a1, fa0, fa1 ; CHECK-NEXT: fsflags a0 ; CHECK-NEXT: xori a0, a1, 1 ; CHECK-NEXT: feq.h zero, fa0, fa1 ; CHECK-NEXT: ret %1 = call i1 @llvm.experimental.constrained.fcmp.f16(half %a, half %b, metadata !"uge", metadata !"fpexcept.strict") strictfp %2 = zext i1 %1 to i32 ret i32 %2 } define i32 @fcmp_ult(half %a, half %b) nounwind strictfp { ; CHECK-LABEL: fcmp_ult: ; CHECK: # %bb.0: ; CHECK-NEXT: frflags a0 ; CHECK-NEXT: fle.h a1, fa1, fa0 ; CHECK-NEXT: fsflags a0 ; CHECK-NEXT: xori a0, a1, 1 ; CHECK-NEXT: feq.h zero, fa1, fa0 ; CHECK-NEXT: ret %1 = call i1 @llvm.experimental.constrained.fcmp.f16(half %a, half %b, metadata !"ult", metadata !"fpexcept.strict") strictfp %2 = zext i1 %1 to i32 ret i32 %2 } define i32 @fcmp_ule(half %a, half %b) nounwind strictfp { ; CHECK-LABEL: fcmp_ule: ; CHECK: # %bb.0: ; CHECK-NEXT: frflags a0 ; CHECK-NEXT: flt.h a1, fa1, fa0 ; CHECK-NEXT: fsflags a0 ; CHECK-NEXT: xori a0, a1, 1 ; CHECK-NEXT: feq.h zero, fa1, fa0 ; CHECK-NEXT: ret %1 = call i1 @llvm.experimental.constrained.fcmp.f16(half %a, half %b, metadata !"ule", metadata !"fpexcept.strict") strictfp %2 = zext i1 %1 to i32 ret i32 %2 } define i32 @fcmp_une(half %a, half %b) nounwind strictfp { ; CHECK-LABEL: fcmp_une: ; CHECK: # %bb.0: ; CHECK-NEXT: feq.h a0, fa0, fa1 ; CHECK-NEXT: xori a0, a0, 1 ; CHECK-NEXT: ret %1 = call i1 @llvm.experimental.constrained.fcmp.f16(half %a, half %b, metadata !"une", metadata !"fpexcept.strict") strictfp %2 = zext i1 %1 to i32 ret i32 %2 } define i32 @fcmp_uno(half %a, half %b) nounwind strictfp { ; CHECK-LABEL: fcmp_uno: ; CHECK: # %bb.0: ; CHECK-NEXT: feq.h a0, fa1, fa1 ; CHECK-NEXT: feq.h a1, fa0, fa0 ; CHECK-NEXT: and a0, a1, a0 ; CHECK-NEXT: xori a0, a0, 1 ; CHECK-NEXT: ret %1 = call i1 @llvm.experimental.constrained.fcmp.f16(half %a, half %b, metadata !"uno", metadata !"fpexcept.strict") strictfp %2 = zext i1 %1 to i32 ret i32 %2 } define i32 @fcmps_oeq(half %a, half %b) nounwind strictfp { ; CHECK-LABEL: fcmps_oeq: ; CHECK: # %bb.0: ; CHECK-NEXT: fle.h a0, fa1, fa0 ; CHECK-NEXT: fle.h a1, fa0, fa1 ; CHECK-NEXT: and a0, a1, a0 ; CHECK-NEXT: ret %1 = call i1 @llvm.experimental.constrained.fcmps.f16(half %a, half %b, metadata !"oeq", metadata !"fpexcept.strict") strictfp %2 = zext i1 %1 to i32 ret i32 %2 } declare i1 @llvm.experimental.constrained.fcmps.f16(half, half, metadata, metadata) define i32 @fcmps_ogt(half %a, half %b) nounwind strictfp { ; CHECK-LABEL: fcmps_ogt: ; CHECK: # %bb.0: ; CHECK-NEXT: flt.h a0, fa1, fa0 ; CHECK-NEXT: ret %1 = call i1 @llvm.experimental.constrained.fcmps.f16(half %a, half %b, metadata !"ogt", metadata !"fpexcept.strict") strictfp %2 = zext i1 %1 to i32 ret i32 %2 } define i32 @fcmps_oge(half %a, half %b) nounwind strictfp { ; CHECK-LABEL: fcmps_oge: ; CHECK: # %bb.0: ; CHECK-NEXT: fle.h a0, fa1, fa0 ; CHECK-NEXT: ret %1 = call i1 @llvm.experimental.constrained.fcmps.f16(half %a, half %b, metadata !"oge", metadata !"fpexcept.strict") strictfp %2 = zext i1 %1 to i32 ret i32 %2 } define i32 @fcmps_olt(half %a, half %b) nounwind strictfp { ; CHECK-LABEL: fcmps_olt: ; CHECK: # %bb.0: ; CHECK-NEXT: flt.h a0, fa0, fa1 ; CHECK-NEXT: ret %1 = call i1 @llvm.experimental.constrained.fcmps.f16(half %a, half %b, metadata !"olt", metadata !"fpexcept.strict") strictfp %2 = zext i1 %1 to i32 ret i32 %2 } define i32 @fcmps_ole(half %a, half %b) nounwind strictfp { ; CHECK-LABEL: fcmps_ole: ; CHECK: # %bb.0: ; CHECK-NEXT: fle.h a0, fa0, fa1 ; CHECK-NEXT: ret %1 = call i1 @llvm.experimental.constrained.fcmps.f16(half %a, half %b, metadata !"ole", metadata !"fpexcept.strict") strictfp %2 = zext i1 %1 to i32 ret i32 %2 } define i32 @fcmps_one(half %a, half %b) nounwind strictfp { ; CHECK-LABEL: fcmps_one: ; CHECK: # %bb.0: ; CHECK-NEXT: flt.h a0, fa0, fa1 ; CHECK-NEXT: flt.h a1, fa1, fa0 ; CHECK-NEXT: or a0, a1, a0 ; CHECK-NEXT: ret %1 = call i1 @llvm.experimental.constrained.fcmps.f16(half %a, half %b, metadata !"one", metadata !"fpexcept.strict") strictfp %2 = zext i1 %1 to i32 ret i32 %2 } define i32 @fcmps_ord(half %a, half %b) nounwind strictfp { ; CHECK-LABEL: fcmps_ord: ; CHECK: # %bb.0: ; CHECK-NEXT: fle.h a0, fa1, fa1 ; CHECK-NEXT: fle.h a1, fa0, fa0 ; CHECK-NEXT: and a0, a1, a0 ; CHECK-NEXT: ret %1 = call i1 @llvm.experimental.constrained.fcmps.f16(half %a, half %b, metadata !"ord", metadata !"fpexcept.strict") strictfp %2 = zext i1 %1 to i32 ret i32 %2 } define i32 @fcmps_ueq(half %a, half %b) nounwind strictfp { ; CHECK-LABEL: fcmps_ueq: ; CHECK: # %bb.0: ; CHECK-NEXT: flt.h a0, fa0, fa1 ; CHECK-NEXT: flt.h a1, fa1, fa0 ; CHECK-NEXT: or a0, a1, a0 ; CHECK-NEXT: xori a0, a0, 1 ; CHECK-NEXT: ret %1 = call i1 @llvm.experimental.constrained.fcmps.f16(half %a, half %b, metadata !"ueq", metadata !"fpexcept.strict") strictfp %2 = zext i1 %1 to i32 ret i32 %2 } define i32 @fcmps_ugt(half %a, half %b) nounwind strictfp { ; CHECK-LABEL: fcmps_ugt: ; CHECK: # %bb.0: ; CHECK-NEXT: fle.h a0, fa0, fa1 ; CHECK-NEXT: xori a0, a0, 1 ; CHECK-NEXT: ret %1 = call i1 @llvm.experimental.constrained.fcmps.f16(half %a, half %b, metadata !"ugt", metadata !"fpexcept.strict") strictfp %2 = zext i1 %1 to i32 ret i32 %2 } define i32 @fcmps_uge(half %a, half %b) nounwind strictfp { ; CHECK-LABEL: fcmps_uge: ; CHECK: # %bb.0: ; CHECK-NEXT: flt.h a0, fa0, fa1 ; CHECK-NEXT: xori a0, a0, 1 ; CHECK-NEXT: ret %1 = call i1 @llvm.experimental.constrained.fcmps.f16(half %a, half %b, metadata !"uge", metadata !"fpexcept.strict") strictfp %2 = zext i1 %1 to i32 ret i32 %2 } define i32 @fcmps_ult(half %a, half %b) nounwind strictfp { ; CHECK-LABEL: fcmps_ult: ; CHECK: # %bb.0: ; CHECK-NEXT: fle.h a0, fa1, fa0 ; CHECK-NEXT: xori a0, a0, 1 ; CHECK-NEXT: ret %1 = call i1 @llvm.experimental.constrained.fcmps.f16(half %a, half %b, metadata !"ult", metadata !"fpexcept.strict") strictfp %2 = zext i1 %1 to i32 ret i32 %2 } define i32 @fcmps_ule(half %a, half %b) nounwind strictfp { ; CHECK-LABEL: fcmps_ule: ; CHECK: # %bb.0: ; CHECK-NEXT: flt.h a0, fa1, fa0 ; CHECK-NEXT: xori a0, a0, 1 ; CHECK-NEXT: ret %1 = call i1 @llvm.experimental.constrained.fcmps.f16(half %a, half %b, metadata !"ule", metadata !"fpexcept.strict") strictfp %2 = zext i1 %1 to i32 ret i32 %2 } define i32 @fcmps_une(half %a, half %b) nounwind strictfp { ; CHECK-LABEL: fcmps_une: ; CHECK: # %bb.0: ; CHECK-NEXT: fle.h a0, fa1, fa0 ; CHECK-NEXT: fle.h a1, fa0, fa1 ; CHECK-NEXT: and a0, a1, a0 ; CHECK-NEXT: xori a0, a0, 1 ; CHECK-NEXT: ret %1 = call i1 @llvm.experimental.constrained.fcmps.f16(half %a, half %b, metadata !"une", metadata !"fpexcept.strict") strictfp %2 = zext i1 %1 to i32 ret i32 %2 } define i32 @fcmps_uno(half %a, half %b) nounwind strictfp { ; CHECK-LABEL: fcmps_uno: ; CHECK: # %bb.0: ; CHECK-NEXT: fle.h a0, fa1, fa1 ; CHECK-NEXT: fle.h a1, fa0, fa0 ; CHECK-NEXT: and a0, a1, a0 ; CHECK-NEXT: xori a0, a0, 1 ; CHECK-NEXT: ret %1 = call i1 @llvm.experimental.constrained.fcmps.f16(half %a, half %b, metadata !"uno", metadata !"fpexcept.strict") strictfp %2 = zext i1 %1 to i32 ret i32 %2 }