From 490bebbd9a48345abf8d157acb378d07811be654 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Fri, 8 Mar 2019 06:20:50 -0500 Subject: [PATCH] common/fp/unpacked: Add FPUnpackCV Adds a template function that performs the same behavior as in the ARM pseudocode, and utilizes it in FPConvert, which will be necessary for half-float support. --- src/common/fp/op/FPConvert.cpp | 2 +- src/common/fp/unpacked.h | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/common/fp/op/FPConvert.cpp b/src/common/fp/op/FPConvert.cpp index 559d0242..49524906 100644 --- a/src/common/fp/op/FPConvert.cpp +++ b/src/common/fp/op/FPConvert.cpp @@ -59,7 +59,7 @@ FPT_TO FPConvertNaN(FPT_FROM op) { template FPT_TO FPConvert(FPT_FROM op, FPCR fpcr, RoundingMode rounding_mode, FPSR& fpsr) { - const auto [type, sign, value] = FPUnpack(op, fpcr, fpsr); + const auto [type, sign, value] = FPUnpackCV(op, fpcr, fpsr); const bool is_althp = Common::BitSize() == 16 && fpcr.AHP(); if (type == FPType::SNaN || type == FPType::QNaN) { diff --git a/src/common/fp/unpacked.h b/src/common/fp/unpacked.h index 132fedd0..943ee461 100644 --- a/src/common/fp/unpacked.h +++ b/src/common/fp/unpacked.h @@ -54,6 +54,12 @@ constexpr FPUnpacked ToNormalized(bool sign, int exponent, u64 value) { template std::tuple FPUnpack(FPT op, FPCR fpcr, FPSR& fpsr); +template +std::tuple FPUnpackCV(FPT op, FPCR fpcr, FPSR& fpsr) { + fpcr.FZ16(false); + return FPUnpack(op, fpcr, fpsr); +} + template FPT FPRoundBase(FPUnpacked op, FPCR fpcr, RoundingMode rounding, FPSR& fpsr);