public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Michael Meissner <meissner@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc(refs/users/meissner/heads/work077)] Use default long double from host compiler if not specified on PowerPC. Date: Wed, 2 Feb 2022 22:01:28 +0000 (GMT) [thread overview] Message-ID: <20220202220128.2C5503858D37@sourceware.org> (raw) 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.
next reply other threads:[~2022-02-02 22:01 UTC|newest] Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-02-02 22:01 Michael Meissner [this message] -- strict thread matches above, loose matches on Subject: below -- 2022-02-02 18:51 Michael Meissner 2022-02-02 18:32 Michael Meissner 2022-02-02 5:01 Michael Meissner 2022-02-02 3:12 Michael Meissner
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20220202220128.2C5503858D37@sourceware.org \ --to=meissner@gcc.gnu.org \ --cc=gcc-cvs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).