[2/3] AArch64: Add __sqrt and __sqrtf intrinsics to arm_acle.h

Message ID Z9DSQUjfPilrAC2r@sawtooth
State New
Headers
Series [1/3] AArch64: Use BUILTIN_VHSDF_HSDF for vector and scalar sqrt builtins |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_gcc_build--master-aarch64 success Build passed

Commit Message

Ayan Shafqat March 12, 2025, 12:16 a.m. UTC
  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.

Signed-off-by: Ayan Shafqat <ayan.x.shafqat@gmail.com>
---
 gcc/config/aarch64/arm_acle.h | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
  

Patch

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)
+{
+    return __builtin_aarch64_sqrtdf (__x);
+}
+
+__extension__ extern __inline float
+__attribute__ ((__always_inline__, __gnu_inline__, __artificial__))
+__sqrtf(float __x)
+{
+    return __builtin_aarch64_sqrtsf (__x);
+}
+
 #pragma GCC push_options
 #pragma GCC target ("+nothing+jscvt")
 __extension__ extern __inline int32_t