Interpreter_Paired: Unset FPSCR.FI and FR in ps_res and ps_frsqrte in exceptional cases

If invalid operation exceptions or zero divide exceptions occur in
either of these instructions, FI and FR are supposed to be unset.
This commit is contained in:
Lioncash 2018-06-02 20:42:45 -04:00
parent 83774f72ad
commit d05c2ef90d
1 changed files with 6 additions and 0 deletions

View File

@ -121,6 +121,8 @@ void Interpreter::ps_res(UGeckoInstruction inst)
if (a == 0.0 || b == 0.0) if (a == 0.0 || b == 0.0)
{ {
SetFPException(FPSCR_ZX); SetFPException(FPSCR_ZX);
FPSCR.FI = 0;
FPSCR.FR = 0;
} }
rPS0(inst.FD) = Common::ApproximateReciprocal(a); rPS0(inst.FD) = Common::ApproximateReciprocal(a);
@ -136,11 +138,15 @@ void Interpreter::ps_rsqrte(UGeckoInstruction inst)
if (rPS0(inst.FB) == 0.0 || rPS1(inst.FB) == 0.0) if (rPS0(inst.FB) == 0.0 || rPS1(inst.FB) == 0.0)
{ {
SetFPException(FPSCR_ZX); SetFPException(FPSCR_ZX);
FPSCR.FI = 0;
FPSCR.FR = 0;
} }
if (rPS0(inst.FB) < 0.0 || rPS1(inst.FB) < 0.0) if (rPS0(inst.FB) < 0.0 || rPS1(inst.FB) < 0.0)
{ {
SetFPException(FPSCR_VXSQRT); SetFPException(FPSCR_VXSQRT);
FPSCR.FI = 0;
FPSCR.FR = 0;
} }
rPS0(inst.FD) = ForceSingle(Common::ApproximateReciprocalSquareRoot(rPS0(inst.FB))); rPS0(inst.FD) = ForceSingle(Common::ApproximateReciprocalSquareRoot(rPS0(inst.FB)));