public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "rguenth at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug middle-end/95115] RISC-V 64: inf/inf division optimized out, invalid operation not raised
Date: Thu, 14 May 2020 06:33:11 +0000	[thread overview]
Message-ID: <bug-95115-4-bh1cWKjXCU@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-95115-4@http.gcc.gnu.org/bugzilla/>

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |wrong-code
             Target|riscv64-unknown-linux-gnu   |
            Summary|[10 Regression] RISC-V 64:  |RISC-V 64: inf/inf division
                   |inf/inf division optimized  |optimized out, invalid
                   |out, invalid operation not  |operation not raised
                   |raised                      |
   Last reconfirmed|                            |2020-05-14
     Ever confirmed|0                           |1
          Component|target                      |middle-end
              Build|riscv64-unknown-linux-gnu   |
               Host|riscv64-unknown-linux-gnu   |
             Status|UNCONFIRMED                 |NEW

--- Comment #6 from Richard Biener <rguenth at gcc dot gnu.org> ---
(simplify
 (rdiv @0 @0)
 (if (FLOAT_TYPE_P (type)
      && ! HONOR_NANS (type)
      && ! HONOR_INFINITIES (type))
  { build_one_cst (type); }))

so that's not it, possibly constant folding instead in const_binop.
There we only have

1276          /* Don't perform operation if we honor signaling NaNs and
1277             either operand is a signaling NaN.  */
1278          if (HONOR_SNANS (mode)
1279              && (REAL_VALUE_ISSIGNALING_NAN (d1)
1280                  || REAL_VALUE_ISSIGNALING_NAN (d2)))
1281            return NULL_TREE;

and

1283          /* Don't perform operation if it would raise a division
(gdb) 
1284             by zero exception.  */
1285          if (code == RDIV_EXPR
1286              && real_equal (&d2, &dconst0)
1287              && (flag_trapping_math || ! MODE_HAS_INFINITIES (mode)))
1288            return NULL_TREE;

which both don't trigger.  Afterwards

1309          inexact = real_arithmetic (&value, code, &d1, &d2);

even returns false and the result is a qNaN.

For the specific regression in this bug we now simply are able to
turn

    return u.x/v.x;

into a division of two constants.  That's nothing we're going to "fix",
so we have to fix the above instead which is a much older issue.

  parent reply	other threads:[~2020-05-14  6:33 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-13 20:08 [Bug target/95115] New: [10 Regression] " aurelien at aurel32 dot net
2020-05-13 20:45 ` [Bug target/95115] " glisse at gcc dot gnu.org
2020-05-13 20:58 ` glisse at gcc dot gnu.org
2020-05-14  3:51 ` wilson at gcc dot gnu.org
2020-05-14  5:33 ` glisse at gcc dot gnu.org
2020-05-14  6:05 ` aurelien at aurel32 dot net
2020-05-14  6:33 ` rguenth at gcc dot gnu.org [this message]
2020-07-02 19:52 ` [Bug middle-end/95115] " vgupta at synopsys dot com
2022-01-30 16:44 ` xry111 at mengyan1223 dot wang
2022-02-01 10:21 ` cvs-commit at gcc dot gnu.org
2022-02-02  5:19 ` cvs-commit at gcc dot gnu.org
2022-02-02  9:25 ` cvs-commit at gcc dot gnu.org
2022-02-02 14:06 ` xry111 at mengyan1223 dot wang
2022-02-02 22:32 ` pinskia at gcc dot gnu.org

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-95115-4-bh1cWKjXCU@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).