]> gcc.gnu.org Git - gcc.git/commitdiff
rs6000: Allow -mlong-double-64 after -mabi={ibm,ieee}longdouble [PR104208, PR87496]
authorPeter Bergner <bergner@linux.ibm.com>
Fri, 4 Mar 2022 15:03:44 +0000 (09:03 -0600)
committerPeter Bergner <bergner@linux.ibm.com>
Fri, 4 Mar 2022 15:04:21 +0000 (09:04 -0600)
The glibc build is showing a build error due to extra "error" checking from my
PR87496 fix.  That checking was overeager, disallowing setting the long double
size to 64-bits if the 128-bit long double ABI had already been specified.
Now we only emit an error if we specify a 128-bit long double ABI if our
long double size is not 128 bits.  This also fixes an erroneous error when
-mabi=ieeelongdouble is used and ISA 2.06 is not enabled, but the long double
size has been changed to 64 bits.

2022-03-04  Peter Bergner  <bergner@linux.ibm.com>

gcc/
PR target/87496
PR target/104208
* config/rs6000/rs6000.cc (rs6000_option_override_internal): Make the
ISA 2.06 requirement for -mabi=ieeelongdouble conditional on
-mlong-double-128.
Move the -mabi=ieeelongdouble and -mabi=ibmlongdouble error checking
from here...
* common/config/rs6000/rs6000-common.cc (rs6000_handle_option):
... to here.

gcc/testsuite/
PR target/87496
PR target/104208
* gcc.target/powerpc/pr104208-1.c: New test.
* gcc.target/powerpc/pr104208-2.c: Likewise.
* gcc.target/powerpc/pr87496-2.c: Swap long double options to trigger
the expected error.
* gcc.target/powerpc/pr87496-3.c: Likewise.

gcc/common/config/rs6000/rs6000-common.cc
gcc/config/rs6000/rs6000.cc
gcc/testsuite/gcc.target/powerpc/pr104208-1.c [new file with mode: 0644]
gcc/testsuite/gcc.target/powerpc/pr104208-2.c [new file with mode: 0644]
gcc/testsuite/gcc.target/powerpc/pr87496-2.c
gcc/testsuite/gcc.target/powerpc/pr87496-3.c

index 97dff3a13c1789420c8af085e6b3ef83e76cff6e..8e393d08a23d735f1d761475e00191360d517b21 100644 (file)
@@ -227,6 +227,16 @@ rs6000_handle_option (struct gcc_options *opts, struct gcc_options *opts_set,
        }
       break;
 
+    case OPT_mabi_ibmlongdouble:
+    case OPT_mabi_ieeelongdouble:
+      if (opts->x_rs6000_long_double_type_size == 64)
+       {
+         error_at (loc, "option %<%s%> requires %<-mlong-double-128%>",
+                   decoded->orig_option_with_args_text);
+         return true;
+       }
+      break;
+
     case OPT_mrecip:
       opts->x_rs6000_recip_name = (value) ? "default" : "none";
       break;
index a855e8c4c72aa6343a24931daf34db60d70a4681..5b100a8f2fbecaab785775c0cd8adf279c8225d2 100644 (file)
@@ -4178,13 +4178,6 @@ rs6000_option_override_internal (bool global_init_p)
     ; /* The option value can be seen when cl_target_option_restore is called.  */
   else if (rs6000_long_double_type_size == 128)
     rs6000_long_double_type_size = FLOAT_PRECISION_TFmode;
-  else if (OPTION_SET_P (rs6000_ieeequad))
-    {
-      if (global_options.x_rs6000_ieeequad)
-       error ("%qs requires %qs", "-mabi=ieeelongdouble", "-mlong-double-128");
-      else
-       error ("%qs requires %qs", "-mabi=ibmlongdouble", "-mlong-double-128");
-    }
 
   /* Set -mabi=ieeelongdouble on some old targets.  In the future, power server
      systems will also set long double to be IEEE 128-bit.  AIX and Darwin
@@ -4194,13 +4187,13 @@ rs6000_option_override_internal (bool global_init_p)
   if (!OPTION_SET_P (rs6000_ieeequad))
     rs6000_ieeequad = TARGET_IEEEQUAD_DEFAULT;
 
-  else
+  else if (TARGET_LONG_DOUBLE_128)
     {
       if (global_options.x_rs6000_ieeequad
          && (!TARGET_POPCNTD || !TARGET_VSX))
        error ("%qs requires full ISA 2.06 support", "-mabi=ieeelongdouble");
 
-      if (rs6000_ieeequad != TARGET_IEEEQUAD_DEFAULT && TARGET_LONG_DOUBLE_128)
+      if (rs6000_ieeequad != TARGET_IEEEQUAD_DEFAULT)
        {
          /* Determine if the user can change the default long double type at
             compilation time.  You need GLIBC 2.32 or newer to be able to
diff --git a/gcc/testsuite/gcc.target/powerpc/pr104208-1.c b/gcc/testsuite/gcc.target/powerpc/pr104208-1.c
new file mode 100644 (file)
index 0000000..39d4602
--- /dev/null
@@ -0,0 +1,9 @@
+/* PR target/104208 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -mlong-double-128 -mabi=ibmlongdouble -mlong-double-64 -Wno-psabi" } */
+
+/* Verify we do not emit an error with the options above.  It is allowed
+   to reset the long double size to 64-bits after a 128-bit long double
+   ABI has been selected.  */
+
+int i;
diff --git a/gcc/testsuite/gcc.target/powerpc/pr104208-2.c b/gcc/testsuite/gcc.target/powerpc/pr104208-2.c
new file mode 100644 (file)
index 0000000..4e8ab5b
--- /dev/null
@@ -0,0 +1,10 @@
+/* PR target/104208 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -mlong-double-128 -mabi=ieeelongdouble -mlong-double-64 -mno-vsx -Wno-psabi" } */
+
+/* Verify we do not emit an error with the options above.  IEEE 128-bit
+   long double requires VSX, so using -mno-vsx would normally generate
+   an error.  However, if we have changed to a 64-bit long double, then
+   we should allow it.  */
+
+int i;
index 26c07ebb9007afd6b9298559501c4784cfd5ddd4..f9dc6426418d7f07f7e1877231526f34f12328ce 100644 (file)
@@ -1,7 +1,7 @@
 /* PR target/87496 */
 /* { dg-do compile { target { powerpc*-*-* } } } */
 /* { dg-skip-if "" { powerpc*-*-darwin* } } */
-/* { dg-options "-O2 -mdejagnu-cpu=power7 -mabi=ieeelongdouble -mlong-double-64 -Wno-psabi" } */
+/* { dg-options "-O2 -mdejagnu-cpu=power7 -mlong-double-64 -mabi=ieeelongdouble -Wno-psabi" } */
 
 int i;
 
index 1be39975f64ab1b3ccb1ec5a697fe5fe9d4541a4..39fb73cbb32364ccc9f24aea8ce0657fbaa68977 100644 (file)
@@ -1,7 +1,7 @@
 /* PR target/87496 */
 /* { dg-do compile { target { powerpc*-*-* } } } */
 /* { dg-skip-if "" { powerpc*-*-darwin* } } */
-/* { dg-options "-O2 -mabi=ibmlongdouble -mlong-double-64 -Wno-psabi" } */
+/* { dg-options "-O2 -mlong-double-64 -mabi=ibmlongdouble -Wno-psabi" } */
 
 int i;
 
This page took 0.109007 seconds and 5 git commands to generate.