summaryrefslogtreecommitdiff
path: root/Source/Core
diff options
context:
space:
mode:
authorLéo Lam <leo@innovatetechnologi.es>2018-05-25 15:09:04 +0200
committerGitHub <noreply@github.com>2018-05-25 15:09:04 +0200
commit9d1785718fdd99edb5b480d571db8a77028bb882 (patch)
treeccac6304d89860aad51bf9a3c3a4f0d4179909c7 /Source/Core
parent647309a6508cab07d31323654b0e573fcf9fd390 (diff)
parent34adc529a77d6efb64774ea23b69ac8835609b47 (diff)
Merge pull request #6955 from lioncash/nan
Interpreter_FloatingPoint: Set FPSCR.VXSNAN if input to fres is a signaling NaN
Diffstat (limited to 'Source/Core')
-rw-r--r--Source/Core/Core/PowerPC/Interpreter/Interpreter_FloatingPoint.cpp20
1 files changed, 17 insertions, 3 deletions
diff --git a/Source/Core/Core/PowerPC/Interpreter/Interpreter_FloatingPoint.cpp b/Source/Core/Core/PowerPC/Interpreter/Interpreter_FloatingPoint.cpp
index 98a5b8a2c0..cab27b3dd7 100644
--- a/Source/Core/Core/PowerPC/Interpreter/Interpreter_FloatingPoint.cpp
+++ b/Source/Core/Core/PowerPC/Interpreter/Interpreter_FloatingPoint.cpp
@@ -394,15 +394,29 @@ void Interpreter::fdivsx(UGeckoInstruction inst)
// Single precision only.
void Interpreter::fresx(UGeckoInstruction inst)
{
- double b = rPS0(inst.FB);
- rPS0(inst.FD) = rPS1(inst.FD) = Common::ApproximateReciprocal(b);
+ const double b = rPS0(inst.FB);
+ const double result = Common::ApproximateReciprocal(b);
+
+ rPS0(inst.FD) = rPS1(inst.FD) = result;
if (b == 0.0)
{
SetFPException(FPSCR_ZX);
+
+ if (FPSCR.ZE == 0)
+ PowerPC::UpdateFPRF(result);
}
+ else if (Common::IsSNAN(b))
+ {
+ SetFPException(FPSCR_VXSNAN);
- PowerPC::UpdateFPRF(rPS0(inst.FD));
+ if (FPSCR.VE == 0)
+ PowerPC::UpdateFPRF(result);
+ }
+ else
+ {
+ PowerPC::UpdateFPRF(result);
+ }
if (inst.Rc)
Helper_UpdateCR1();