public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "ubizjak at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/96793] __builtin_floor produces wrong result when rounding direction is FE_DOWNWARD
Date: Wed, 23 Dec 2020 08:20:23 +0000	[thread overview]
Message-ID: <bug-96793-4-xzJYg0S4G4@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-96793-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96793

--- Comment #21 from Uroš Bizjak <ubizjak at gmail dot com> ---


https://gcc.gnu.org/g:c40b640ebcef1aae78eaca56e04d204dda9e4cad

commit r9-9126-gc40b640ebcef1aae78eaca56e04d204dda9e4cad
Author: Uros Bizjak <ubizjak@gmail.com>
Date:   Wed Dec 23 09:09:29 2020 +0100

    i386: Fix __builtin_floor with FE_DOWNWARD rounding direction [PR96793]

    x86_expand_floorceil expander uses x86_sse_copysign_to_positive, which
    is unable to change the sign from - to +.  When FE_DOWNWARD rounding
    direction is in effect, the expanded sequence that involves subtraction
    can trigger x - x = -0.0 special rule.  x86_sse_copysign_to_positive
    fails to change the sign of the intermediate value, assumed to always
    be positive, back to positive.

    The patch adds one extra fabs that strips the sign from the intermediate
    value when flag_rounding_math is in effect.

    2020-12-22  Uroš Bizjak  <ubizjak@gmail.com>

    gcc/
            PR target/96793
            * config/i386/i386.c (ix86_expand_floorceil):
            Remove the sign of the intermediate value for flag_rounding_math.
            (ix86_expand_floorceildf_32): Ditto.

    gcc/testsuite/
            PR target/96793
            * gcc.target/i386/pr96793.c: New test.

  parent reply	other threads:[~2020-12-23  8:20 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-26  9:10 [Bug c/96793] New: " chfast at gmail dot com
2020-08-26  9:11 ` [Bug c/96793] " chfast at gmail dot com
2020-08-26  9:11 ` chfast at gmail dot com
2020-08-26  9:12 ` chfast at gmail dot com
2020-08-26  9:21 ` chfast at gmail dot com
2020-08-26 10:46 ` [Bug target/96793] " rguenth at gcc dot gnu.org
2020-08-26 11:17 ` ubizjak at gmail dot com
2020-08-28  7:26 ` ubizjak at gmail dot com
2020-08-28  7:26 ` ubizjak at gmail dot com
2020-08-28  8:58 ` chfast at gmail dot com
2020-08-28  9:00 ` ubizjak at gmail dot com
2020-08-28  9:40 ` rguenth at gcc dot gnu.org
2020-08-28  9:48 ` ubizjak at gmail dot com
2020-08-28  9:54 ` ubizjak at gmail dot com
2020-08-28 11:31 ` glisse at gcc dot gnu.org
2020-08-28 12:20 ` glisse at gcc dot gnu.org
2020-08-28 14:06 ` chfast at gmail dot com
2020-08-28 14:31 ` chfast at gmail dot com
2020-08-28 14:37 ` ubizjak at gmail dot com
2020-12-22 12:17 ` ubizjak at gmail dot com
2020-12-22 17:20 ` ubizjak at gmail dot com
2020-12-22 20:13 ` ubizjak at gmail dot com
2020-12-23  8:20 ` ubizjak at gmail dot com [this message]
2020-12-23  8:21 ` ubizjak at gmail dot com
2020-12-23  8:21 ` ubizjak at gmail dot com

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=bug-96793-4-xzJYg0S4G4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).