On Thu, Mar 13, 2025 at 05:23:00PM -0400, Ayan Shafqat wrote:
> This patch introduces two new inline functions, __sqrt and __sqrtf, in
> arm_acle.h for Aarch64 targets. These functions wrap the new builtins
> __builtin_aarch64_sqrtdf and __builtin_aarch64_sqrtsf, respectively,
> providing direct access to hardware instructions without relying on the
> standard math library or optimization levels.
>
> gcc/ChangeLog:
>
> * config/aarch64/arm_acle.h (__sqrt, __sqrtf): New function.
>
> Signed-off-by: Ayan Shafqat <[email protected]>
> ---
> gcc/config/aarch64/arm_acle.h | 14 ++++++++++++++
> 1 file changed, 14 insertions(+)
>
> diff --git a/gcc/config/aarch64/arm_acle.h b/gcc/config/aarch64/arm_acle.h
> index 7976c117daf..d972a4e7e7e 100644
> --- a/gcc/config/aarch64/arm_acle.h
> +++ b/gcc/config/aarch64/arm_acle.h
> @@ -118,6 +118,20 @@ __revl (unsigned long __value)
> return __rev (__value);
> }
>
> +__extension__ extern __inline double
> +__attribute__ ((__always_inline__, __gnu_inline__, __artificial__))
> +__sqrt(double __x)
Just formatting nits, there should be space in between the function name
and ( and only one space between double and __x.
Also, it is unclear why it uses __extension__ (but admittedly it is used
elsewhere in the header.
> +{
> + return __builtin_aarch64_sqrtdf (__x);
Just two space indentation rather than 4 spaces.
> +}
> +
> +__extension__ extern __inline float
> +__attribute__ ((__always_inline__, __gnu_inline__, __artificial__))
> +__sqrtf(float __x)
See above
> +{
> + return __builtin_aarch64_sqrtsf (__x);
Ditto
Jakub