Permalink
Browse files

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.
  • Loading branch information...
lioncash committed Jun 3, 2018
1 parent 83774f7 commit d05c2ef90dc2ae94d21aac5d61960dcb50160c35
Showing with 6 additions and 0 deletions.
  1. +6 −0 Source/Core/Core/PowerPC/Interpreter/Interpreter_Paired.cpp
@@ -121,6 +121,8 @@ void Interpreter::ps_res(UGeckoInstruction inst)
if (a == 0.0 || b == 0.0)
{
SetFPException(FPSCR_ZX);
FPSCR.FI = 0;
FPSCR.FR = 0;
}
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)
{
SetFPException(FPSCR_ZX);
FPSCR.FI = 0;
FPSCR.FR = 0;
}
if (rPS0(inst.FB) < 0.0 || rPS1(inst.FB) < 0.0)
{
SetFPException(FPSCR_VXSQRT);
FPSCR.FI = 0;
FPSCR.FR = 0;
}
rPS0(inst.FD) = ForceSingle(Common::ApproximateReciprocalSquareRoot(rPS0(inst.FB)));

0 comments on commit d05c2ef

Please sign in to comment.