public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/95115] New: [10 Regression] RISC-V 64: inf/inf division optimized out, invalid operation not raised
@ 2020-05-13 20:08 aurelien at aurel32 dot net
  2020-05-13 20:45 ` [Bug target/95115] " glisse at gcc dot gnu.org
                   ` (12 more replies)
  0 siblings, 13 replies; 14+ messages in thread
From: aurelien at aurel32 dot net @ 2020-05-13 20:08 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 95115
           Summary: [10 Regression] RISC-V 64: inf/inf division optimized
                    out, invalid operation not raised
           Product: gcc
           Version: 10.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: aurelien at aurel32 dot net
  Target Milestone: ---
              Host: riscv64-unknown-linux-gnu
            Target: riscv64-unknown-linux-gnu
             Build: riscv64-unknown-linux-gnu

Created attachment 48525
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=48525&action=edit
Testcase

On 64-bit RISC-V, the acos/asin tests from the glibc testsuite fails when it is
built with GCC 10, as the invalid operation flag is not raised for invalid
input values. The glibc code uses the following code to generate a NaN and
raise an invalid input [1]:

  else {
    u.i[HIGH_HALF]=0x7ff00000;
    v.i[HIGH_HALF]=0x7ff00000;
    u.i[LOW_HALF]=0;
    v.i[LOW_HALF]=0;
    return u.x/v.x;
  }

With GCC 9, this results in the following code:
        li      a1,2047
        slli    a1,a1,52
        fmv.d.x fa5,a1
        li      a0,16
        fdiv.d  fs0,fa5,fa5

With GCC 10, the division is optimized out and the result is directly loaded as
a constant, causing the invalid operation not to be raised.

I have attached a small testcase to reproduce the issue.

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2022-02-02 22:32 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-13 20:08 [Bug target/95115] New: [10 Regression] RISC-V 64: inf/inf division optimized out, invalid operation not raised 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 ` [Bug middle-end/95115] " rguenth at gcc dot gnu.org
2020-07-02 19:52 ` 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

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).