Merge pull request #6966 from lioncash/fmul

Interpreter_FPUtils: Set FPSCR.VXSNAN if either operand to NI_mul() is a signaling NaN
This commit is contained in:
Léo Lam
2018-05-26 11:43:11 +02:00
committed by GitHub

View File

@@ -94,13 +94,17 @@ inline double MakeQuiet(double d)
inline double NI_mul(double a, double b) inline double NI_mul(double a, double b)
{ {
double t = a * b; const double t = a * b;
if (std::isnan(t)) if (std::isnan(t))
{ {
if (Common::IsSNAN(a) || Common::IsSNAN(b))
SetFPException(FPSCR_VXSNAN);
if (std::isnan(a)) if (std::isnan(a))
return MakeQuiet(a); return MakeQuiet(a);
if (std::isnan(b)) if (std::isnan(b))
return MakeQuiet(b); return MakeQuiet(b);
SetFPException(FPSCR_VXIMZ); SetFPException(FPSCR_VXIMZ);
return PPC_NAN; return PPC_NAN;
} }