public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc(refs/users/meissner/heads/work018)] PowerPC: Fix tests to work with IEEE 128-bit long double.
@ 2020-09-18 18:17 Michael Meissner
0 siblings, 0 replies; only message in thread
From: Michael Meissner @ 2020-09-18 18:17 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:b08f25052e1717f4bfa351d8e0bb4bba8bb22a7a
commit b08f25052e1717f4bfa351d8e0bb4bba8bb22a7a
Author: Michael Meissner <meissner@linux.ibm.com>
Date: Fri Sep 18 14:16:27 2020 -0400
PowerPC: Fix tests to work with IEEE 128-bit long double.
gcc/testsuite/
2020-09-18 Michael Meissner <meissner@linux.ibm.com>
* c-c++-common/dfp/convert-bfp-11.c: If long double is IEEE
128-bit, skip the test.
* gcc.dg/nextafter-2.c: On PowerPC, if long double is IEEE
128-bit, include math.h to get the built-in mapped correctly.
* gcc.target/powerpc/pr70117.c: Add support for long double being
IEEE 128-bit.
Diff:
---
gcc/testsuite/c-c++-common/dfp/convert-bfp-11.c | 7 +++++++
gcc/testsuite/gcc.dg/nextafter-2.c | 10 ++++++++++
gcc/testsuite/gcc.target/powerpc/pr70117.c | 6 ++++--
3 files changed, 21 insertions(+), 2 deletions(-)
diff --git a/gcc/testsuite/c-c++-common/dfp/convert-bfp-11.c b/gcc/testsuite/c-c++-common/dfp/convert-bfp-11.c
index 95c433d2c24..6ee0c1c6ae9 100644
--- a/gcc/testsuite/c-c++-common/dfp/convert-bfp-11.c
+++ b/gcc/testsuite/c-c++-common/dfp/convert-bfp-11.c
@@ -5,6 +5,7 @@
Don't force 128-bit long doubles because runtime support depends
on glibc. */
+#include <float.h>
#include "convert.h"
volatile _Decimal32 sd;
@@ -39,6 +40,12 @@ main ()
if (sizeof (long double) != 16)
return 0;
+ /* This test is written to test IBM extended double, which is a pair of
+ doubles. If long double can hold a larger value than a double can, such
+ as when long double is IEEE 128-bit, just exit immediately. */
+ if (LDBL_MAX_10_EXP > DBL_MAX_10_EXP)
+ return 0;
+
convert_101 ();
convert_102 ();
diff --git a/gcc/testsuite/gcc.dg/nextafter-2.c b/gcc/testsuite/gcc.dg/nextafter-2.c
index e51ae94be0c..64e9e3c485f 100644
--- a/gcc/testsuite/gcc.dg/nextafter-2.c
+++ b/gcc/testsuite/gcc.dg/nextafter-2.c
@@ -13,4 +13,14 @@
# define NO_LONG_DOUBLE 1
# endif
#endif
+
+#if defined(_ARCH_PPC) && defined(__LONG_DOUBLE_IEEE128__)
+/* On PowerPC systems, long double uses either the IBM long double format, or
+ IEEE 128-bit format. The compiler switches the long double built-in
+ function names and glibc switches the names when math.h is included.
+ Because this test is run with -fno-builtin, include math.h so that the
+ appropriate nextafter functions are called. */
+#include <math.h>
+#endif
+
#include "nextafter-1.c"
diff --git a/gcc/testsuite/gcc.target/powerpc/pr70117.c b/gcc/testsuite/gcc.target/powerpc/pr70117.c
index 3bbd2c595e0..928efe39c7b 100644
--- a/gcc/testsuite/gcc.target/powerpc/pr70117.c
+++ b/gcc/testsuite/gcc.target/powerpc/pr70117.c
@@ -9,9 +9,11 @@
128-bit floating point, because the type is not enabled on those
systems. */
#define LDOUBLE __ibm128
+#define IBM128_MAX ((__ibm128) 1.79769313486231580793728971405301199e+308L)
#elif defined(__LONG_DOUBLE_IBM128__)
#define LDOUBLE long double
+#define IBM128_MAX LDBL_MAX
#else
#error "long double must be either IBM 128-bit or IEEE 128-bit"
@@ -75,10 +77,10 @@ main (void)
if (__builtin_isnormal (ld))
__builtin_abort ();
- ld = LDBL_MAX;
+ ld = IBM128_MAX;
if (!__builtin_isnormal (ld))
__builtin_abort ();
- ld = -LDBL_MAX;
+ ld = -IBM128_MAX;
if (!__builtin_isnormal (ld))
__builtin_abort ();
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2020-09-18 18:17 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-18 18:17 [gcc(refs/users/meissner/heads/work018)] PowerPC: Fix tests to work with IEEE 128-bit long double Michael Meissner
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).