Permalink
Browse files

Interpreter_FloatingPoint: Don't update the FPRF in fres in certain e…

…xceptional cases

If FPSCR.ZE is set and a divide by zero exception is signaled, then the
FPRF shouldn't be updated with a result. Similarly, if the input is an
SNaN and FPSCR.VE is set, then the FPRF shouldn't be updated.
  • Loading branch information...
lioncash committed May 24, 2018
1 parent 8a79f90 commit 34adc529a77d6efb64774ea23b69ac8835609b47
Showing with 14 additions and 5 deletions.
  1. +14 −5 Source/Core/Core/PowerPC/Interpreter/Interpreter_FloatingPoint.cpp
@@ -395,19 +395,28 @@ void Interpreter::fdivsx(UGeckoInstruction inst)
void Interpreter::fresx(UGeckoInstruction inst)
{
const double b = rPS0(inst.FB);
rPS0(inst.FD) = rPS1(inst.FD) = Common::ApproximateReciprocal(b);
const double result = Common::ApproximateReciprocal(b);
rPS0(inst.FD) = rPS1(inst.FD) = result;
if (b == 0.0)
{
SetFPException(FPSCR_ZX);
}
if (Common::IsSNAN(b))
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();

0 comments on commit 34adc52

Please sign in to comment.