Merge pull request #6955 from lioncash/nan

Interpreter_FloatingPoint: Set FPSCR.VXSNAN if input to fres is a signaling NaN
This commit is contained in:
Léo Lam 2018-05-25 15:09:04 +02:00 committed by GitHub
commit 9d1785718f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 18 additions and 4 deletions

View File

@ -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);
}
PowerPC::UpdateFPRF(rPS0(inst.FD));
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);
}
if (inst.Rc)
Helper_UpdateCR1();