Permalink
Browse files

Interpreter_FloatingPoint: Don't update FPRF in frsqrte in certain ex…

…ceptional cases

If the FPSCR.VE bit is set and an invalid operand is passed in, then the FPRF
shouldn't be updated. Similarly this is also the case when the FPSCR.ZE bit
is set and negative or positive zero is passed in as the operand.
  • Loading branch information...
lioncash committed May 24, 2018
1 parent 5ac0572 commit 31504f85a7998db647d03241289300c8206c9081
Showing with 13 additions and 3 deletions.
  1. +13 −3 Source/Core/Core/PowerPC/Interpreter/Interpreter_FloatingPoint.cpp
@@ -410,19 +410,29 @@ void Interpreter::fresx(UGeckoInstruction inst)
void Interpreter::frsqrtex(UGeckoInstruction inst)
{
double b = rPS0(inst.FB);
const double b = rPS0(inst.FB);
const double result = Common::ApproximateReciprocalSquareRoot(b);
if (b < 0.0)
{
SetFPException(FPSCR_VXSQRT);
if (FPSCR.VE == 0)
PowerPC::UpdateFPRF(result);
}
else if (b == 0.0)
{
SetFPException(FPSCR_ZX);
if (FPSCR.ZE == 0)
PowerPC::UpdateFPRF(result);
}
else
{
PowerPC::UpdateFPRF(result);
}
rPS0(inst.FD) = Common::ApproximateReciprocalSquareRoot(b);
PowerPC::UpdateFPRF(rPS0(inst.FD));
rPS0(inst.FD) = result;
if (inst.Rc)
Helper_UpdateCR1();

0 comments on commit 31504f8

Please sign in to comment.