Permalink
Browse files

Merge pull request #6958 from lioncash/rsqrte

Interpreter_FloatingPoint: Handle SNaN flag setting in frsqrte
  • Loading branch information...
leoetlino committed May 25, 2018
2 parents 56217fd + 155bcb1 commit 3d44dc39814197e43bf1b8c2524684252251ee7b
Showing with 20 additions and 3 deletions.
  1. +20 −3 Source/Core/Core/PowerPC/Interpreter/Interpreter_FloatingPoint.cpp
@@ -424,19 +424,36 @@ 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 if (Common::IsSNAN(b))
{
SetFPException(FPSCR_VXSNAN);
if (FPSCR.VE == 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 3d44dc3

Please sign in to comment.