This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH 1/9 v3] Optimized generic expf and exp2f with wrappers


On Tue, 19 Sep 2017, Szabolcs Nagy wrote:

> diff --git a/sysdeps/aarch64/fpu/math_private.h b/sysdeps/aarch64/fpu/math_private.h
> index 807111ea5a..775237ffb2 100644
> --- a/sysdeps/aarch64/fpu/math_private.h
> +++ b/sysdeps/aarch64/fpu/math_private.h
> @@ -319,6 +319,26 @@ libc_feresetround_noex_aarch64_ctx (struct rm_ctx *ctx)
>  #define libc_feresetround_noexf_ctx	libc_feresetround_noex_aarch64_ctx
>  #define libc_feresetround_noexl_ctx	libc_feresetround_noex_aarch64_ctx
>  
> +/* Hack: only include the large arm_neon.h when needed.  */
> +#ifdef _MATH_CONFIG_H
> +#include <arm_neon.h>
> +
> +/* ACLE intrinsics for frintn and fcvtns instructions.  */
> +#define TOINT_INTRINSICS 1

I'd expect preprocessor indentation here, "# include" and "# define", 
inside #ifdef (I think it's only the toplevel multiple-include conditional 
around a whole file that doesn't get such indentation used).

> +  /* x = k/N + r with r in [-1/(2N), 1/(2N)] and int k.  */
> +  kd = (double) (xd + SHIFT); /* Rounding to double precision is required.  */

Remark (not an issue while this code isn't used for 32-bit x86): a cast 
may not achieve that rounding with the default -fexcess-precision=fast so 
using this code for 32-bit x86 might require math_narrow_eval here.

> +extern const struct exp2f_data
> +{
> +  uint64_t tab[1 << EXP2F_TABLE_BITS];
> +  double shift_scaled;
> +  double poly[EXP2F_POLY_ORDER];
> +  double shift;
> +  double invln2_scaled;
> +  double poly_scaled[EXP2F_POLY_ORDER];
> +} __exp2f_data;

This ought to be attribute_hidden as well.

OK with the preprocessor indentation and attribute_hidden fixes.

-- 
Joseph S. Myers
joseph@codesourcery.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]