diff --git a/Source/Core/Core/PowerPC/Interpreter/Interpreter_FPUtils.h b/Source/Core/Core/PowerPC/Interpreter/Interpreter_FPUtils.h index 30340b0bb9..843b580fdd 100644 --- a/Source/Core/Core/PowerPC/Interpreter/Interpreter_FPUtils.h +++ b/Source/Core/Core/PowerPC/Interpreter/Interpreter_FPUtils.h @@ -227,26 +227,37 @@ inline double NI_madd(double a, double c, double b) inline double NI_msub(double a, double c, double b) { double t = a * c; + if (std::isnan(t)) { + if (Common::IsSNAN(a) || Common::IsSNAN(b) || Common::IsSNAN(c)) + SetFPException(FPSCR_VXSNAN); + if (std::isnan(a)) return MakeQuiet(a); if (std::isnan(b)) return MakeQuiet(b); // ! if (std::isnan(c)) return MakeQuiet(c); + SetFPException(FPSCR_VXIMZ); return PPC_NAN; } t -= b; + if (std::isnan(t)) { + if (Common::IsSNAN(b)) + SetFPException(FPSCR_VXSNAN); + if (std::isnan(b)) return MakeQuiet(b); + SetFPException(FPSCR_VXISI); return PPC_NAN; } + return t; }