As I add support for making -mabi=ieeelongdouble default, I noticed some issues
in building libstdc++ with the default for the code that supports the
-mlong-double-64 option.  These tests add checks for -mlong-double-128 before
considering whether TFmode/TCmode are IEEE or IBM extended double.

I went into the two primary macros (FLOAT128_{IBM,IEEE}_P) and added the
checks.  I also looked at all of the TFmode/TCmode support in rs6000.c and I
found one case where it wasn't checking the long double size first.

I have done a bootstrap and regression test with this patch on a little endian
power8 system.  I previously did a bootstrap wtih the original patch (which
includes the rs6000.h change and a similar change to rs6000.c) to add long
double configuration and multilib on a big endian power8 system.  In both
cases, there was no regression.  Can I install this patch into the trunk?

2018-01-10  Michael Meissner  <meiss...@linux.vnet.ibm.com>

        * config/rs6000/rs6000.c (is_complex_IBM_long_double): Explicitly
        check for 128-bit long double before checking TCmode.
        * config/rs6000/rs6000.h (FLOAT128_IEEE_P): Explicitly check for
        128-bit long doubles before checking TFmode or TCmode.
        (FLOAT128_IBM_P): Likewise.

-- 
Michael Meissner, IBM
IBM, M/S 2506R, 550 King Street, Littleton, MA 01460-6245, USA
email: meiss...@linux.vnet.ibm.com, phone: +1 (978) 899-4797
Index: gcc/config/rs6000/rs6000.c
===================================================================
--- gcc/config/rs6000/rs6000.c  (revision 256355)
+++ gcc/config/rs6000/rs6000.c  (working copy)
@@ -11429,7 +11429,7 @@ rs6000_must_pass_in_stack (machine_mode
 static inline bool
 is_complex_IBM_long_double (machine_mode mode)
 {
-  return mode == ICmode || (!TARGET_IEEEQUAD && mode == TCmode);
+  return mode == ICmode || (mode == TCmode && FLOAT128_IBM_P (TCmode));
 }
 
 /* Whether ABI_V4 passes MODE args to a function in floating point
Index: gcc/config/rs6000/rs6000.h
===================================================================
--- gcc/config/rs6000/rs6000.h  (revision 256355)
+++ gcc/config/rs6000/rs6000.h  (working copy)
@@ -437,11 +437,13 @@ extern const char *host_detect_local_cpu
    Similarly IFmode is the IBM long double format even if the default is IEEE
    128-bit.  Don't allow IFmode if -msoft-float.  */
 #define FLOAT128_IEEE_P(MODE)                                          \
-  ((TARGET_IEEEQUAD && ((MODE) == TFmode || (MODE) == TCmode))         \
+  ((TARGET_IEEEQUAD && TARGET_LONG_DOUBLE_128                          \
+    && ((MODE) == TFmode || (MODE) == TCmode))                         \
    || ((MODE) == KFmode) || ((MODE) == KCmode))
 
 #define FLOAT128_IBM_P(MODE)                                           \
-  ((!TARGET_IEEEQUAD && ((MODE) == TFmode || (MODE) == TCmode))                
\
+  ((!TARGET_IEEEQUAD && TARGET_LONG_DOUBLE_128                         \
+    && ((MODE) == TFmode || (MODE) == TCmode))                         \
    || (TARGET_HARD_FLOAT && ((MODE) == IFmode || (MODE) == ICmode)))
 
 /* Helper macros to say whether a 128-bit floating point type can go in a

Reply via email to