From d05c2ef90dc2ae94d21aac5d61960dcb50160c35 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Sat, 2 Jun 2018 20:42:45 -0400 Subject: [PATCH] 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. --- Source/Core/Core/PowerPC/Interpreter/Interpreter_Paired.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Source/Core/Core/PowerPC/Interpreter/Interpreter_Paired.cpp b/Source/Core/Core/PowerPC/Interpreter/Interpreter_Paired.cpp index 6a84132c96..ce4dfd9568 100644 --- a/Source/Core/Core/PowerPC/Interpreter/Interpreter_Paired.cpp +++ b/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)));