rs6000: Fix typos in float128 ISA3.1 support

The recent float128 ISA3.1 support (r12-1340) has some typos,
it makes the libgcc build fail if it's with one binutils
(assembler) which doesn't support Power10 insns.  The error
looks like:

Error: invalid switch -mpower10
Error: unrecognized option -mpower10
... [...libgcc/shared-object.mk:14: float128-p10.o] Error 1

What this patch does are:
  - fix test target typo libgcc_cv_powerpc_3_1_float128_hw
    (written wrongly as libgcc_cv_powerpc_float128_hw, so it's
     going to build ISA3.1 stuffs just when detecting ISA3.0).
  - fix test used for libgcc_cv_powerpc_3_1_float128_hw check.
  - fix test option used for libgcc_cv_powerpc_3_1_float128_hw
    check.
  - remove the ISA3.1 related contents from t-float128-hw.
  - add new macro FLOAT128_HW_INSNS_ISA3_1 to differentiate
    ISA3.1 content from ISA3.0 part in ifunc support.

Bootstrapped/regtested on:
  - powerpc64le-linux-gnu P10
  - powerpc64le-linux-gnu P9 (w/i and w/o p10 supported as)
  - powerpc64-linux-gnu P8 (w/i and w/o p10 supported as)

libgcc/ChangeLog:

	* configure: Regenerate.
	* configure.ac (test for libgcc_cv_powerpc_3_1_float128_hw): Fix
	typos among the name, CFLAGS and the test.
	* config/rs6000/t-float128-hw (fp128_3_1_hw_funcs, fp128_3_1_hw_src,
	fp128_3_1_hw_static_obj, fp128_3_1_hw_shared_obj, fp128_3_1_hw_obj):
	Remove.
	* config/rs6000/t-float128-p10-hw (FLOAT128_HW_INSNS): Append
	macro FLOAT128_HW_INSNS_ISA3_1.
	(FP128_3_1_CFLAGS_HW): Fix option typo.
	* config/rs6000/float128-ifunc.c (SW_OR_HW_ISA3_1): Guard this with
	FLOAT128_HW_INSNS_ISA3_1.
	(__floattikf_resolve): Likewise.
	(__floatuntikf_resolve): Likewise.
	(__fixkfti_resolve): Likewise.
	(__fixunskfti_resolve): Likewise.
	(__floattikf): Likewise.
	(__floatuntikf): Likewise.
	(__fixkfti): Likewise.
	(__fixunskfti): Likewise.
This commit is contained in:
Kewen Lin 2021-06-22 23:09:30 -05:00
parent 419af06a35
commit 47749c43ac
5 changed files with 26 additions and 35 deletions

View File

@ -46,7 +46,9 @@
#endif
#define SW_OR_HW(SW, HW) (__builtin_cpu_supports ("ieee128") ? HW : SW)
#ifdef FLOAT128_HW_INSNS_ISA3_1
#define SW_OR_HW_ISA3_1(SW, HW) (__builtin_cpu_supports ("arch_3_1") ? HW : SW)
#endif
/* Resolvers. */
static __typeof__ (__addkf3_sw) *
@ -97,6 +99,7 @@ __floatdikf_resolve (void)
return SW_OR_HW (__floatdikf_sw, __floatdikf_hw);
}
#ifdef FLOAT128_HW_INSNS_ISA3_1
static __typeof__ (__floattikf_sw) *
__floattikf_resolve (void)
{
@ -108,6 +111,7 @@ __floatuntikf_resolve (void)
{
return SW_OR_HW_ISA3_1 (__floatuntikf_sw, __floatuntikf_hw);
}
#endif
static __typeof__ (__floatunsikf_sw) *
__floatunsikf_resolve (void)
@ -121,7 +125,7 @@ __floatundikf_resolve (void)
return SW_OR_HW (__floatundikf_sw, __floatundikf_hw);
}
#ifdef FLOAT128_HW_INSNS_ISA3_1
static __typeof__ (__fixkfti_sw) *
__fixkfti_resolve (void)
{
@ -133,6 +137,7 @@ __fixunskfti_resolve (void)
{
return SW_OR_HW_ISA3_1 (__fixunskfti_sw, __fixunskfti_hw);
}
#endif
static __typeof__ (__fixkfsi_sw) *
__fixkfsi_resolve (void)
@ -323,6 +328,7 @@ TFtype __floatsikf (SItype_ppc)
TFtype __floatdikf (DItype_ppc)
__attribute__ ((__ifunc__ ("__floatdikf_resolve")));
#ifdef FLOAT128_HW_INSNS_ISA3_1
TFtype __floattikf (TItype_ppc)
__attribute__ ((__ifunc__ ("__floattikf_resolve")));
@ -334,6 +340,7 @@ TItype_ppc __fixkfti (TFtype)
UTItype_ppc __fixunskfti (TFtype)
__attribute__ ((__ifunc__ ("__fixunskfti_resolve")));
#endif
TFtype __floatunsikf (USItype_ppc)
__attribute__ ((__ifunc__ ("__floatunsikf_resolve")));

View File

@ -13,13 +13,6 @@ fp128_hw_static_obj = $(addsuffix $(objext),$(fp128_hw_funcs))
fp128_hw_shared_obj = $(addsuffix _s$(objext),$(fp128_hw_funcs))
fp128_hw_obj = $(fp128_hw_static_obj) $(fp128_hw_shared_obj)
# New functions for ISA 3.1 hardware support
fp128_3_1_hw_funcs = float128-p10
fp128_3_1_hw_src = $(srcdir)/config/rs6000/float128-p10.c
fp128_3_1_hw_static_obj = $(addsuffix $(objext),$(fp128_3_1_hw_funcs))
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)
fp128_ifunc_funcs = float128-ifunc
fp128_ifunc_src = $(srcdir)/config/rs6000/float128-ifunc.c
fp128_ifunc_static_obj = float128-ifunc$(objext)
@ -37,18 +30,9 @@ FP128_CFLAGS_HW = -Wno-type-limits -mvsx -mfloat128 \
-I$(srcdir)/config/rs6000 \
$(FLOAT128_HW_INSNS)
FP128_3_1_CFLAGS_HW = -Wno-type-limits -mvsx -mcpu=power10 \
-mfloat128-hardware -mno-gnu-attribute \
-I$(srcdir)/soft-fp \
-I$(srcdir)/config/rs6000 \
$(FLOAT128_HW_INSNS)
$(fp128_hw_obj) : INTERNAL_CFLAGS += $(FP128_CFLAGS_HW)
$(fp128_hw_obj) : $(srcdir)/config/rs6000/t-float128-hw
$(fp128_3_1_hw_obj) : INTERNAL_CFLAGS += $(FP128_3_1_CFLAGS_HW)
$(fp128_3_1_hw_obj) : $(srcdir)/config/rs6000/t-float128-p10-hw
$(fp128_ifunc_obj) : INTERNAL_CFLAGS += $(FP128_CFLAGS_SW)
$(fp128_ifunc_obj) : $(srcdir)/config/rs6000/t-float128-hw

View File

@ -2,7 +2,7 @@
# Tell the float128 functions that the ISA 3.1 hardware support can
# be compiled it to be selected via IFUNC functions.
FLOAT128_HW_INSNS = -DFLOAT128_HW_INSNS
FLOAT128_HW_INSNS += -DFLOAT128_HW_INSNS_ISA3_1
# New functions for hardware support
@ -14,7 +14,7 @@ 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 \
-mpower10 \
-mcpu=power10 \
-mfloat128-hardware -mno-gnu-attribute \
-I$(srcdir)/soft-fp \
-I$(srcdir)/config/rs6000 \

18
libgcc/configure vendored
View File

@ -5265,10 +5265,10 @@ $as_echo "$libgcc_cv_powerpc_float128_hw" >&6; }
CFLAGS="$saved_CFLAGS"
saved_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -mpower10 -mfloat128-hardware"
CFLAGS="$CFLAGS -mcpu=power10 -mfloat128-hardware"
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for PowerPC ISA 3.1 to build hardware __float128 libraries" >&5
$as_echo_n "checking for PowerPC ISA 3.1 to build hardware __float128 libraries... " >&6; }
if ${libgcc_cv_powerpc_float128_hw+:} false; then :
if ${libgcc_cv_powerpc_3_1_float128_hw+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@ -5280,15 +5280,15 @@ else
#ifndef __BUILTIN_CPU_SUPPORTS__
#error "__builtin_cpu_supports is not available"
#endif
vector unsigned char add (vector unsigned char a, vector unsigned char b)
vector unsigned char conv (vector unsigned char qs)
{
vector unsigned char ret;
__asm__ ("xscvsqqp %0,%1,%2" : "=v" (ret) : "v" (a), "v" (b));
__asm__ ("xscvsqqp %0,%1" : "=v" (ret) : "v" (qs));
return ret;
}
void *add_resolver (void) { return (void *) add; }
__float128 add_ifunc (__float128, __float128)
__attribute__ ((__ifunc__ ("add_resolver")));
void *conv_resolver (void) { return (void *) conv; }
__float128 conv_ifunc (__float128)
__attribute__ ((__ifunc__ ("conv_resolver")));
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
libgcc_cv_powerpc_3_1_float128_hw=yes
@ -5297,8 +5297,8 @@ else
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libgcc_cv_powerpc_float128_hw" >&5
$as_echo "$libgcc_cv_powerpc_float128_hw" >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libgcc_cv_powerpc_3_1_float128_hw" >&5
$as_echo "$libgcc_cv_powerpc_3_1_float128_hw" >&6; }
CFLAGS="$saved_CFLAGS"
esac

View File

@ -460,9 +460,9 @@ powerpc*-*-linux*)
CFLAGS="$saved_CFLAGS"
saved_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -mpower10 -mfloat128-hardware"
CFLAGS="$CFLAGS -mcpu=power10 -mfloat128-hardware"
AC_CACHE_CHECK([for PowerPC ISA 3.1 to build hardware __float128 libraries],
[libgcc_cv_powerpc_float128_hw],
[libgcc_cv_powerpc_3_1_float128_hw],
[AC_COMPILE_IFELSE(
[AC_LANG_SOURCE([#include <sys/auxv.h>
#ifndef AT_PLATFORM
@ -471,15 +471,15 @@ powerpc*-*-linux*)
#ifndef __BUILTIN_CPU_SUPPORTS__
#error "__builtin_cpu_supports is not available"
#endif
vector unsigned char add (vector unsigned char a, vector unsigned char b)
vector unsigned char conv (vector unsigned char qs)
{
vector unsigned char ret;
__asm__ ("xscvsqqp %0,%1,%2" : "=v" (ret) : "v" (a), "v" (b));
__asm__ ("xscvsqqp %0,%1" : "=v" (ret) : "v" (qs));
return ret;
}
void *add_resolver (void) { return (void *) add; }
__float128 add_ifunc (__float128, __float128)
__attribute__ ((__ifunc__ ("add_resolver")));])],
void *conv_resolver (void) { return (void *) conv; }
__float128 conv_ifunc (__float128)
__attribute__ ((__ifunc__ ("conv_resolver")));])],
[libgcc_cv_powerpc_3_1_float128_hw=yes],
[libgcc_cv_powerpc_3_1_float128_hw=no])])
CFLAGS="$saved_CFLAGS"