From 060619250dc83e38c9129babac5c243914056da5 Mon Sep 17 00:00:00 2001 From: Michael Meissner Date: Wed, 17 Jan 2018 01:06:34 +0000 Subject: [PATCH] config.gcc (powerpc*-linux*-*): Add support for 64-bit little endian Linux systems to optionally enable... 2018-01-16 Michael Meissner * config.gcc (powerpc*-linux*-*): Add support for 64-bit little endian Linux systems to optionally enable multilibs for selecting the long double type if the user configured an explicit type. * config/rs6000/rs6000.h (TARGET_IEEEQUAD_MULTILIB): Indicate we have no long double multilibs if not defined. * config/rs6000/rs6000.c (rs6000_option_override_internal): Do not warn if the user used -mabi={ieee,ibm}longdouble and we built multilibs for long double. * config/rs6000/linux64.h (MULTILIB_DEFAULTS_IEEE): Define as the appropriate multilib option. (MULTILIB_DEFAULTS): Add MULTILIB_DEFAULTS_IEEE to the default multilib options. * config/rs6000/t-ldouble-linux64le-ibm: New configuration files for building long double multilibs. * config/rs6000/t-ldouble-linux64le-ieee: Likewise. From-SVN: r256775 --- gcc/ChangeLog | 18 +++++++++++++++ gcc/config.gcc | 10 +++++++++ gcc/config/rs6000/linux64.h | 13 ++++++++--- gcc/config/rs6000/rs6000.c | 8 +++++-- gcc/config/rs6000/rs6000.h | 6 +++++ gcc/config/rs6000/t-ldouble-linux64le-ibm | 26 ++++++++++++++++++++++ gcc/config/rs6000/t-ldouble-linux64le-ieee | 26 ++++++++++++++++++++++ 7 files changed, 102 insertions(+), 5 deletions(-) create mode 100644 gcc/config/rs6000/t-ldouble-linux64le-ibm create mode 100644 gcc/config/rs6000/t-ldouble-linux64le-ieee diff --git a/gcc/ChangeLog b/gcc/ChangeLog index a76a977a394..9034ebec2d4 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,21 @@ +2018-01-16 Michael Meissner + + * config.gcc (powerpc*-linux*-*): Add support for 64-bit little + endian Linux systems to optionally enable multilibs for selecting + the long double type if the user configured an explicit type. + * config/rs6000/rs6000.h (TARGET_IEEEQUAD_MULTILIB): Indicate we + have no long double multilibs if not defined. + * config/rs6000/rs6000.c (rs6000_option_override_internal): Do not + warn if the user used -mabi={ieee,ibm}longdouble and we built + multilibs for long double. + * config/rs6000/linux64.h (MULTILIB_DEFAULTS_IEEE): Define as the + appropriate multilib option. + (MULTILIB_DEFAULTS): Add MULTILIB_DEFAULTS_IEEE to the default + multilib options. + * config/rs6000/t-ldouble-linux64le-ibm: New configuration files + for building long double multilibs. + * config/rs6000/t-ldouble-linux64le-ieee: Likewise. + 2018-01-16 John David Anglin * config.gcc (hppa*-*-linux*): Change callee copies ABI to caller diff --git a/gcc/config.gcc b/gcc/config.gcc index 311186b56eb..ec6822b9db1 100644 --- a/gcc/config.gcc +++ b/gcc/config.gcc @@ -4407,6 +4407,16 @@ case "${target}" in elif test x$with_long_double_format = xibm; then tm_defines="${tm_defines} TARGET_IEEEQUAD_DEFAULT=0" fi + + case "${target}:${enable_multilib}:${with_long_double_format}" in + powerpc64le*:yes:ieee | powerpc64le*:yes:ibm) + tm_defines="${tm_defines} TARGET_IEEEQUAD_MULTILIB=1" + tmake_file="${tmake_file} rs6000/t-ldouble-linux64le-${with_long_double_format}" + ;; + *) + : + ;; + esac ;; s390*-*-*) diff --git a/gcc/config/rs6000/linux64.h b/gcc/config/rs6000/linux64.h index 44eab40a234..90fe6566255 100644 --- a/gcc/config/rs6000/linux64.h +++ b/gcc/config/rs6000/linux64.h @@ -245,11 +245,18 @@ extern int dot_symbols; #define DYNAMIC_LINKER_PREFIX "" #endif -#undef MULTILIB_DEFAULTS +#if TARGET_IEEEQUAD_DEFAULT +#define MULTILIB_DEFAULTS_IEEE "mabi=ieeelongdouble" + +#else /* TARGET_IEEEQUAD_DEFAULT. */ +#define MULTILIB_DEFAULTS_IEEE "mabi=ibmlongdouble" +#endif /* TARGET_IEEEQUAD_DEFAULT. */ + +#undef MULTILIB_DEFAULTS #if DEFAULT_ARCH64_P -#define MULTILIB_DEFAULTS { "m64" } +#define MULTILIB_DEFAULTS { "m64", MULTILIB_DEFAULTS_IEEE } #else -#define MULTILIB_DEFAULTS { "m32" } +#define MULTILIB_DEFAULTS { "m32", MULTILIB_DEFAULTS_IEEE } #endif /* Split stack is only supported for 64 bit, and requires glibc >= 2.18. */ diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c index 2c22c63d74c..dbd3beebb51 100644 --- a/gcc/config/rs6000/rs6000.c +++ b/gcc/config/rs6000/rs6000.c @@ -4587,11 +4587,15 @@ rs6000_option_override_internal (bool global_init_p) systems will also set long double to be IEEE 128-bit. AIX and Darwin explicitly redefine TARGET_IEEEQUAD and TARGET_IEEEQUAD_DEFAULT to 0, so those systems will not pick up this default. Warn if the user changes the - default unless -Wno-psabi. */ + default unless either the user used the -Wno-psabi option, or the compiler + was built to enable multilibs to switch between the two long double + types. */ if (!global_options_set.x_rs6000_ieeequad) rs6000_ieeequad = TARGET_IEEEQUAD_DEFAULT; - else if (rs6000_ieeequad != TARGET_IEEEQUAD_DEFAULT && TARGET_LONG_DOUBLE_128) + else if (!TARGET_IEEEQUAD_MULTILIB + && rs6000_ieeequad != TARGET_IEEEQUAD_DEFAULT + && TARGET_LONG_DOUBLE_128) { static bool warned_change_long_double; if (!warned_change_long_double) diff --git a/gcc/config/rs6000/rs6000.h b/gcc/config/rs6000/rs6000.h index 77b75dd756c..a218366f658 100644 --- a/gcc/config/rs6000/rs6000.h +++ b/gcc/config/rs6000/rs6000.h @@ -564,6 +564,12 @@ extern int rs6000_vector_align[]; #define TARGET_ALTIVEC_ABI rs6000_altivec_abi #define TARGET_LDBRX (TARGET_POPCNTD || rs6000_cpu == PROCESSOR_CELL) +/* Define as 1 if we support multilibs for switching long double between IEEE + 128-bit floating point and IBM extended double. */ +#ifndef TARGET_IEEEQUAD_MULTILIB +#define TARGET_IEEEQUAD_MULTILIB 0 +#endif + /* ISA 2.01 allowed FCFID to be done in 32-bit, previously it was 64-bit only. Enable 32-bit fcfid's on any of the switches for newer ISA machines or XILINX. */ diff --git a/gcc/config/rs6000/t-ldouble-linux64le-ibm b/gcc/config/rs6000/t-ldouble-linux64le-ibm new file mode 100644 index 00000000000..4b209e8b907 --- /dev/null +++ b/gcc/config/rs6000/t-ldouble-linux64le-ibm @@ -0,0 +1,26 @@ +# Long double multilib libraries for PowerPC 64-bit little endian systems using +# IBM extended double as the long double type. +# +# Copyright (C) 2018 Free Software Foundation, Inc. +# +# This file is part of GCC. +# +# GCC is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GCC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GCC; see the file COPYING3. If not see +# . + +MULTILIB_OPTIONS += mabi=ieeelongdouble/mabi=ibmlongdouble +MULTILIB_DIRNAMES += ieee128 ibm128 +MULTILIB_OSDIRNAMES += mabi.ibmlongdouble=../lib64$(call if_multiarch,:powerpc64-linux-gnu) \ + mabi.ieeelongdouble=../lib64/ieee128$(call if_multiarch,:powerpc64-linux-gnu) \ + ../lib64$(call if_multiarch,:powerpc64-linux-gnu) diff --git a/gcc/config/rs6000/t-ldouble-linux64le-ieee b/gcc/config/rs6000/t-ldouble-linux64le-ieee new file mode 100644 index 00000000000..7d47953c908 --- /dev/null +++ b/gcc/config/rs6000/t-ldouble-linux64le-ieee @@ -0,0 +1,26 @@ +# Long double multilib libraries for PowerPC 64-bit little endian systems using +# IEEE 128-bit floating point as the long double type. +# +# Copyright (C) 2018 Free Software Foundation, Inc. +# +# This file is part of GCC. +# +# GCC is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GCC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GCC; see the file COPYING3. If not see +# . + +MULTILIB_OPTIONS += mabi=ieeelongdouble/mabi=ibmlongdouble +MULTILIB_DIRNAMES += ieee128 ibm128 +MULTILIB_OSDIRNAMES += mabi.ibmlongdouble=../lib64/ibm128$(call if_multiarch,:powerpc64-linux-gnu) \ + mabi.ieeelongdouble=../lib64$(call if_multiarch,:powerpc64-linux-gnu) \ + ../lib64$(call if_multiarch,:powerpc64-linux-gnu) -- 2.30.2