From 69e1baa931dfa63838683378fa20ed9c46c68a70 Mon Sep 17 00:00:00 2001 From: Richard-Qin-X Date: Wed, 19 Aug 2026 03:19:40 +0800 Subject: [RISCV][GlobalISel] Match floating comparisons --- backend/utils/TableGen/GlobalISelEmitter.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'backend/utils/TableGen/GlobalISelEmitter.cpp') diff --git a/backend/utils/TableGen/GlobalISelEmitter.cpp b/backend/utils/TableGen/GlobalISelEmitter.cpp index d73d691..7390bdf 100644 --- a/backend/utils/TableGen/GlobalISelEmitter.cpp +++ b/backend/utils/TableGen/GlobalISelEmitter.cpp @@ -42,10 +42,11 @@ void emitTypePredicate(std::ostream &Output, std::uint32_t OperandIndex, [[nodiscard]] std::size_t instructionCount(const NormalizedSelectionRule &Rule) noexcept { std::size_t Count = 2U + (Rule.ResultType ? 1U : 0U) + (Rule.IntegerPredicate ? 1U : 0U) + - Rule.TargetPredicates.size() + Rule.OperandTypes.size() + - Rule.OperandBanks.size() + Rule.OperandClasses.size() + - Rule.OperandImmediates.size() + Rule.OperandDefConstants.size() + - Rule.Temporaries.size() + Rule.EraseOperandDefinitions.size(); + (Rule.FloatingPredicate ? 1U : 0U) + Rule.TargetPredicates.size() + + Rule.OperandTypes.size() + Rule.OperandBanks.size() + + Rule.OperandClasses.size() + Rule.OperandImmediates.size() + + Rule.OperandDefConstants.size() + Rule.Temporaries.size() + + Rule.EraseOperandDefinitions.size(); for (const NormalizedSelectionDefUsePredicate &Predicate : Rule.DefUsePredicates) Count += 1U + static_cast(Predicate.IntegerPredicate.has_value()) + Predicate.Captures.size() + Predicate.OperandDefConstants.size(); @@ -115,6 +116,9 @@ std::string emitGlobalISel(const NormalizedTargetModel &Model, std::string_view if (Rule.IntegerPredicate) emitInstruction(Output, "CheckIntegerPredicate", Rule.IntegerPredicate->OperandIndex, Rule.IntegerPredicate->Predicate); + if (Rule.FloatingPredicate) + emitInstruction(Output, "CheckFloatingPredicate", Rule.FloatingPredicate->OperandIndex, + Rule.FloatingPredicate->Predicate); for (const std::string &Predicate : Rule.TargetPredicates) emitInstruction(Output, "CheckTargetPredicate", 0, 0, "0", 0, Predicate); for (const NormalizedSelectionOperandTypePredicate &Predicate : Rule.OperandTypes) -- cgit v1.2.3