Permalink
Browse files

Interpreter_FPUtils: Set FPSCR.VXSNAN if either operand to NI_sub is …

…a signaling NaN

If either operand is a signaling NaN, we need to signify this by setting
the VXSNAN bit.

This fixes NaN flag setting for fsub, fsubs, and ps_sub instructions.
  • Loading branch information...
lioncash committed May 27, 2018
1 parent f4c5ceb commit b18dd442f7b6790936f9e9f0287236ead0aee53f
Showing with 7 additions and 1 deletion.
  1. +7 −1 Source/Core/Core/PowerPC/Interpreter/Interpreter_FPUtils.h
@@ -165,16 +165,22 @@ inline double NI_add(double a, double b)
inline double NI_sub(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;
}

0 comments on commit b18dd44

Please sign in to comment.