softfloat: fix floatx80 pseudo-denormal round to integer
commit9ecaf5ccec13ff2e8fe1e72f6e0f3367d2169c1c
authorJoseph Myers <joseph@codesourcery.com>
Mon, 4 May 2020 23:40:20 +0000 (4 23:40 +0000)
committerRichard Henderson <richard.henderson@linaro.org>
Fri, 15 May 2020 18:04:50 +0000 (15 11:04 -0700)
treeb51a6862e2ea9ddeaf179d2526de717ffa336c66
parentbe53fa785ab766d2722628403edee75b3e6ab599
softfloat: fix floatx80 pseudo-denormal round to integer

The softfloat function floatx80_round_to_int incorrectly handles the
case of a pseudo-denormal where only the high bit of the significand
is set, ignoring that bit (treating the number as an exact zero)
rather than treating the number as an alternative representation of
+/- 2^-16382 (which may round to +/- 1 depending on the rounding mode)
as hardware does.  Fix this check (simplifying the code in the
process).

Signed-off-by: Joseph Myers <joseph@codesourcery.com>
Message-Id: <alpine.DEB.2.21.2005042339420.22972@digraph.polyomino.org.uk>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
fpu/softfloat.c
tests/tcg/i386/test-i386-pseudo-denormal.c