diff options
author | Joseph Myers <joseph@codesourcery.com> | 2020-05-04 23:39:39 +0000 |
---|---|---|
committer | Richard Henderson <richard.henderson@linaro.org> | 2020-05-15 11:04:50 -0700 |
commit | be53fa785ab766d2722628403edee75b3e6ab599 (patch) | |
tree | 17bd6e1126e4ce4005f5f70b005f25d6092d1a7c /fpu | |
parent | 41602807766e253ccb6fb761f3ff12767f786e2c (diff) |
softfloat: fix floatx80 pseudo-denormal comparisons
The softfloat floatx80 comparisons fail to allow for pseudo-denormals,
which should compare equal to corresponding values with biased
exponent 1 rather than 0. Add an adjustment for that case when
comparing numbers with the same sign.
Signed-off-by: Joseph Myers <joseph@codesourcery.com>
Message-Id: <alpine.DEB.2.21.2005042338470.22972@digraph.polyomino.org.uk>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Diffstat (limited to 'fpu')
-rw-r--r-- | fpu/softfloat.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/fpu/softfloat.c b/fpu/softfloat.c index 6094d267b5..c57f72e3a6 100644 --- a/fpu/softfloat.c +++ b/fpu/softfloat.c @@ -7966,6 +7966,13 @@ static inline int floatx80_compare_internal(floatx80 a, floatx80 b, return 1 - (2 * aSign); } } else { + /* Normalize pseudo-denormals before comparison. */ + if ((a.high & 0x7fff) == 0 && a.low & UINT64_C(0x8000000000000000)) { + ++a.high; + } + if ((b.high & 0x7fff) == 0 && b.low & UINT64_C(0x8000000000000000)) { + ++b.high; + } if (a.low == b.low && a.high == b.high) { return float_relation_equal; } else { |