Denormals support for all SSE instructions

This commit is contained in:
Stanislav Shwartsman 2003-05-17 09:08:18 +00:00
parent 30fb8845d4
commit 09b987a9e8
2 changed files with 26 additions and 1 deletions

View File

@ -799,9 +799,15 @@ static float32 addFloat32Sigs(float32 a, float32 b, flag zSign, float_status_t &
aExp = extractFloat32Exp(a);
bSig = extractFloat32Frac(b);
bExp = extractFloat32Exp(b);
if (((aExp == 0) && aSig) || ((bExp == 0) && bSig)) {
float_raise(status, float_flag_denormal);
}
expDiff = aExp - bExp;
aSig <<= 6;
bSig <<= 6;
if (0 < expDiff) {
if (aExp == 0xFF) {
if (aSig) return propagateFloat32NaN(a, b, status);
@ -869,6 +875,11 @@ static float32 subFloat32Sigs(float32 a, float32 b, flag zSign, float_status_t &
aExp = extractFloat32Exp(a);
bSig = extractFloat32Frac(b);
bExp = extractFloat32Exp(b);
if (((aExp == 0) && aSig) || ((bExp == 0) && bSig)) {
float_raise(status, float_flag_denormal);
}
expDiff = aExp - bExp;
aSig <<= 7;
bSig <<= 7;
@ -1697,6 +1708,10 @@ float32 float64_to_float32(float64 a, float_status_t &status)
if (aSig) return commonNaNToFloat32(float64ToCommonNaN(a, status));
return packFloat32(aSign, 0xFF, 0);
}
if (aExp == 0) {
if (aSig == 0) return packFloat32(aSign, 0, 0);
float_raise(status, float_flag_denormal);
}
shift64RightJamming(aSig, 22, &aSig);
zSig = aSig;
if (aExp || zSig) {
@ -1783,6 +1798,11 @@ static float64 addFloat64Sigs(float64 a, float64 b, flag zSign, float_status_t &
aExp = extractFloat64Exp(a);
bSig = extractFloat64Frac(b);
bExp = extractFloat64Exp(b);
if (((aExp == 0) && aSig) || ((bExp == 0) && bSig)) {
float_raise(status, float_flag_denormal);
}
expDiff = aExp - bExp;
aSig <<= 9;
bSig <<= 9;
@ -1853,6 +1873,11 @@ static float64 subFloat64Sigs(float64 a, float64 b, flag zSign, float_status_t &
aExp = extractFloat64Exp(a);
bSig = extractFloat64Frac(b);
bExp = extractFloat64Exp(b);
if (((aExp == 0) && aSig) || ((bExp == 0) && bSig)) {
float_raise(status, float_flag_denormal);
}
expDiff = aExp - bExp;
aSig <<= 10;
bSig <<= 10;

View File

@ -35,7 +35,7 @@ these four paragraphs for those parts of this code that are retained.
/*
* Still to be fixed:
* -----------------
* * Denormals support for add/sub/compare/convert operations
* * Denormals support for add/sub/compare/convert operations (implemented)
* * DAZ (denormals-are-zeroes) feature support
* * Flush underflow to zero feature support (implemented)
* * Floating point reciprocal and sqrt reciprocal operations