[gcc(refs/users/meissner/heads/work028)] PowerPC: Set long double size for IBM/IEEE.

Michael Meissner meissner@gcc.gnu.org
Tue Nov 17 17:40:19 GMT 2020


https://gcc.gnu.org/g:2916873a847d40568815de0a212bf44dba0e076e

commit 2916873a847d40568815de0a212bf44dba0e076e
Author: Michael Meissner <meissner@linux.ibm.com>
Date:   Tue Nov 17 12:39:18 2020 -0500

    PowerPC: Set long double size for IBM/IEEE.
    
    As I was working with compilers where the long double default was 64-bit, it
    became annoying to have to use two options to switch to one of the 128-bit long
    double types (i.e. you need both -mlong-double-128 and the
    -mabi={ieee,ibm}longdouble to switch the long double type).
    
    I did this patch so that if you explicitly set the long double ABI via the
    -mabi= option, it would automatically set the long double size if that was not
    set explicitly.
    
    gcc/
    2020-11-17  Michael Meissner  <meissner@linux.ibm.com>
    
            * config/rs6000/rs6000.c (rs6000_option_override_internal): If the
            user explicitly used -mabi=ieeelongdouble or -mabi=ibmlongdouble,
            set the long double size to 128.
            * doc/invoke.texi (PowerPC options): Document that an explicit
            -mabi=ieeelongdouble or -mabi=ibmlongdouble implicitly sets
            -mlong-double-128.

Diff:
---
 gcc/config/rs6000/rs6000.c | 9 +++++++--
 gcc/doc/invoke.texi        | 7 ++++---
 2 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c
index 35e9c844e17..6edd17a0b69 100644
--- a/gcc/config/rs6000/rs6000.c
+++ b/gcc/config/rs6000/rs6000.c
@@ -4131,8 +4131,13 @@ rs6000_option_override_internal (bool global_init_p)
 
   /* Use long double size to select the appropriate long double.  We use
      TYPE_PRECISION to differentiate the 3 different long double types.  We map
-     128 into the precision used for TFmode.  */
-  int default_long_double_size = (RS6000_DEFAULT_LONG_DOUBLE_SIZE == 64
+     128 into the precision used for TFmode.
+
+     If the user explicitly used -mabi=ieeelongdouble or -mabi=ibmlongdouble,
+     but the compiler was configured for default 64-bit long doubles, set the
+     long double to be 128.  */
+  int default_long_double_size = ((RS6000_DEFAULT_LONG_DOUBLE_SIZE == 64
+				   && !global_options_set.x_rs6000_ieeequad)
 				  ? 64
 				  : FLOAT_PRECISION_TFmode);
 
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index 3510a54c6c4..89d530f1d1e 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -27113,7 +27113,8 @@ Change the current ABI to use IBM extended-precision long double.
 This is not likely to work if your system defaults to using IEEE
 extended-precision long double.  If you change the long double type
 from IEEE extended-precision, the compiler will issue a warning unless
-you use the @option{-Wno-psabi} option.  Requires @option{-mlong-double-128}
+you use the @option{-Wno-psabi} option.  If this option is used, it
+will implicitly enable @option{-mlong-double-128}.
 to be enabled.
 
 @item -mabi=ieeelongdouble
@@ -27122,8 +27123,8 @@ Change the current ABI to use IEEE extended-precision long double.
 This is not likely to work if your system defaults to using IBM
 extended-precision long double.  If you change the long double type
 from IBM extended-precision, the compiler will issue a warning unless
-you use the @option{-Wno-psabi} option.  Requires @option{-mlong-double-128}
-to be enabled.
+you use the @option{-Wno-psabi} option.  If this option is used, it
+will implicitly enable @option{-mlong-double-128}.
 
 @item -mabi=elfv1
 @opindex mabi=elfv1


More information about the Gcc-cvs mailing list