public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "patrick.mcgehearty at oracle dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug testsuite/101104] test case gcc.c-torture/execute/ieee/cdivchkld.c fails
Date: Thu, 08 Jul 2021 21:25:49 +0000	[thread overview]
Message-ID: <bug-101104-4-vFutCP1Wn7@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-101104-4@http.gcc.gnu.org/bugzilla/>

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

Patrick McGehearty <patrick.mcgehearty at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |patrick.mcgehearty at oracle dot c
                   |                            |om

--- Comment #1 from Patrick McGehearty <patrick.mcgehearty at oracle dot com> ---
I identified the root cause as not fully understanding the IBM native format.
The gcc internal representation uses KF mode for IBM 128-bit floating point. It
uses
DF mode for all 64-bit floating point.

When KF mode is used, the value for LDBL_EPSILON is 0x1.0p-1074 and RMINSCAL=
1/LDBL_EPSILON is infinity. Then all input values which trigger scaling
will overflow to infinity which of course fails the test.

Switching the constants to use DF instead of KF resolves the overflow issue
without significantly changing the usefulness of the new method. That's because
DF and KF mode use the same number of bits for the exponent, allowing MAX and
MIN to be nearly identical.

The patch is being submitted to gcc-patches@gcc.gnu.org now.

The fix only requires changes to one file:
libgcc/config/rs6000/_divkc3.c

diff --git a/libgcc/config/rs6000/_divkc3.c b/libgcc/config/rs6000/_divkc3.c
index a1d29d2..2b229c8 100644
--- a/libgcc/config/rs6000/_divkc3.c
+++ b/libgcc/config/rs6000/_divkc3.c
@@ -38,10 +38,10 @@ see the files COPYING3 and COPYING.RUNTIME respectively. 
If
not, see
 #endif

 #ifndef __LONG_DOUBLE_IEEE128__
-#define RBIG   (__LIBGCC_KF_MAX__ / 2)
-#define RMIN   (__LIBGCC_KF_MIN__)
-#define RMIN2  (__LIBGCC_KF_EPSILON__)
-#define RMINSCAL (1 / __LIBGCC_KF_EPSILON__)
+#define RBIG   (__LIBGCC_DF_MAX__ / 2)
+#define RMIN   (__LIBGCC_DF_MIN__)
+#define RMIN2  (__LIBGCC_DF_EPSILON__)
+#define RMINSCAL (1 / __LIBGCC_DF_EPSILON__)
 #define RMAX2  (RBIG * RMIN2)
 #else
 #define RBIG   (__LIBGCC_TF_MAX__ / 2)

  reply	other threads:[~2021-07-08 21:25 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-16 22:00 [Bug testsuite/101104] New: test case g++.dg/tsan/pthread_cond_clockwait.C fails seurer at gcc dot gnu.org
2021-07-08 21:25 ` patrick.mcgehearty at oracle dot com [this message]
2021-07-20 22:46 ` [Bug target/101104] test case gcc.c-torture/execute/ieee/cdivchkld.c fails segher at gcc dot gnu.org
2021-07-30 16:32 ` patrick.mcgehearty at oracle dot com
2021-09-28 18:28 ` bergner at gcc dot gnu.org
2021-09-29 18:13 ` patrick.mcgehearty at oracle dot com
2021-09-29 19:04 ` bergner at gcc dot gnu.org
2021-09-29 21:46 ` bergner at gcc dot gnu.org
2021-09-29 23:40 ` patrick.mcgehearty at oracle dot com
2021-09-30  0:53 ` bergner at gcc dot gnu.org
2021-10-03 22:07 ` cvs-commit at gcc dot gnu.org
2021-10-05 22:48 ` bergner at gcc dot gnu.org
2021-10-06 16:32 ` segher at gcc dot gnu.org
2021-10-06 17:21 ` patrick.mcgehearty at oracle dot com
2021-10-06 18:56 ` segher 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-101104-4-vFutCP1Wn7@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).