https://gcc.gnu.org/g:5b62b27b2f30b678e2f9ba4f743ce080ea51f1dc
commit 5b62b27b2f30b678e2f9ba4f743ce080ea51f1dc Author: Michael Meissner <meiss...@linux.ibm.com> Date: Mon Jul 15 13:11:49 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. In addition to the changes in libgcc, this patch also changes the GCC tests so that it will only test float128 if the default compiler enables the VSX instruction set. Otherwise all of the float128 tests will fail because the libgcc support is not available. 2024-07-15 Michael Meissner <meiss...@linux.ibm.com> gcc/testsuite/ PR target/115800 PR target/113652 * lib/target-supports.exp (check_ppc_float128_sw_available): Do not add the -mvsx option. (check_effective_target___float128): Likewise. 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: --- gcc/testsuite/lib/target-supports.exp | 8 ++++---- 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 +++++++- 7 files changed, 33 insertions(+), 17 deletions(-) diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp index b7df6150bcbd..ca5276873064 100644 --- a/gcc/testsuite/lib/target-supports.exp +++ b/gcc/testsuite/lib/target-supports.exp @@ -2979,7 +2979,7 @@ proc check_ppc_float128_sw_available { } { || [istarget *-*-darwin*]} { expr 0 } else { - set options "-mfloat128 -mvsx" + set options "-mfloat128" check_runtime_nocache ppc_float128_sw_available { volatile __float128 x = 1.0q; volatile __float128 y = 2.0q; @@ -3005,7 +3005,7 @@ proc check_ppc_float128_hw_available { } { || [istarget *-*-darwin*]} { expr 0 } else { - set options "-mfloat128 -mvsx -mfloat128-hardware -mcpu=power9" + set options "-mfloat128 -mfloat128-hardware -mcpu=power9" check_runtime_nocache ppc_float128_hw_available { volatile __float128 x = 1.0q; volatile __float128 y = 2.0q; @@ -3947,7 +3947,7 @@ proc check_effective_target___float128 { } { proc add_options_for___float128 { flags } { if { [istarget powerpc*-*-linux*] } { - return "$flags -mfloat128 -mvsx" + return "$flags -mfloat128" } return "$flags" } @@ -7234,7 +7234,7 @@ proc check_effective_target_powerpc_float128_sw_ok { } { __float128 z = x + y; return (z == 3.0q); } - } "-mfloat128 -mvsx"] + } "-mfloat128"] } else { return 0 } 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(