softfloat: fix floatx80 pseudo-denormal addition / subtraction

The softfloat function addFloatx80Sigs, used for addition of values
with the same sign and subtraction of values with opposite sign, fails
to handle the case where the two values both have biased exponent zero
and there is a carry resulting from adding the significands, which can
occur if one or both values are pseudo-denormals (biased exponent
zero, explicit integer bit 1). Add a check for that case, so making
the results match those seen on x86 hardware for pseudo-denormals.

Backports commit 41602807766e253ccb6fb761f3ff12767f786e2c from qemu
This commit is contained in:
Joseph Myers 2020-05-15 23:56:23 -04:00 committed by Lioncash
parent 2ea23a5bbd
commit 85964d48d2

View file

@ -5828,6 +5828,12 @@ static floatx80 addFloatx80Sigs(floatx80 a, floatx80 b, flag zSign,
zSig1 = 0;
zSig0 = aSig + bSig;
if ( aExp == 0 ) {
if ((aSig | bSig) & UINT64_C(0x8000000000000000) && zSig0 < aSig) {
/* At least one of the values is a pseudo-denormal,
* and there is a carry out of the result. */
zExp = 1;
goto shiftRight1;
}
if (zSig0 == 0) {
return packFloatx80(zSign, 0, 0);
}