Interpreter_FloatingPoint: Set FPSCR.VXSNAN if input to fres is a signaling NaN

fres is defined as having the VXSNAN bit set if an input to the
instruction is a signaling NaN
This commit is contained in:
Lioncash 2018-05-23 19:45:24 -04:00
parent 5ac05725c8
commit 8a79f9099c
1 changed files with 6 additions and 1 deletions

View File

@ -394,7 +394,7 @@ void Interpreter::fdivsx(UGeckoInstruction inst)
// Single precision only. // Single precision only.
void Interpreter::fresx(UGeckoInstruction inst) void Interpreter::fresx(UGeckoInstruction inst)
{ {
double b = rPS0(inst.FB); const double b = rPS0(inst.FB);
rPS0(inst.FD) = rPS1(inst.FD) = Common::ApproximateReciprocal(b); rPS0(inst.FD) = rPS1(inst.FD) = Common::ApproximateReciprocal(b);
if (b == 0.0) if (b == 0.0)
@ -402,6 +402,11 @@ void Interpreter::fresx(UGeckoInstruction inst)
SetFPException(FPSCR_ZX); SetFPException(FPSCR_ZX);
} }
if (Common::IsSNAN(b))
{
SetFPException(FPSCR_VXSNAN);
}
PowerPC::UpdateFPRF(rPS0(inst.FD)); PowerPC::UpdateFPRF(rPS0(inst.FD));
if (inst.Rc) if (inst.Rc)