Permalink
Browse files

Merge pull request #6955 from lioncash/nan

Interpreter_FloatingPoint: Set FPSCR.VXSNAN if input to fres is a signaling NaN
  • Loading branch information...
leoetlino committed May 25, 2018
2 parents 647309a + 34adc52 commit 9d1785718fdd99edb5b480d571db8a77028bb882
Showing with 17 additions and 3 deletions.
  1. +17 −3 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();

0 comments on commit 9d17857

Please sign in to comment.