public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc(refs/users/meissner/heads/work077)] Use default long double from host compiler if not specified on PowerPC.
@ 2022-02-02 18:32 Michael Meissner
  0 siblings, 0 replies; 5+ messages in thread
From: Michael Meissner @ 2022-02-02 18:32 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:49866ad94104c3c0b8c31df18dbe58c0aa9874c9

commit 49866ad94104c3c0b8c31df18dbe58c0aa9874c9
Author: Michael Meissner <meissner@linux.ibm.com>
Date:   Wed Feb 2 13:32:02 2022 -0500

    Use default long double from host compiler if not specified on PowerPC.
    
    If the user did not specify a default long double format, set the long
    double type to IEEE 128-bit if the host compiler uses IEEE 128-bit as the
    long double default.
    
    I used a Fedora rawhide system that was configured to use the default for
    long double being IEEE 128-bit.  I built and bootstrapped a compiler on
    this system with these patches applied, and I verified that the default
    for the compiler used IEEE 128-bit long doubles.
    
    Can I apply this patch to the trunk for GCC 12?  Ideally, this should be
    back-ported to GCC 11 as well.
    
    2022-02-02  Michael Meissner  <meissner@the-meissners.org>
    
    gcc/
            * config.in (TARGET_POWERPC_IEEE_128BIT_LONG_DOUBLE): New
            configure option.
            * config/rs6000/rs6000.cc (TARGET_IEEEQUAD_DEFAULT): If the host
            compiler used IEEE 128-bit long doubles and the long double format
            was not specified with configuration switches, set the long double
            format to IEEE 128-bit.
            * configure.ac (TARGET_POWERPC_IEEE_128BIT_LONG_DOUBLE): Set as 1
            if the host compiler used IEEE 128-bit long doubles.
            * configure: Regenerate.

Diff:
---
 gcc/config.in               |  5 +++++
 gcc/config/rs6000/rs6000.cc |  7 ++++++-
 gcc/configure               | 33 +++++++++++++++++++++++++++++++++
 gcc/configure.ac            | 21 ++++++++++++++++++++-
 4 files changed, 64 insertions(+), 2 deletions(-)

diff --git a/gcc/config.in b/gcc/config.in
index 64c27c9cfac..8dc90def9ca 100644
--- a/gcc/config.in
+++ b/gcc/config.in
@@ -2732,3 +2732,8 @@
 #undef vfork
 #endif
 
+/* Define as 1 if the default long double on a PowerPC system uses the IEEE
+   128-bit format. */
+#ifndef USED_FOR_TARGET
+#define TARGET_POWERPC_IEEE_128BIT_LONG_DOUBLE
+#endif
diff --git a/gcc/config/rs6000/rs6000.cc b/gcc/config/rs6000/rs6000.cc
index 666dec694a8..e005266361d 100644
--- a/gcc/config/rs6000/rs6000.cc
+++ b/gcc/config/rs6000/rs6000.cc
@@ -91,10 +91,15 @@
      explicitly redefine TARGET_IEEEQUAD and TARGET_IEEEQUAD_DEFAULT to 0, so
      those systems will not pick up this default.  This needs to be after all
      of the include files, so that POWERPC_LINUX and POWERPC_FREEBSD are
-     properly defined.  */
+     properly defined.
+
+     If we were built with a host compiler that defaulted to IEEE 128-bit, set
+     the default here to use IEEE 128-bit.  */
 #ifndef TARGET_IEEEQUAD_DEFAULT
 #if !defined (POWERPC_LINUX) && !defined (POWERPC_FREEBSD)
 #define TARGET_IEEEQUAD_DEFAULT 1
+#elif defined (TARGET_POWERPC_IEEE_128BIT_LONG_DOUBLE)
+#define TARGET_IEEEQUAD_DEFAULT TARGET_POWERPC_IEEE_128BIT_LONG_DOUBLE
 #else
 #define TARGET_IEEEQUAD_DEFAULT 0
 #endif
diff --git a/gcc/configure b/gcc/configure
index bd4d4721868..824d172b606 100755
--- a/gcc/configure
+++ b/gcc/configure
@@ -31473,6 +31473,39 @@ on 64-bit PowerPC VSX Linux systems" "$LINENO" 5
     with_long_double_format=""
     ;;
 esac
+else
+  gcc_cv_powerpc_ieee_long_double=no
+   case "$target" in
+     powerpc*-*-linux*)
+       # If --with-long-double format is not set, check to see whether the host
+       # compiler defaults to it.
+     { $as_echo "$as_me:${as_lineno-$LINENO}: checking if PowerPC target defaults to IEEE 128-bit long double" >&5
+$as_echo_n "checking if PowerPC target defaults to IEEE 128-bit long double... " >&6; }
+     cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+#if defined(_ARCH_PPC) && defined(__LONG_DOUBLE_IEEE128__)
+IEEE_LONG_DOUBLE
+#endif
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  $EGREP "IEEE_LONG_DOUBLE" >/dev/null 2>&1; then :
+  gcc_cv_powerpc_ieee_long_double=yes
+else
+  gcc_cv_powerpc_ieee_long_double=no
+fi
+rm -f conftest*
+
+     { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_powerpc_ieee_long_double" >&5
+$as_echo "$gcc_cv_powerpc_ieee_long_double" >&6; }
+     if test x$gcc_cv_powerpc_ieee_long_double = xyes; then
+
+$as_echo "#define TARGET_POWERPC_IEEE_128BIT_LONG_DOUBLE 1" >>confdefs.h
+
+     fi
+     ;;
+   esac
 fi
 
 
diff --git a/gcc/configure.ac b/gcc/configure.ac
index 1171c946e6e..c373b348568 100644
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -6975,7 +6975,26 @@ on 64-bit PowerPC VSX Linux systems])
     with_long_double_format=""
     ;;
 esac],
-  [])
+  [gcc_cv_powerpc_ieee_long_double=no
+   case "$target" in
+     powerpc*-*-linux*)
+       # If --with-long-double format is not set, check to see whether the host
+       # compiler defaults to it.
+     AC_MSG_CHECKING(if PowerPC target defaults to IEEE 128-bit long double)
+     AC_EGREP_CPP(IEEE_LONG_DOUBLE,[
+#if defined(_ARCH_PPC) && defined(__LONG_DOUBLE_IEEE128__)
+IEEE_LONG_DOUBLE
+#endif
+        ],
+        [gcc_cv_powerpc_ieee_long_double=yes],
+        [gcc_cv_powerpc_ieee_long_double=no])
+     AC_MSG_RESULT($gcc_cv_powerpc_ieee_long_double)
+     if test x$gcc_cv_powerpc_ieee_long_double = xyes; then
+       AC_DEFINE(TARGET_POWERPC_IEEE_128BIT_LONG_DOUBLE, 1,
+         [Define if long double is IEEE 128-bit on PowerPC systems by default])
+     fi
+     ;;
+   esac])
 
 # Check if the target LIBC supports exporting the AT_PLATFORM and AT_HWCAP
 # values in the TCB.  Currently, only GLIBC 2.23 and later support this.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [gcc(refs/users/meissner/heads/work077)] Use default long double from host compiler if not specified on PowerPC.
@ 2022-02-02 22:01 Michael Meissner
  0 siblings, 0 replies; 5+ messages in thread
From: Michael Meissner @ 2022-02-02 22:01 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:b8d97c893cc4dd49fea8970fbcd2077cf57ddc9e

commit b8d97c893cc4dd49fea8970fbcd2077cf57ddc9e
Author: Michael Meissner <meissner@linux.ibm.com>
Date:   Wed Feb 2 17:01:08 2022 -0500

    Use default long double from host compiler if not specified on PowerPC.
    
    If the user did not specify a default long double format, set the long
    double type to IEEE 128-bit if the host compiler uses IEEE 128-bit as the
    long double default.
    
    I used a Fedora rawhide system that was configured to use the default for
    long double being IEEE 128-bit.  I built and bootstrapped a compiler on
    this system with these patches applied, and I verified that the default
    for the compiler used IEEE 128-bit long doubles.
    
    Can I apply this patch to the trunk for GCC 12?  Ideally, this should be
    back-ported to GCC 11 as well.
    
    2022-02-02  Michael Meissner  <meissner@the-meissners.org>
    
    gcc/
            * config.in (TARGET_POWERPC_IEEE_128BIT_LONG_DOUBLE): New
            configure option.
            * config/rs6000/rs6000.cc (TARGET_IEEEQUAD_DEFAULT): If the host
            compiler used IEEE 128-bit long doubles and the long double format
            was not specified with configuration switches, set the long double
            format to IEEE 128-bit.
            * configure.ac (TARGET_POWERPC_IEEE_128BIT_LONG_DOUBLE): Set as 1
            if the host compiler used IEEE 128-bit long doubles.
            * configure: Regenerate.

Diff:
---
 gcc/config.in               |  4 ++++
 gcc/config/rs6000/rs6000.cc |  7 ++++++-
 gcc/configure               | 33 +++++++++++++++++++++++++++++++++
 gcc/configure.ac            | 21 ++++++++++++++++++++-
 4 files changed, 63 insertions(+), 2 deletions(-)

diff --git a/gcc/config.in b/gcc/config.in
index 64c27c9cfac..746c522e4e6 100644
--- a/gcc/config.in
+++ b/gcc/config.in
@@ -2732,3 +2732,7 @@
 #undef vfork
 #endif
 
+/* Define if long double is IEEE 128-bit on PowerPC systems by default.  */
+#ifndef USED_FOR_TARGET
+#define TARGET_POWERPC_IEEE_128BIT_LONG_DOUBLE
+#endif
diff --git a/gcc/config/rs6000/rs6000.cc b/gcc/config/rs6000/rs6000.cc
index 666dec694a8..a0e234438cd 100644
--- a/gcc/config/rs6000/rs6000.cc
+++ b/gcc/config/rs6000/rs6000.cc
@@ -91,10 +91,15 @@
      explicitly redefine TARGET_IEEEQUAD and TARGET_IEEEQUAD_DEFAULT to 0, so
      those systems will not pick up this default.  This needs to be after all
      of the include files, so that POWERPC_LINUX and POWERPC_FREEBSD are
-     properly defined.  */
+     properly defined.
+
+     If we were built with a host compiler that defaulted to IEEE 128-bit, set
+     the default here to use IEEE 128-bit.  */
 #ifndef TARGET_IEEEQUAD_DEFAULT
 #if !defined (POWERPC_LINUX) && !defined (POWERPC_FREEBSD)
 #define TARGET_IEEEQUAD_DEFAULT 1
+#elif defined (TARGET_POWERPC_IEEE_128BIT_LONG_DOUBLE)
+#define TARGET_IEEEQUAD_DEFAULT 1
 #else
 #define TARGET_IEEEQUAD_DEFAULT 0
 #endif
diff --git a/gcc/configure b/gcc/configure
index bd4d4721868..113860968ed 100755
--- a/gcc/configure
+++ b/gcc/configure
@@ -31473,6 +31473,39 @@ on 64-bit PowerPC VSX Linux systems" "$LINENO" 5
     with_long_double_format=""
     ;;
 esac
+else
+  gcc_cv_powerpc_ieee_long_double=no
+   case "$target" in
+     powerpc*-*-linux*)
+       # If --with-long-double format is not set, check to see whether the host
+       # compiler defaults to it.
+     { $as_echo "$as_me:${as_lineno-$LINENO}: checking if PowerPC target defaults to IEEE 128-bit long double" >&5
+$as_echo_n "checking if PowerPC target defaults to IEEE 128-bit long double... " >&6; }
+     cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+#if defined(_ARCH_PPC) && defined(__LONG_DOUBLE_IEEE128__)
+IEEE_LDBL
+#endif
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  $EGREP "IEEE_LDBL" >/dev/null 2>&1; then :
+  gcc_cv_powerpc_ieee_long_double=yes
+else
+  gcc_cv_powerpc_ieee_long_double=no
+fi
+rm -f conftest*
+
+     { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_powerpc_ieee_long_double" >&5
+$as_echo "$gcc_cv_powerpc_ieee_long_double" >&6; }
+     if test x$gcc_cv_powerpc_ieee_long_double = xyes; then
+
+$as_echo "#define TARGET_POWERPC_IEEE_128BIT_LONG_DOUBLE 1" >>confdefs.h
+
+     fi
+     ;;
+   esac
 fi
 
 
diff --git a/gcc/configure.ac b/gcc/configure.ac
index 1171c946e6e..d7a0d6e6999 100644
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -6975,7 +6975,26 @@ on 64-bit PowerPC VSX Linux systems])
     with_long_double_format=""
     ;;
 esac],
-  [])
+  [gcc_cv_powerpc_ieee_long_double=no
+   case "$target" in
+     powerpc*-*-linux*)
+       # If --with-long-double format is not set, check to see whether the host
+       # compiler defaults to it.
+     AC_MSG_CHECKING(if PowerPC target defaults to IEEE 128-bit long double)
+     AC_EGREP_CPP(IEEE_LDBL,[
+#if defined(_ARCH_PPC) && defined(__LONG_DOUBLE_IEEE128__)
+IEEE_LDBL
+#endif
+        ],
+        [gcc_cv_powerpc_ieee_long_double=yes],
+        [gcc_cv_powerpc_ieee_long_double=no])
+     AC_MSG_RESULT($gcc_cv_powerpc_ieee_long_double)
+     if test x$gcc_cv_powerpc_ieee_long_double = xyes; then
+       AC_DEFINE(TARGET_POWERPC_IEEE_128BIT_LONG_DOUBLE, 1,
+         [Define if long double is IEEE 128-bit on PowerPC systems by default])
+     fi
+     ;;
+   esac])
 
 # Check if the target LIBC supports exporting the AT_PLATFORM and AT_HWCAP
 # values in the TCB.  Currently, only GLIBC 2.23 and later support this.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [gcc(refs/users/meissner/heads/work077)] Use default long double from host compiler if not specified on PowerPC.
@ 2022-02-02 18:51 Michael Meissner
  0 siblings, 0 replies; 5+ messages in thread
From: Michael Meissner @ 2022-02-02 18:51 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:867f8fea64b744889b28ecf1ffa6125527475c74

commit 867f8fea64b744889b28ecf1ffa6125527475c74
Author: Michael Meissner <meissner@linux.ibm.com>
Date:   Wed Feb 2 13:50:52 2022 -0500

    Use default long double from host compiler if not specified on PowerPC.
    
    If the user did not specify a default long double format, set the long
    double type to IEEE 128-bit if the host compiler uses IEEE 128-bit as the
    long double default.
    
    I used a Fedora rawhide system that was configured to use the default for
    long double being IEEE 128-bit.  I built and bootstrapped a compiler on
    this system with these patches applied, and I verified that the default
    for the compiler used IEEE 128-bit long doubles.
    
    Can I apply this patch to the trunk for GCC 12?  Ideally, this should be
    back-ported to GCC 11 as well.
    
    2022-02-02  Michael Meissner  <meissner@the-meissners.org>
    
    gcc/
            * config.in (TARGET_POWERPC_IEEE_128BIT_LONG_DOUBLE): New
            configure option.
            * config/rs6000/rs6000.cc (TARGET_IEEEQUAD_DEFAULT): If the host
            compiler used IEEE 128-bit long doubles and the long double format
            was not specified with configuration switches, set the long double
            format to IEEE 128-bit.
            * configure.ac (TARGET_POWERPC_IEEE_128BIT_LONG_DOUBLE): Set as 1
            if the host compiler used IEEE 128-bit long doubles.
            * configure: Regenerate.

Diff:
---
 gcc/config.in               |  4 ++++
 gcc/config/rs6000/rs6000.cc |  7 ++++++-
 gcc/configure               | 33 +++++++++++++++++++++++++++++++++
 gcc/configure.ac            | 21 ++++++++++++++++++++-
 4 files changed, 63 insertions(+), 2 deletions(-)

diff --git a/gcc/config.in b/gcc/config.in
index 64c27c9cfac..746c522e4e6 100644
--- a/gcc/config.in
+++ b/gcc/config.in
@@ -2732,3 +2732,7 @@
 #undef vfork
 #endif
 
+/* Define if long double is IEEE 128-bit on PowerPC systems by default.  */
+#ifndef USED_FOR_TARGET
+#define TARGET_POWERPC_IEEE_128BIT_LONG_DOUBLE
+#endif
diff --git a/gcc/config/rs6000/rs6000.cc b/gcc/config/rs6000/rs6000.cc
index 666dec694a8..a0e234438cd 100644
--- a/gcc/config/rs6000/rs6000.cc
+++ b/gcc/config/rs6000/rs6000.cc
@@ -91,10 +91,15 @@
      explicitly redefine TARGET_IEEEQUAD and TARGET_IEEEQUAD_DEFAULT to 0, so
      those systems will not pick up this default.  This needs to be after all
      of the include files, so that POWERPC_LINUX and POWERPC_FREEBSD are
-     properly defined.  */
+     properly defined.
+
+     If we were built with a host compiler that defaulted to IEEE 128-bit, set
+     the default here to use IEEE 128-bit.  */
 #ifndef TARGET_IEEEQUAD_DEFAULT
 #if !defined (POWERPC_LINUX) && !defined (POWERPC_FREEBSD)
 #define TARGET_IEEEQUAD_DEFAULT 1
+#elif defined (TARGET_POWERPC_IEEE_128BIT_LONG_DOUBLE)
+#define TARGET_IEEEQUAD_DEFAULT 1
 #else
 #define TARGET_IEEEQUAD_DEFAULT 0
 #endif
diff --git a/gcc/configure b/gcc/configure
index bd4d4721868..824d172b606 100755
--- a/gcc/configure
+++ b/gcc/configure
@@ -31473,6 +31473,39 @@ on 64-bit PowerPC VSX Linux systems" "$LINENO" 5
     with_long_double_format=""
     ;;
 esac
+else
+  gcc_cv_powerpc_ieee_long_double=no
+   case "$target" in
+     powerpc*-*-linux*)
+       # If --with-long-double format is not set, check to see whether the host
+       # compiler defaults to it.
+     { $as_echo "$as_me:${as_lineno-$LINENO}: checking if PowerPC target defaults to IEEE 128-bit long double" >&5
+$as_echo_n "checking if PowerPC target defaults to IEEE 128-bit long double... " >&6; }
+     cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+#if defined(_ARCH_PPC) && defined(__LONG_DOUBLE_IEEE128__)
+IEEE_LONG_DOUBLE
+#endif
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  $EGREP "IEEE_LONG_DOUBLE" >/dev/null 2>&1; then :
+  gcc_cv_powerpc_ieee_long_double=yes
+else
+  gcc_cv_powerpc_ieee_long_double=no
+fi
+rm -f conftest*
+
+     { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_powerpc_ieee_long_double" >&5
+$as_echo "$gcc_cv_powerpc_ieee_long_double" >&6; }
+     if test x$gcc_cv_powerpc_ieee_long_double = xyes; then
+
+$as_echo "#define TARGET_POWERPC_IEEE_128BIT_LONG_DOUBLE 1" >>confdefs.h
+
+     fi
+     ;;
+   esac
 fi
 
 
diff --git a/gcc/configure.ac b/gcc/configure.ac
index 1171c946e6e..c373b348568 100644
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -6975,7 +6975,26 @@ on 64-bit PowerPC VSX Linux systems])
     with_long_double_format=""
     ;;
 esac],
-  [])
+  [gcc_cv_powerpc_ieee_long_double=no
+   case "$target" in
+     powerpc*-*-linux*)
+       # If --with-long-double format is not set, check to see whether the host
+       # compiler defaults to it.
+     AC_MSG_CHECKING(if PowerPC target defaults to IEEE 128-bit long double)
+     AC_EGREP_CPP(IEEE_LONG_DOUBLE,[
+#if defined(_ARCH_PPC) && defined(__LONG_DOUBLE_IEEE128__)
+IEEE_LONG_DOUBLE
+#endif
+        ],
+        [gcc_cv_powerpc_ieee_long_double=yes],
+        [gcc_cv_powerpc_ieee_long_double=no])
+     AC_MSG_RESULT($gcc_cv_powerpc_ieee_long_double)
+     if test x$gcc_cv_powerpc_ieee_long_double = xyes; then
+       AC_DEFINE(TARGET_POWERPC_IEEE_128BIT_LONG_DOUBLE, 1,
+         [Define if long double is IEEE 128-bit on PowerPC systems by default])
+     fi
+     ;;
+   esac])
 
 # Check if the target LIBC supports exporting the AT_PLATFORM and AT_HWCAP
 # values in the TCB.  Currently, only GLIBC 2.23 and later support this.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [gcc(refs/users/meissner/heads/work077)] Use default long double from host compiler if not specified on PowerPC.
@ 2022-02-02  5:01 Michael Meissner
  0 siblings, 0 replies; 5+ messages in thread
From: Michael Meissner @ 2022-02-02  5:01 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:c165b32bcf898a540fad83463fc1c9ac561ebfe0

commit c165b32bcf898a540fad83463fc1c9ac561ebfe0
Author: Michael Meissner <meissner@linux.ibm.com>
Date:   Wed Feb 2 00:01:36 2022 -0500

    Use default long double from host compiler if not specified on PowerPC.
    
    If the user did not specify a default long double format, set the long
    double type to IEEE 128-bit if the host compiler uses IEEE 128-bit as the
    long double default.
    
    I used a Fedora rawhide system that was configured to use the default for
    long double being IEEE 128-bit.  I built and bootstrapped a compiler on
    this system with these patches applied, and I verified that the default
    for the compiler used IEEE 128-bit long doubles.
    
    Can I apply this patch to the trunk for GCC 12?  Ideally, this should be
    back-ported to GCC 11 as well.
    
    2022-02-01  Michael Meissner  <meissner@the-meissners.org>
    
    gcc/
            * config.in (TARGET_POWERPC_IEEE_128BIT_LONG_DOUBLE): New
            configure option.
            * config/rs6000/rs6000.cc (TARGET_IEEEQUAD_DEFAULT): If the host
            compiler used IEEE 128-bit long doubles and the long double format
            was not specified with configuration switches, set the long double
            format to IEEE 128-bit.
            * configure.ac (TARGET_POWERPC_IEEE_128BIT_LONG_DOUBLE): Set as 1
            if the host compiler used IEEE 128-bit long doubles.
            * configure: Regenerate.

Diff:
---
 gcc/config.in               |  5 +++++
 gcc/config/rs6000/rs6000.cc |  7 ++++++-
 gcc/configure               | 33 +++++++++++++++++++++++++++++++++
 gcc/configure.ac            | 21 ++++++++++++++++++++-
 4 files changed, 64 insertions(+), 2 deletions(-)

diff --git a/gcc/config.in b/gcc/config.in
index 64c27c9cfac..8dc90def9ca 100644
--- a/gcc/config.in
+++ b/gcc/config.in
@@ -2732,3 +2732,8 @@
 #undef vfork
 #endif
 
+/* Define as 1 if the default long double on a PowerPC system uses the IEEE
+   128-bit format. */
+#ifndef USED_FOR_TARGET
+#define TARGET_POWERPC_IEEE_128BIT_LONG_DOUBLE
+#endif
diff --git a/gcc/config/rs6000/rs6000.cc b/gcc/config/rs6000/rs6000.cc
index 666dec694a8..ea0e4cde3b6 100644
--- a/gcc/config/rs6000/rs6000.cc
+++ b/gcc/config/rs6000/rs6000.cc
@@ -91,10 +91,15 @@
      explicitly redefine TARGET_IEEEQUAD and TARGET_IEEEQUAD_DEFAULT to 0, so
      those systems will not pick up this default.  This needs to be after all
      of the include files, so that POWERPC_LINUX and POWERPC_FREEBSD are
-     properly defined.  */
+     properly defined.
+
+     If we were built with a host compiler that defaulted to IEEE 128-bit, set
+     the default here to use IEEE 128-bit.  */
 #ifndef TARGET_IEEEQUAD_DEFAULT
 #if !defined (POWERPC_LINUX) && !defined (POWERPC_FREEBSD)
 #define TARGET_IEEEQUAD_DEFAULT 1
+#elif TARGET_POWERPC_IEEE_128BIT_LONG_DOUBLE
+#define TARGET_IEEEQUAD_DEFAULT 1
 #else
 #define TARGET_IEEEQUAD_DEFAULT 0
 #endif
diff --git a/gcc/configure b/gcc/configure
index bd4d4721868..824d172b606 100755
--- a/gcc/configure
+++ b/gcc/configure
@@ -31473,6 +31473,39 @@ on 64-bit PowerPC VSX Linux systems" "$LINENO" 5
     with_long_double_format=""
     ;;
 esac
+else
+  gcc_cv_powerpc_ieee_long_double=no
+   case "$target" in
+     powerpc*-*-linux*)
+       # If --with-long-double format is not set, check to see whether the host
+       # compiler defaults to it.
+     { $as_echo "$as_me:${as_lineno-$LINENO}: checking if PowerPC target defaults to IEEE 128-bit long double" >&5
+$as_echo_n "checking if PowerPC target defaults to IEEE 128-bit long double... " >&6; }
+     cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+#if defined(_ARCH_PPC) && defined(__LONG_DOUBLE_IEEE128__)
+IEEE_LONG_DOUBLE
+#endif
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  $EGREP "IEEE_LONG_DOUBLE" >/dev/null 2>&1; then :
+  gcc_cv_powerpc_ieee_long_double=yes
+else
+  gcc_cv_powerpc_ieee_long_double=no
+fi
+rm -f conftest*
+
+     { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_powerpc_ieee_long_double" >&5
+$as_echo "$gcc_cv_powerpc_ieee_long_double" >&6; }
+     if test x$gcc_cv_powerpc_ieee_long_double = xyes; then
+
+$as_echo "#define TARGET_POWERPC_IEEE_128BIT_LONG_DOUBLE 1" >>confdefs.h
+
+     fi
+     ;;
+   esac
 fi
 
 
diff --git a/gcc/configure.ac b/gcc/configure.ac
index 1171c946e6e..c373b348568 100644
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -6975,7 +6975,26 @@ on 64-bit PowerPC VSX Linux systems])
     with_long_double_format=""
     ;;
 esac],
-  [])
+  [gcc_cv_powerpc_ieee_long_double=no
+   case "$target" in
+     powerpc*-*-linux*)
+       # If --with-long-double format is not set, check to see whether the host
+       # compiler defaults to it.
+     AC_MSG_CHECKING(if PowerPC target defaults to IEEE 128-bit long double)
+     AC_EGREP_CPP(IEEE_LONG_DOUBLE,[
+#if defined(_ARCH_PPC) && defined(__LONG_DOUBLE_IEEE128__)
+IEEE_LONG_DOUBLE
+#endif
+        ],
+        [gcc_cv_powerpc_ieee_long_double=yes],
+        [gcc_cv_powerpc_ieee_long_double=no])
+     AC_MSG_RESULT($gcc_cv_powerpc_ieee_long_double)
+     if test x$gcc_cv_powerpc_ieee_long_double = xyes; then
+       AC_DEFINE(TARGET_POWERPC_IEEE_128BIT_LONG_DOUBLE, 1,
+         [Define if long double is IEEE 128-bit on PowerPC systems by default])
+     fi
+     ;;
+   esac])
 
 # Check if the target LIBC supports exporting the AT_PLATFORM and AT_HWCAP
 # values in the TCB.  Currently, only GLIBC 2.23 and later support this.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [gcc(refs/users/meissner/heads/work077)] Use default long double from host compiler if not specified on PowerPC.
@ 2022-02-02  3:12 Michael Meissner
  0 siblings, 0 replies; 5+ messages in thread
From: Michael Meissner @ 2022-02-02  3:12 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:d4151bb7d3347d3b734c51428a03cd1c457451d1

commit d4151bb7d3347d3b734c51428a03cd1c457451d1
Author: Michael Meissner <meissner@linux.ibm.com>
Date:   Tue Feb 1 22:12:17 2022 -0500

    Use default long double from host compiler if not specified on PowerPC.
    
    If the user did not specify a default long double format, set the long
    double type to IEEE 128-bit if the host compiler uses IEEE 128-bit as the
    long double default.
    
    I used a Fedora rawhide system that was configured to use the default for
    long double being IEEE 128-bit.  I built and bootstrapped a compiler on
    this system with these patches applied, and I verified that the default
    for the compiler used IEEE 128-bit long doubles.
    
    Can I apply this patch to the trunk for GCC 12?  Ideally, this should be
    back-ported to GCC 11 as well.
    
    2022-02-01  Michael Meissner  <meissner@the-meissners.org>
    
    gcc/
            * config.in (TARGET_POWERPC_IEEE_128BIT_LONG_DOUBLE): New
            configure option.
            * config/rs6000/rs6000.cc (TARGET_IEEEQUAD_DEFAULT): If the host
            compiler used IEEE 128-bit long doubles and the long double format
            was not specified with configuration switches, set the long double
            format to IEEE 128-bit.
            * configure.ac (TARGET_POWERPC_IEEE_128BIT_LONG_DOUBLE): Set as 1
            if the host compiler used IEEE 128-bit long doubles.
            * configure: Regenerate.

Diff:
---
 gcc/config.in               |  5 +++++
 gcc/config/rs6000/rs6000.cc |  7 ++++++-
 gcc/configure               | 33 +++++++++++++++++++++++++++++++++
 gcc/configure.ac            | 21 ++++++++++++++++++++-
 4 files changed, 64 insertions(+), 2 deletions(-)

diff --git a/gcc/config.in b/gcc/config.in
index 64c27c9cfac..8dc90def9ca 100644
--- a/gcc/config.in
+++ b/gcc/config.in
@@ -2732,3 +2732,8 @@
 #undef vfork
 #endif
 
+/* Define as 1 if the default long double on a PowerPC system uses the IEEE
+   128-bit format. */
+#ifndef USED_FOR_TARGET
+#define TARGET_POWERPC_IEEE_128BIT_LONG_DOUBLE
+#endif
diff --git a/gcc/config/rs6000/rs6000.cc b/gcc/config/rs6000/rs6000.cc
index 666dec694a8..ea0e4cde3b6 100644
--- a/gcc/config/rs6000/rs6000.cc
+++ b/gcc/config/rs6000/rs6000.cc
@@ -91,10 +91,15 @@
      explicitly redefine TARGET_IEEEQUAD and TARGET_IEEEQUAD_DEFAULT to 0, so
      those systems will not pick up this default.  This needs to be after all
      of the include files, so that POWERPC_LINUX and POWERPC_FREEBSD are
-     properly defined.  */
+     properly defined.
+
+     If we were built with a host compiler that defaulted to IEEE 128-bit, set
+     the default here to use IEEE 128-bit.  */
 #ifndef TARGET_IEEEQUAD_DEFAULT
 #if !defined (POWERPC_LINUX) && !defined (POWERPC_FREEBSD)
 #define TARGET_IEEEQUAD_DEFAULT 1
+#elif TARGET_POWERPC_IEEE_128BIT_LONG_DOUBLE
+#define TARGET_IEEEQUAD_DEFAULT 1
 #else
 #define TARGET_IEEEQUAD_DEFAULT 0
 #endif
diff --git a/gcc/configure b/gcc/configure
index bd4d4721868..824d172b606 100755
--- a/gcc/configure
+++ b/gcc/configure
@@ -31473,6 +31473,39 @@ on 64-bit PowerPC VSX Linux systems" "$LINENO" 5
     with_long_double_format=""
     ;;
 esac
+else
+  gcc_cv_powerpc_ieee_long_double=no
+   case "$target" in
+     powerpc*-*-linux*)
+       # If --with-long-double format is not set, check to see whether the host
+       # compiler defaults to it.
+     { $as_echo "$as_me:${as_lineno-$LINENO}: checking if PowerPC target defaults to IEEE 128-bit long double" >&5
+$as_echo_n "checking if PowerPC target defaults to IEEE 128-bit long double... " >&6; }
+     cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+#if defined(_ARCH_PPC) && defined(__LONG_DOUBLE_IEEE128__)
+IEEE_LONG_DOUBLE
+#endif
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  $EGREP "IEEE_LONG_DOUBLE" >/dev/null 2>&1; then :
+  gcc_cv_powerpc_ieee_long_double=yes
+else
+  gcc_cv_powerpc_ieee_long_double=no
+fi
+rm -f conftest*
+
+     { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_powerpc_ieee_long_double" >&5
+$as_echo "$gcc_cv_powerpc_ieee_long_double" >&6; }
+     if test x$gcc_cv_powerpc_ieee_long_double = xyes; then
+
+$as_echo "#define TARGET_POWERPC_IEEE_128BIT_LONG_DOUBLE 1" >>confdefs.h
+
+     fi
+     ;;
+   esac
 fi
 
 
diff --git a/gcc/configure.ac b/gcc/configure.ac
index 1171c946e6e..099e91d2a3f 100644
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -6975,7 +6975,26 @@ on 64-bit PowerPC VSX Linux systems])
     with_long_double_format=""
     ;;
 esac],
-  [])
+  [gcc_cv_powerpc_ieee_long_double=no
+   case "$target" in
+     powerpc*-*-linux*)
+       # If --with-long-double format is not set, check to see whether the host
+       # compiler defaults to it.
+     AC_MSG_CHECKING(if PowerPC target defaults to IEEE 128-bit long double)
+     AC_EGREP_CPP(IEEE_LONG_DOUBLE,[
+#if defined(_ARCH_PPC) && defined(__LONG_DOUBLE_IEEE128__)
+IEEE_LONG_DOUBLE
+#endif
+        ],
+        [gcc_cv_powerpc_ieee_long_double=yes],
+        [gcc_cv_powerpc_ieee_long_double=no])
+     AC_MSG_RESULT($gcc_cv_powerpc_ieee_long_double)
+     if test x$gcc_cv_powerpc_ieee_long_double = xyes; then
+       AC_DEFINE(TARGET_POWERPC_IEEE_128BIT_LONG_DOUBLE, 1,
+         [Define if long double in IEEE 128-bit on PowerPC systems by default])
+     fi
+     ;;
+   esac])
 
 # Check if the target LIBC supports exporting the AT_PLATFORM and AT_HWCAP
 # values in the TCB.  Currently, only GLIBC 2.23 and later support this.


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-02-02 22:01 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-02 18:32 [gcc(refs/users/meissner/heads/work077)] Use default long double from host compiler if not specified on PowerPC Michael Meissner
  -- strict thread matches above, loose matches on Subject: below --
2022-02-02 22:01 Michael Meissner
2022-02-02 18:51 Michael Meissner
2022-02-02  5:01 Michael Meissner
2022-02-02  3:12 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).