[PATCH] math: Improve layout of exp/exp10 data

Adhemerval Zanella Netto adhemerval.zanella@linaro.org
Thu Feb 13 16:56:14 GMT 2025



On 17/12/24 14:26, Wilco Dijkstra wrote:
> 
> GCC aligns global data to 16 bytes if their size is >= 16 bytes.  This patch
> changes the exp_data struct slightly so that the fields are better aligned
> and without gaps.  As a result on targets that support them, more load-pair
> instructions are used in exp.  Exp10 is improved by moving invlog10_2N later
> so that neglog10_2hiN and neglog10_2loN can be loaded using load-pair.
> 
> The exp benchmark improves 2.5%, "144bits" by 7.2%, "768bits" by 12.7% on
> Neoverse V2.  Exp10 improves by 1.5%.
> 
> Passes regress, OK for commit?

LGTM, thanks.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>

> 
> ---
> 
> diff --git a/sysdeps/ieee754/dbl-64/math_config.h b/sysdeps/ieee754/dbl-64/math_config.h
> index ef87cfa6be9860e3c11d44585bda02612369fa6d..05515fd95ad15d52499860539f7a1c20f4bca248 100644
> --- a/sysdeps/ieee754/dbl-64/math_config.h
> +++ b/sysdeps/ieee754/dbl-64/math_config.h
> @@ -195,16 +195,18 @@ check_uflow (double x)
>  extern const struct exp_data
>  {
>    double invln2N;
> -  double shift;
>    double negln2hiN;
>    double negln2loN;
>    double poly[4]; /* Last four coefficients.  */
> +  double shift;
> +
>    double exp2_shift;
>    double exp2_poly[EXP2_POLY_ORDER];
> -  double invlog10_2N;
> +
>    double neglog10_2hiN;
>    double neglog10_2loN;
>    double exp10_poly[5];
> +  double invlog10_2N;
>    uint64_t tab[2*(1 << EXP_TABLE_BITS)];
>  } __exp_data attribute_hidden;
>  



More information about the Libc-alpha mailing list