All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Alex Bennée" <alex.bennee@linaro.org>
To: Joseph Myers <joseph@codesourcery.com>
Cc: qemu-devel@nongnu.org
Subject: Re: [PATCH 3/4] softfloat: fix floatx80 pseudo-denormal comparisons
Date: Fri, 01 May 2020 20:07:23 +0100	[thread overview]
Message-ID: <87d07niidw.fsf@linaro.org> (raw)
In-Reply-To: <alpine.DEB.2.21.2005010038260.30535@digraph.polyomino.org.uk>


Joseph Myers <joseph@codesourcery.com> writes:

> 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.
>
> Note that this fix only changes floatx80_compare_internal, not the
> other more specific comparison operations.  That is the only
> comparison function for floatx80 used in the i386 port, which is the
> only supported port with these pseudo-denormal semantics.

Again I can't see anything that triggers this although I noticed
le_quiet has been fixed in the meantime. lt_quiet still fails with:

  ./fp-test -s -l 2 -r all  extF80_lt_quiet
  >> Testing extF80_lt_quiet
  59535872 tests total.
  Errors found in extF80_lt_quiet:
  +0000.0000000000000000  +0000.0000000000000000  => 1 .....  expected 0 .....
  +0000.0000000000000000  -0000.0000000000000000  => 1 .....  expected 0 .....
  +0000.0000000000000001  +0000.0000000000000001  => 1 .....  expected 0 .....
  +0000.0000000000000002  +0000.0000000000000002  => 1 .....  expected 0 .....
  +0000.0000000000000004  +0000.0000000000000004  => 1 .....  expected 0 .....
  +0000.0000000000000008  +0000.0000000000000008  => 1 .....  expected 0 .....
  +0000.0000000000000010  +0000.0000000000000010  => 1 .....  expected 0 .....
  +0000.0000000000000020  +0000.0000000000000020  => 1 .....  expected 0 .....
  +0000.0000000000000040  +0000.0000000000000040  => 1 .....  expected 0 .....
  +0000.0000000000000080  +0000.0000000000000080  => 1 .....  expected 0 .....
  +0000.0000000000000100  +0000.0000000000000100  => 1 .....  expected 0 .....
  +0000.0000000000000200  +0000.0000000000000200  => 1 .....  expected 0 .....
  +0000.0000000000000400  +0000.0000000000000400  => 1 .....  expected 0 .....
  +0000.0000000000000800  +0000.0000000000000800  => 1 .....  expected 0 .....
  +0000.0000000000001000  +0000.0000000000001000  => 1 .....  expected 0 .....
  +0000.0000000000002000  +0000.0000000000002000  => 1 .....  expected 0 .....
  +0000.0000000000004000  +0000.0000000000004000  => 1 .....  expected 0 .....
  +0000.0000000000008000  +0000.0000000000008000  => 1 .....  expected 0 .....
  +0000.0000000000010000  +0000.0000000000010000  => 1 .....  expected 0 .....
  +0000.0000000000020000  +0000.0000000000020000  => 1 .....  expected 0 .....


>
> Signed-off-by: Joseph Myers <joseph@codesourcery.com>
> ---
>  fpu/softfloat.c | 5 +++++
>  1 file changed, 5 insertions(+)
>
> diff --git a/fpu/softfloat.c b/fpu/softfloat.c
> index 6094d267b5..8e9c714e6f 100644
> --- a/fpu/softfloat.c
> +++ b/fpu/softfloat.c
> @@ -7966,6 +7966,11 @@ 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 {
> -- 
> 2.17.1


-- 
Alex Bennée


  reply	other threads:[~2020-05-01 19:08 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-01  0:39 [PATCH 3/4] softfloat: fix floatx80 pseudo-denormal comparisons Joseph Myers
2020-05-01 19:07 ` Alex Bennée [this message]
2020-05-01 19:12   ` Joseph Myers
2020-05-01 19:31     ` Alex Bennée
2020-05-01 21:01       ` Joseph Myers
2020-05-02 19:07         ` Alex Bennée

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87d07niidw.fsf@linaro.org \
    --to=alex.bennee@linaro.org \
    --cc=joseph@codesourcery.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.