SSE: fixed missed unmasked undeflow issues

This commit is contained in:
Stanislav Shwartsman 2012-06-02 11:36:17 +00:00
parent 321cb7e9fc
commit 0eef00bb59

View File

@ -482,19 +482,19 @@ static float32 addFloat32Sigs(float32 a, float32 b, int zSign, float_status_t &s
return a;
}
if (aExp == 0) {
zSig = (aSig + bSig) >> 6;
if (aSig | bSig) {
float_raise(status, float_flag_denormal);
if (get_flush_underflow_to_zero(status)) {
float_raise(status, float_flag_underflow | float_flag_inexact);
return packFloat32(zSign, 0, 0);
}
// denormal + zero with unmasked underflow
if (! float_exception_masked(status, float_flag_underflow)) {
if ((aSig == 0 && bSig != 0) || (aSig != 0 && bSig == 0))
if (extractFloat32Frac(zSig) == zSig)
float_raise(status, float_flag_underflow);
}
}
return packFloat32(zSign, 0, (aSig + bSig)>>6);
return packFloat32(zSign, 0, zSig);
}
zSig = 0x40000000 + aSig + bSig;
return roundAndPackFloat32(zSign, aExp, zSig, status);
@ -1355,19 +1355,19 @@ static float64 addFloat64Sigs(float64 a, float64 b, int zSign, float_status_t &s
return a;
}
if (aExp == 0) {
zSig = (aSig + bSig) >> 9;
if (aSig | bSig) {
float_raise(status, float_flag_denormal);
if (get_flush_underflow_to_zero(status)) {
float_raise(status, float_flag_underflow | float_flag_inexact);
return packFloat64(zSign, 0, 0);
}
// denormal + zero with unmasked underflow
if (! float_exception_masked(status, float_flag_underflow)) {
if ((aSig == 0 && bSig != 0) || (aSig != 0 && bSig == 0))
if (extractFloat64Frac(zSig) == zSig)
float_raise(status, float_flag_underflow);
}
}
return packFloat64(zSign, 0, (aSig + bSig)>>9);
return packFloat64(zSign, 0, zSig);
}
zSig = BX_CONST64(0x4000000000000000) + aSig + bSig;
return roundAndPackFloat64(zSign, aExp, zSig, status);