public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r11-4557] PowerPC: Adjust float128/ibm128 warnings.
@ 2020-10-30 2:19 Michael Meissner
0 siblings, 0 replies; only message in thread
From: Michael Meissner @ 2020-10-30 2:19 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:228156e84966963a318c2c09dc15aed887e8eb0f
commit r11-4557-g228156e84966963a318c2c09dc15aed887e8eb0f
Author: Michael Meissner <meissner@linux.ibm.com>
Date: Thu Oct 29 22:15:10 2020 -0400
PowerPC: Adjust float128/ibm128 warnings.
This patch ccombines two patches:
1) If GLIBC is 2.32 or newer, and the language is C or C++, allow the user to
change the long double type without having to use -Wno-psabi.
2) Adjust the warnings for intermixing __float128 and __ibm128 to accomidate
the future change to allow long double to use the IEEE 128-bit format.
gcc/
2020-10-29 Michael Meissner <meissner@linux.ibm.com>
* config/rs6000/rs6000.c (rs6000_option_override_internal): Allow
long double type to be changed for C/C++ if glibc 2.32 or newer.
(rs6000_invalid_binary_op): Update error messages about mixing IBM
long double and IEEE 128-bit.
gcc/testsuite/
2020-10-27 Michael Meissner <meissner@linux.ibm.com>
* gcc.target/powerpc/float128-mix-2.c: New test.
* gcc.target/powerpc/float128-mix-3.c: New test.
* gcc.target/powerpc/float128-mix.c: Update failure messages.
Diff:
---
gcc/config/rs6000/rs6000.c | 29 ++++++++++-------------
gcc/testsuite/gcc.target/powerpc/float128-mix-2.c | 16 +++++++++++++
gcc/testsuite/gcc.target/powerpc/float128-mix-3.c | 16 +++++++++++++
gcc/testsuite/gcc.target/powerpc/float128-mix.c | 20 +++++++++-------
4 files changed, 55 insertions(+), 26 deletions(-)
diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c
index 4d528a39a37..bcd4c4a82b3 100644
--- a/gcc/config/rs6000/rs6000.c
+++ b/gcc/config/rs6000/rs6000.c
@@ -4158,8 +4158,15 @@ rs6000_option_override_internal (bool global_init_p)
if (rs6000_ieeequad != TARGET_IEEEQUAD_DEFAULT && TARGET_LONG_DOUBLE_128)
{
+ /* Determine if the user can change the default long double type at
+ compilation time. Only C and C++ support this, and you need GLIBC
+ 2.32 or newer. Only issue one warning. */
static bool warned_change_long_double;
- if (!warned_change_long_double)
+
+ if (!warned_change_long_double
+ && (!OPTION_GLIBC
+ || (!lang_GNU_C () && !lang_GNU_CXX ())
+ || ((TARGET_GLIBC_MAJOR * 1000) + TARGET_GLIBC_MINOR) < 2032))
{
warned_change_long_double = true;
if (TARGET_IEEEQUAD)
@@ -14392,22 +14399,10 @@ rs6000_invalid_binary_op (int op ATTRIBUTE_UNUSED,
if (!TARGET_FLOAT128_CVT)
{
- if ((mode1 == KFmode && mode2 == IFmode)
- || (mode1 == IFmode && mode2 == KFmode))
- return N_("__float128 and __ibm128 cannot be used in the same "
- "expression");
-
- if (TARGET_IEEEQUAD
- && ((mode1 == IFmode && mode2 == TFmode)
- || (mode1 == TFmode && mode2 == IFmode)))
- return N_("__ibm128 and long double cannot be used in the same "
- "expression");
-
- if (!TARGET_IEEEQUAD
- && ((mode1 == KFmode && mode2 == TFmode)
- || (mode1 == TFmode && mode2 == KFmode)))
- return N_("__float128 and long double cannot be used in the same "
- "expression");
+ if ((FLOAT128_IEEE_P (mode1) && FLOAT128_IBM_P (mode2))
+ || (FLOAT128_IBM_P (mode1) && FLOAT128_IEEE_P (mode2)))
+ return N_("Invalid mixing of IEEE 128-bit and IBM 128-bit floating "
+ "point types");
}
return NULL;
diff --git a/gcc/testsuite/gcc.target/powerpc/float128-mix-2.c b/gcc/testsuite/gcc.target/powerpc/float128-mix-2.c
new file mode 100644
index 00000000000..61227132c20
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/float128-mix-2.c
@@ -0,0 +1,16 @@
+/* { dg-require-effective-target ppc_float128_sw } */
+/* { dg-options "-O2 -mvsx -Wno-psabi -mabi=ieeelongdouble -mlong-double-128" } */
+
+/* Test to make sure that __float128 and long double do not generate errors if
+ long double uses the IEEE 128-bit format. */
+__float128
+add (__float128 a, long double b)
+{
+ return a+b;
+}
+
+long double
+sub (long double a, __float128 b)
+{
+ return a-b;
+}
diff --git a/gcc/testsuite/gcc.target/powerpc/float128-mix-3.c b/gcc/testsuite/gcc.target/powerpc/float128-mix-3.c
new file mode 100644
index 00000000000..a2582bb1035
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/float128-mix-3.c
@@ -0,0 +1,16 @@
+/* { dg-require-effective-target ppc_float128_sw } */
+/* { dg-options "-O2 -mvsx -Wno-psabi -mabi=ibmlongdouble -mlong-double-128" } */
+
+/* Test to make sure that __float128 and __ibm128 cannot be combined
+ together. */
+__float128
+add (__float128 a, __ibm128 b)
+{
+ return a+b; /* { dg-error "IEEE 128-bit and IBM 128-bit floating point" } */
+}
+
+__ibm128
+sub (__ibm128 a, __float128 b)
+{
+ return a-b; /* { dg-error "IEEE 128-bit and IBM 128-bit floating point" } */
+}
diff --git a/gcc/testsuite/gcc.target/powerpc/float128-mix.c b/gcc/testsuite/gcc.target/powerpc/float128-mix.c
index 71f840c9490..48e651cdba0 100644
--- a/gcc/testsuite/gcc.target/powerpc/float128-mix.c
+++ b/gcc/testsuite/gcc.target/powerpc/float128-mix.c
@@ -1,15 +1,17 @@
-/* { dg-do compile { target { powerpc*-*-linux* } } } */
-/* { dg-require-effective-target powerpc_vsx_ok } */
-/* { dg-options "-O2 -mvsx" } */
+/* { dg-require-effective-target ppc_float128_sw } */
+/* { dg-options "-O2 -mvsx -Wno-psabi -mabi=ibmlongdouble -mlong-double-128" } */
-
-/* Test to make sure that __float128 and long double cannot be combined together. */
-__float128 add (__float128 a, long double b)
+/* Test to make sure that __float128 and long double cannot be combined
+ together, when long double uses the IBM extended double format, and
+ __float128 uses the IEEE 128-bit format. */
+__float128
+add (__float128 a, long double b)
{
- return a+b; /* { dg-error "__float128 and long double cannot be used in the same expression" } */
+ return a+b; /* { dg-error "IEEE 128-bit and IBM 128-bit floating point" } */
}
-__ibm128 sub (long double a, __float128 b)
+long double
+sub (long double a, __float128 b)
{
- return a-b; /* { dg-error "__float128 and long double cannot be used in the same expression" } */
+ return a-b; /* { dg-error "IEEE 128-bit and IBM 128-bit floating point" } */
}
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2020-10-30 2:19 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-30 2:19 [gcc r11-4557] PowerPC: Adjust float128/ibm128 warnings 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).