Merge pull request #6977 from lioncash/add

Interpreter_FPUtils: Set FPSCR.VXSNAN if either operand to NI_add() is a signaling NaN
This commit is contained in:
Léo Lam 2018-05-27 10:21:20 +02:00 committed by GitHub
commit e9ce75ccc4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -137,16 +137,22 @@ inline double NI_div(double a, double b)
inline double NI_add(double a, double b)
{
double t = a + b;
const double t = a + b;
if (std::isnan(t))
{
if (Common::IsSNAN(a) || Common::IsSNAN(b))
SetFPException(FPSCR_VXSNAN);
if (std::isnan(a))
return MakeQuiet(a);
if (std::isnan(b))
return MakeQuiet(b);
SetFPException(FPSCR_VXISI);
return PPC_NAN;
}
return t;
}