Hi GCC team,
This patch introduces inline definitions for the __fma and __fmaf
functions in the ARM ACLE headers for both aarch64 and arm targets. The
new implementations use the built-in functions (__builtin_fma and
__builtin_fmaf) to ensure proper inlining and adherence to the ARM ACLE
requirements[1].
Changes include:
- In gcc/config/aarch64/arm_acle.h:
Added inline definitions for __fma and __fmaf.
- In gcc/config/arm/arm_acle.h:
Added inline definitions for __fma and __fmaf.
These changes have been tested locally, and I have verified that they
integrate smoothly with the existing ARM backend configurations. Please
let me know if you have any questions or need further modifications.
Thanks,
Ayan
[1] ARM ACLE Document:
https://arm-software.github.io/acle/main/acle.html#fused-multiply-accumulate-fma
Signed-off-by: Ayan Shafqat <[email protected]>
diff --git a/gcc/config/aarch64/arm_acle.h b/gcc/config/aarch64/arm_acle.h
index 7976c117daf..d9e2401ea9f 100644
--- a/gcc/config/aarch64/arm_acle.h
+++ b/gcc/config/aarch64/arm_acle.h
@@ -129,6 +129,20 @@ __jcvt (double __a)
#pragma GCC pop_options
+__extension__ extern __inline double
+__attribute__ ((__always_inline__, __gnu_inline__, __artificial__))
+__fma (double __x, double __y, double __z)
+{
+ return __builtin_fma (__x, __y, __z);
+}
+
+__extension__ extern __inline float
+__attribute__ ((__always_inline__, __gnu_inline__, __artificial__))
+__fmaf (float __x, float __y, float __z)
+{
+ return __builtin_fmaf (__x, __y, __z);
+}
+
#pragma GCC push_options
#pragma GCC target ("+nothing+frintts")
__extension__ extern __inline float
diff --git a/gcc/config/arm/arm_acle.h b/gcc/config/arm/arm_acle.h
index c6c03fdce27..256710a2c31 100644
--- a/gcc/config/arm/arm_acle.h
+++ b/gcc/config/arm/arm_acle.h
@@ -829,6 +829,20 @@ __crc32cd (uint32_t __a, uint64_t __b)
#endif /* __ARM_FEATURE_CRC32 */
#pragma GCC pop_options
+__extension__ extern __inline double
+__attribute__ ((__always_inline__, __gnu_inline__, __artificial__))
+__fma (double __x, double __y, double __z)
+{
+ return __builtin_fma (__x, __y, __z);
+}
+
+__extension__ extern __inline float
+__attribute__ ((__always_inline__, __gnu_inline__, __artificial__))
+__fmaf (float __x, float __y, float __z)
+{
+ return __builtin_fmaf (__x, __y, __z);
+}
+
#ifdef __cplusplus
}
#endif