[PATCHv4 2/2] powerpc64le: ifunc (almost) all *f128 routines in multiarch mode

Tulio Magno Quites Machado Filho tuliom@ascii.art.br
Fri Jun 19 22:36:01 GMT 2020


"Paul E. Murphy via Libc-alpha" <libc-alpha@sourceware.org> writes:

> diff --git a/sysdeps/powerpc/powerpc64/le/fpu/multiarch/Makefile b/sysdeps/powerpc/powerpc64/le/fpu/multiarch/Makefile
> index 8747b02127..3974345d24 100644
> --- a/sysdeps/powerpc/powerpc64/le/fpu/multiarch/Makefile
> +++ b/sysdeps/powerpc/powerpc64/le/fpu/multiarch/Makefile
> @@ -1,10 +1,208 @@
>  ifeq ($(subdir),math)
> -libm-sysdep_routines += s_fmaf128-ppc64 s_fmaf128-power9 \
> -			w_sqrtf128-power9 w_sqrtf128-ppc64le
>  
> -CFLAGS-s_fmaf128-ppc64.c += $(type-float128-CFLAGS) $(no-gnu-attribute-CFLAGS)
> -CFLAGS-s_fmaf128-power9.c += $(type-float128-CFLAGS) -mcpu=power9 $(no-gnu-attribute-CFLAGS)
> +#
> +# Only enable ifunc _Float128 support if the baseline cpu support
> +# is older than power9.
> +ifneq (yes,$(libc-submachine-power9))
> +do_f128_multiarch = yes
> +endif

I expected that:

--disable-multi-arch	-> do_f128_multiarch = no,	OK
--with-cpu=power8	-> do_f128_multiarch = yes,	OK
--with-cpu=power9	-> do_f128_multiarch = no,	OK
--with-cpu=power >= 9	-> do_f128_multiarch = no,	OK

The last line is true because Makeconfig is inherited based on Implies.
So, looks good.

> +#   * float128_private.h is currently used to rename the ldouble == ieee128
> +#                      object files today.  This takes it a step further and
> +#                      redirects symbols to _power9 or _power8 variants of the
> +#                      functions.  This supports nearly all files in
> +#                      sysdeps/ieee754/float128, but not all _Float128 objects.
> +#                      However, there are three distinct build configurations
> +#                      used to compile _Float128 support.  Two other headers
> +#                      below complete the ABI redirection.
> +#   * math-type-macros-float128.h supports renames for the common object files
> +#                      which are built from templates in math/.
> +#   * math_private.h provides rename support for the common files built in math/
> +#                      which are neither template generated nor ldbl-128 specific.
> +#                      It should be noted that float128_private.h and math_private.h
> +#                      overlap in their declarations, and are used orthogonally.

There are a couple of long lines here.

> --- /dev/null
> +++ b/sysdeps/powerpc/powerpc64/le/fpu/multiarch/float128-ifunc-redirect-macros.h
> +   F128_SFX_APPEND(sym)
> +    Append the the multiarch cpu specific suffix to the sym. sym is not
> +    expanded.  This is sym ## cpu, where cpu is eiter power8 or power9

s/eiter/either/

> +/* _F128_IFUNC2(func, from, r)
> +      Generate an ifunc symbol func ## r from the symbols
> +	from ## {power8, power9} ## r
> +
> +      We use the PPC hwcap bit HAS_IEEE128 to select between the two with
> +      the assumption all P9 features are available on such targets.  */
> +#define _F128_IFUNC2(func, from, r) \
> +	libc_ifunc (func ## r, (hwcap2 & PPC_FEATURE2_HAS_IEEE128) \
> +                                ? from ## _power9 ## r : from ## _power8 ## r)

OK.

> diff --git a/sysdeps/powerpc/powerpc64/le/fpu/multiarch/math-type-macros-float128.h b/sysdeps/powerpc/powerpc64/le/fpu/multiarch/math-type-macros-float128.h
> new file mode 100644
> index 0000000000..bc210b17cf
> --- /dev/null
> +++ b/sysdeps/powerpc/powerpc64/le/fpu/multiarch/math-type-macros-float128.h
> +/* This is hack.  The build directory is favored over the sysdep directorys.

s/directorys/directories/

LGTM.

Reviewed-by: Tulio Magno Quites Machado Filho <tuliom@linux.ibm.com>

-- 
Tulio Magno



More information about the Libc-alpha mailing list