summaryrefslogtreecommitdiff
path: root/Source/Core
diff options
context:
space:
mode:
Diffstat (limited to 'Source/Core')
-rw-r--r--Source/Core/Core/PowerPC/Interpreter/Interpreter_FloatingPoint.cpp20
1 files changed, 17 insertions, 3 deletions
diff --git a/Source/Core/Core/PowerPC/Interpreter/Interpreter_FloatingPoint.cpp b/Source/Core/Core/PowerPC/Interpreter/Interpreter_FloatingPoint.cpp
index 98a5b8a2c0..cab27b3dd7 100644
--- a/Source/Core/Core/PowerPC/Interpreter/Interpreter_FloatingPoint.cpp
+++ b/Source/Core/Core/PowerPC/Interpreter/Interpreter_FloatingPoint.cpp
@@ -394,15 +394,29 @@ void Interpreter::fdivsx(UGeckoInstruction inst)
// Single precision only.
void Interpreter::fresx(UGeckoInstruction inst)
{
- double b = rPS0(inst.FB);
- rPS0(inst.FD) = rPS1(inst.FD) = Common::ApproximateReciprocal(b);
+ const double b = rPS0(inst.FB);
+ const double result = Common::ApproximateReciprocal(b);
+
+ rPS0(inst.FD) = rPS1(inst.FD) = result;
if (b == 0.0)
{
SetFPException(FPSCR_ZX);
+
+ if (FPSCR.ZE == 0)
+ PowerPC::UpdateFPRF(result);
}
+ else if (Common::IsSNAN(b))
+ {
+ SetFPException(FPSCR_VXSNAN);
- PowerPC::UpdateFPRF(rPS0(inst.FD));
+ if (FPSCR.VE == 0)
+ PowerPC::UpdateFPRF(result);
+ }
+ else
+ {
+ PowerPC::UpdateFPRF(result);
+ }
if (inst.Rc)
Helper_UpdateCR1();