mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-02-13 15:59:23 +01:00
Interpreter_FloatingPoint: Don't store to destination in frsqrte if VE or ZE is set and a relevant exception occurs
As explained within commit a08ad82ace064f961b13369c96a0f3b48ca7ca5c, if an invalid exception occurs and VE is set, then the destination register should remain unchanged. Ditto for when ZE is set and a zero divide exception occurs.
This commit is contained in:
parent
8d1b2f9cae
commit
b71a9e658f
@ -422,36 +422,39 @@ void Interpreter::fresx(UGeckoInstruction inst)
|
||||
void Interpreter::frsqrtex(UGeckoInstruction inst)
|
||||
{
|
||||
const double b = rPS0(inst.FB);
|
||||
const double result = Common::ApproximateReciprocalSquareRoot(b);
|
||||
|
||||
const auto compute_result = [inst](double value) {
|
||||
const double result = Common::ApproximateReciprocalSquareRoot(value);
|
||||
rPS0(inst.FD) = result;
|
||||
PowerPC::UpdateFPRF(result);
|
||||
};
|
||||
|
||||
if (b < 0.0)
|
||||
{
|
||||
SetFPException(FPSCR_VXSQRT);
|
||||
|
||||
if (FPSCR.VE == 0)
|
||||
PowerPC::UpdateFPRF(result);
|
||||
compute_result(b);
|
||||
}
|
||||
else if (b == 0.0)
|
||||
{
|
||||
SetFPException(FPSCR_ZX);
|
||||
|
||||
if (FPSCR.ZE == 0)
|
||||
PowerPC::UpdateFPRF(result);
|
||||
compute_result(b);
|
||||
}
|
||||
else if (Common::IsSNAN(b))
|
||||
{
|
||||
SetFPException(FPSCR_VXSNAN);
|
||||
|
||||
if (FPSCR.VE == 0)
|
||||
PowerPC::UpdateFPRF(result);
|
||||
compute_result(b);
|
||||
}
|
||||
else
|
||||
{
|
||||
PowerPC::UpdateFPRF(result);
|
||||
compute_result(b);
|
||||
}
|
||||
|
||||
rPS0(inst.FD) = result;
|
||||
|
||||
if (inst.Rc)
|
||||
Helper_UpdateCR1();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user