From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id A38CE3898522; Thu, 8 Jul 2021 21:25:49 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A38CE3898522 From: "patrick.mcgehearty at oracle dot com" 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 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: testsuite X-Bugzilla-Version: 12.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: patrick.mcgehearty at oracle dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: cc Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Jul 2021 21:25:49 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D101104 Patrick McGehearty changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |patrick.mcgehearty at orac= le dot c | |om --- Comment #1 from Patrick McGehearty --- I identified the root cause as not fully understanding the IBM native forma= t. 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 RMINSCA= L=3D 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 bec= ause DF and KF mode use the same number of bits for the exponent, allowing MAX a= nd 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= .=20 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)=