https://gcc.gnu.org/g:1e3d2a86601bea1763bb25bb4e5b23a761ae7d4c
commit 1e3d2a86601bea1763bb25bb4e5b23a761ae7d4c Author: Michael Meissner <meiss...@linux.ibm.com> Date: Tue Jul 16 12:00:37 2024 -0400 Do not add -mvsx when building or testing the float128 support. In the past, we would add -mvsx when building the float128 support in libgcc. This allowed us to build the float128 support on a big endian system where the default cpu is power4. While the libgcc support can be built, given there is no glibc support for float128 available. However, adding -mvsx and building the libgcc float128 support causes problems if you set the default cpu to something like a 7540, which does not have VSX support. The assembler complains that when the code does a ".machine 7450", you cannot use VSX instructions. With these patches, the float128 libgcc support is only built if the default compiler has VSX support. If somebody wanted to enable the glibc support for big endian, they would need to set the base cpu to power8 to enable building the libgcc float128 libraries. 2024-07-16 Michael Meissner <meiss...@linux.ibm.com> libgcc/ PR target/115800 PR target/113652 * config.host (powerpc*-*-linux*): Do not add t-float128-hw or t-float128-p10-hw if the default compiler does not support float128. * config/rs6000/t-float128 (FP128_CFLAGS_SW): Do not add -mvsx when building the basic float128 support. * config/rs6000/t-float128-hw (FP128_CFLAGS_HW): Likewise. * config/rs6000/t-float128-p10-hw (FP128_3_1_CFLAGS_HW): Likewise. * configure.ac (powerpc*-*-linux*): Do not add -mvsx when testing whether to build the float128 support. * configure: Regenerate. Diff: --- libgcc/config.host | 12 ++++++------ libgcc/config/rs6000/t-float128 | 8 +++++++- libgcc/config/rs6000/t-float128-hw | 3 +-- libgcc/config/rs6000/t-float128-p10-hw | 3 +-- libgcc/configure | 8 +++++++- libgcc/configure.ac | 8 +++++++- 6 files changed, 29 insertions(+), 13 deletions(-) diff --git a/libgcc/config.host b/libgcc/config.host index 9fae51d4ce7d..261b08859a4d 100644 --- a/libgcc/config.host +++ b/libgcc/config.host @@ -1292,14 +1292,14 @@ powerpc*-*-linux*) if test $libgcc_cv_powerpc_float128 = yes; then tmake_file="${tmake_file} rs6000/t-float128" - fi - if test $libgcc_cv_powerpc_float128_hw = yes; then - tmake_file="${tmake_file} rs6000/t-float128-hw" - fi + if test $libgcc_cv_powerpc_float128_hw = yes; then + tmake_file="${tmake_file} rs6000/t-float128-hw" - if test $libgcc_cv_powerpc_3_1_float128_hw = yes; then - tmake_file="${tmake_file} rs6000/t-float128-p10-hw" + if test $libgcc_cv_powerpc_3_1_float128_hw = yes; then + tmake_file="${tmake_file} rs6000/t-float128-p10-hw" + fi + fi fi extra_parts="$extra_parts ecrti.o ecrtn.o ncrti.o ncrtn.o" diff --git a/libgcc/config/rs6000/t-float128 b/libgcc/config/rs6000/t-float128 index b09b5664af0e..93e78adcd624 100644 --- a/libgcc/config/rs6000/t-float128 +++ b/libgcc/config/rs6000/t-float128 @@ -74,7 +74,13 @@ fp128_includes = $(srcdir)/soft-fp/double.h \ $(srcdir)/soft-fp/soft-fp.h # Build the emulator without ISA 3.0 hardware support. -FP128_CFLAGS_SW = -Wno-type-limits -mvsx -mfloat128 \ +# +# In the past we added -mvsx to build the float128 specific libraries with the +# VSX instruction set. This allowed the big endian GCC on server platforms to +# build the float128 support. However, is causes problems when other default +# cpu targets are used such as the 7450. + +FP128_CFLAGS_SW = -Wno-type-limits -mfloat128 \ -mno-float128-hardware -mno-gnu-attribute \ -I$(srcdir)/soft-fp \ -I$(srcdir)/config/rs6000 \ diff --git a/libgcc/config/rs6000/t-float128-hw b/libgcc/config/rs6000/t-float128-hw index ed67b572580f..82726c98b983 100644 --- a/libgcc/config/rs6000/t-float128-hw +++ b/libgcc/config/rs6000/t-float128-hw @@ -23,8 +23,7 @@ fp128_ifunc_obj = $(fp128_ifunc_static_obj) $(fp128_ifunc_shared_obj) fp128_sed_hw = -hw # Build the hardware support functions with appropriate hardware support -FP128_CFLAGS_HW = -Wno-type-limits -mvsx -mfloat128 \ - -mcpu=power9 \ +FP128_CFLAGS_HW = -Wno-type-limits -mfloat128 -mcpu=power9 \ -mfloat128-hardware -mno-gnu-attribute \ -I$(srcdir)/soft-fp \ -I$(srcdir)/config/rs6000 \ diff --git a/libgcc/config/rs6000/t-float128-p10-hw b/libgcc/config/rs6000/t-float128-p10-hw index edaaee0e478b..ee50d248ca12 100644 --- a/libgcc/config/rs6000/t-float128-p10-hw +++ b/libgcc/config/rs6000/t-float128-p10-hw @@ -13,8 +13,7 @@ fp128_3_1_hw_shared_obj = $(addsuffix _s$(objext),$(fp128_3_1_hw_funcs)) fp128_3_1_hw_obj = $(fp128_3_1_hw_static_obj) $(fp128_3_1_hw_shared_obj) # Build the hardware support functions with appropriate hardware support -FP128_3_1_CFLAGS_HW = -Wno-type-limits -mvsx -mfloat128 \ - -mcpu=power10 \ +FP128_3_1_CFLAGS_HW = -Wno-type-limits -mfloat128 -mcpu=power10 \ -mfloat128-hardware -mno-gnu-attribute \ -I$(srcdir)/soft-fp \ -I$(srcdir)/config/rs6000 \ diff --git a/libgcc/configure b/libgcc/configure index a69d314374a3..635237a06c82 100755 --- a/libgcc/configure +++ b/libgcc/configure @@ -5184,9 +5184,15 @@ case ${host} in # check if we have VSX (ISA 2.06) support to build the software libraries, and # whether the assembler can handle xsaddqp for hardware support. Also check if # a new glibc is being used so that __builtin_cpu_supports can be used. +# +# with the VSX instruction set. This allowed the big endian GCC on server +# platforms to build the float128 support. However, is causes problems when +# other default cpu targets are used such as the 7450. Now +# libgcc_cv_powerpc_float128 will fail if the default cpu cannot build the +# float128 support. powerpc*-*-linux*) saved_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS -mabi=altivec -mvsx -mfloat128" + CFLAGS="$CFLAGS -mfloat128" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for PowerPC ISA 2.06 to build __float128 libraries" >&5 $as_echo_n "checking for PowerPC ISA 2.06 to build __float128 libraries... " >&6; } if ${libgcc_cv_powerpc_float128+:} false; then : diff --git a/libgcc/configure.ac b/libgcc/configure.ac index c2749fe09584..2a725a6f6620 100644 --- a/libgcc/configure.ac +++ b/libgcc/configure.ac @@ -407,9 +407,15 @@ case ${host} in # check if we have VSX (ISA 2.06) support to build the software libraries, and # whether the assembler can handle xsaddqp for hardware support. Also check if # a new glibc is being used so that __builtin_cpu_supports can be used. +# +# with the VSX instruction set. This allowed the big endian GCC on server +# platforms to build the float128 support. However, is causes problems when +# other default cpu targets are used such as the 7450. Now +# libgcc_cv_powerpc_float128 will fail if the default cpu cannot build the +# float128 support. powerpc*-*-linux*) saved_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS -mabi=altivec -mvsx -mfloat128" + CFLAGS="$CFLAGS -mfloat128" AC_CACHE_CHECK([for PowerPC ISA 2.06 to build __float128 libraries], [libgcc_cv_powerpc_float128], [AC_COMPILE_IFELSE(