Interpreter_FPUtils: Set FPSCR.VXSNAN if either operand to NI_div is a signaling NaN
If either operand is a signaling NaN, we need to signify that by setting the VXSNAN bit. This fixes NaN flag setting for fdiv, fdivs and ps_div instructions.
This commit is contained in:
parent
e9ce75ccc4
commit
f4c5ceba1c
|
@ -113,13 +113,18 @@ inline double NI_mul(double a, double b)
|
||||||
|
|
||||||
inline double NI_div(double a, double b)
|
inline double NI_div(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);
|
||||||
|
|
||||||
if (b == 0.0)
|
if (b == 0.0)
|
||||||
{
|
{
|
||||||
SetFPException(FPSCR_ZX);
|
SetFPException(FPSCR_ZX);
|
||||||
|
@ -130,8 +135,10 @@ inline double NI_div(double a, double b)
|
||||||
{
|
{
|
||||||
SetFPException(FPSCR_VXIDI);
|
SetFPException(FPSCR_VXIDI);
|
||||||
}
|
}
|
||||||
|
|
||||||
return PPC_NAN;
|
return PPC_NAN;
|
||||||
}
|
}
|
||||||
|
|
||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue