From 61cec94a199cbe917283b808dc15c734faa21dbf Mon Sep 17 00:00:00 2001 From: Lioncash Date: Sat, 13 Apr 2019 17:37:45 -0400 Subject: [PATCH] fp/op/FPRoundInt: Add half-precision specialization of FPRoundInt --- src/common/fp/op/FPRoundInt.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/common/fp/op/FPRoundInt.cpp b/src/common/fp/op/FPRoundInt.cpp index f22c83d3..d2456394 100644 --- a/src/common/fp/op/FPRoundInt.cpp +++ b/src/common/fp/op/FPRoundInt.cpp @@ -31,11 +31,11 @@ u64 FPRoundInt(FPT op, FPCR fpcr, RoundingMode rounding, bool exact, FPSR& fpsr) } if (type == FPType::Infinity) { - return FPInfo::Infinity(sign); + return FPT(FPInfo::Infinity(sign)); } if (type == FPType::Zero) { - return FPInfo::Zero(sign); + return FPT(FPInfo::Zero(sign)); } // Reshift decimal point back to bit zero. @@ -79,7 +79,7 @@ u64 FPRoundInt(FPT op, FPCR fpcr, RoundingMode rounding, bool exact, FPSR& fpsr) const u64 abs_int_result = new_sign ? Safe::Negate(int_result) : static_cast(int_result); const FPT result = int_result == 0 - ? FPInfo::Zero(sign) + ? FPT(FPInfo::Zero(sign)) : FPRound(FPUnpacked{new_sign, normalized_point_position, abs_int_result}, fpcr, RoundingMode::TowardsZero, fpsr); if (error != ResidualError::Zero && exact) { @@ -89,6 +89,7 @@ u64 FPRoundInt(FPT op, FPCR fpcr, RoundingMode rounding, bool exact, FPSR& fpsr) return result; } +template u64 FPRoundInt(u16 op, FPCR fpcr, RoundingMode rounding, bool exact, FPSR& fpsr); template u64 FPRoundInt(u32 op, FPCR fpcr, RoundingMode rounding, bool exact, FPSR& fpsr); template u64 FPRoundInt(u64 op, FPCR fpcr, RoundingMode rounding, bool exact, FPSR& fpsr);