diff --git a/src/common/fp/info.h b/src/common/fp/info.h index 357fd0c3..9253a2ee 100644 --- a/src/common/fp/info.h +++ b/src/common/fp/info.h @@ -88,7 +88,7 @@ struct FPInfo { template constexpr FPT FPValue() { if constexpr (value == 0) { - return FPInfo::Zero(sign); + return FPT(FPInfo::Zero(sign)); } constexpr int point_position = static_cast(FPInfo::explicit_mantissa_width); @@ -100,7 +100,7 @@ constexpr FPT FPValue() { constexpr FPT mantissa = (value << offset) & FPInfo::mantissa_mask; constexpr FPT biased_exponent = static_cast(normalized_exponent + FPInfo::exponent_bias); - return FPInfo::Zero(sign) | mantissa | (biased_exponent << FPInfo::explicit_mantissa_width); + return FPT(FPInfo::Zero(sign) | mantissa | (biased_exponent << FPInfo::explicit_mantissa_width)); } } // namespace Dynarmic::FP diff --git a/src/common/fp/op/FPRecipStepFused.cpp b/src/common/fp/op/FPRecipStepFused.cpp index 9ba62212..938650ce 100644 --- a/src/common/fp/op/FPRecipStepFused.cpp +++ b/src/common/fp/op/FPRecipStepFused.cpp @@ -21,7 +21,7 @@ FPT FPRecipStepFused(FPT op1, FPT op2, FPCR fpcr, FPSR& fpsr) { const auto [type1, sign1, value1] = FPUnpack(op1, fpcr, fpsr); const auto [type2, sign2, value2] = FPUnpack(op2, fpcr, fpsr); - + if (const auto maybe_nan = FPProcessNaNs(type1, type2, op1, op2, fpcr, fpsr)) { return *maybe_nan; } @@ -37,18 +37,19 @@ FPT FPRecipStepFused(FPT op1, FPT op2, FPCR fpcr, FPSR& fpsr) { } if (inf1 || inf2) { - return FPInfo::Infinity(sign1 != sign2); + return FPT(FPInfo::Infinity(sign1 != sign2)); } // result_value = 2.0 + (value1 * value2) - FPUnpacked result_value = FusedMulAdd(ToNormalized(false, 0, 2), value1, value2); + const FPUnpacked result_value = FusedMulAdd(ToNormalized(false, 0, 2), value1, value2); if (result_value.mantissa == 0) { - return FPInfo::Zero(fpcr.RMode() == RoundingMode::TowardsMinusInfinity); + return FPT(FPInfo::Zero(fpcr.RMode() == RoundingMode::TowardsMinusInfinity)); } return FPRound(result_value, fpcr, fpsr); } +template u16 FPRecipStepFused(u16 op1, u16 op2, FPCR fpcr, FPSR& fpsr); template u32 FPRecipStepFused(u32 op1, u32 op2, FPCR fpcr, FPSR& fpsr); template u64 FPRecipStepFused(u64 op1, u64 op2, FPCR fpcr, FPSR& fpsr);