diff options
| author | degasus <wickmarkus@web.de> | 2019-04-11 09:40:05 +0200 |
|---|---|---|
| committer | degasus <wickmarkus@web.de> | 2019-04-11 10:12:59 +0200 |
| commit | 399768c91b69d953fe0c2152feba2665aa79f2a3 (patch) | |
| tree | f915a58661488b072b0a6e33ac52b3f0d97b4d2a /Source | |
| parent | 849ede9d0ab20b0a0462df8cef12be286f845c07 (diff) | |
Interpreter: Fix psq_l with QUANTIZE_FLOAT.
psq_l with QUANTIZE_FLOAT does not use the FPU, so it does not trim the precision of the u32 input data.
We already have the helper ConvertToDouble for floating point u32->u64 convertion used in lfs, so let's use it here as well.
Diffstat (limited to 'Source')
| -rw-r--r-- | Source/Core/Core/PowerPC/Interpreter/Interpreter_LoadStorePaired.cpp | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/Source/Core/Core/PowerPC/Interpreter/Interpreter_LoadStorePaired.cpp b/Source/Core/Core/PowerPC/Interpreter/Interpreter_LoadStorePaired.cpp index b65e642198..1d78e5e6d8 100644 --- a/Source/Core/Core/PowerPC/Interpreter/Interpreter_LoadStorePaired.cpp +++ b/Source/Core/Core/PowerPC/Interpreter/Interpreter_LoadStorePaired.cpp @@ -226,7 +226,7 @@ static void Helper_Quantize(const PowerPC::PowerPCState* ppcs, u32 addr, u32 ins } template <typename T> -std::pair<float, float> LoadAndDequantize(u32 addr, u32 instW, u32 ldScale) +std::pair<double, double> LoadAndDequantize(u32 addr, u32 instW, u32 ldScale) { using U = std::make_unsigned_t<T>; @@ -243,7 +243,8 @@ std::pair<float, float> LoadAndDequantize(u32 addr, u32 instW, u32 ldScale) ps0 = (float)(T)(value.first) * m_dequantizeTable[ldScale]; ps1 = (float)(T)(value.second) * m_dequantizeTable[ldScale]; } - return {ps0, ps1}; + // ps0 and ps1 always contain finite and normal numbers. So we can just cast them to double + return {static_cast<double>(ps0), static_cast<double>(ps1)}; } static void Helper_Dequantize(PowerPC::PowerPCState* ppcs, u32 addr, u32 instI, u32 instRD, @@ -253,8 +254,8 @@ static void Helper_Dequantize(PowerPC::PowerPCState* ppcs, u32 addr, u32 instI, EQuantizeType ldType = gqr.ld_type; unsigned int ldScale = gqr.ld_scale; - float ps0 = 0.0f; - float ps1 = 0.0f; + double ps0 = 0.0; + double ps1 = 0.0; switch (ldType) { @@ -262,14 +263,14 @@ static void Helper_Dequantize(PowerPC::PowerPCState* ppcs, u32 addr, u32 instI, if (instW) { const u32 value = ReadUnpaired<u32>(addr); - ps0 = Common::BitCast<float>(value); - ps1 = 1.0f; + ps0 = Common::BitCast<double>(ConvertToDouble(value)); + ps1 = 1.0; } else { const std::pair<u32, u32> value = ReadPair<u32>(addr); - ps0 = Common::BitCast<float>(value.first); - ps1 = Common::BitCast<float>(value.second); + ps0 = Common::BitCast<double>(ConvertToDouble(value.first)); + ps1 = Common::BitCast<double>(ConvertToDouble(value.second)); } break; @@ -293,8 +294,8 @@ static void Helper_Dequantize(PowerPC::PowerPCState* ppcs, u32 addr, u32 instI, case QUANTIZE_INVALID2: case QUANTIZE_INVALID3: ASSERT_MSG(POWERPC, 0, "PS dequantize - unknown type to read"); - ps0 = 0.f; - ps1 = 0.f; + ps0 = 0.0; + ps1 = 0.0; break; } |
