File tree Expand file tree Collapse file tree 1 file changed +8
-0
lines changed
libc/src/__support/FPUtil/aarch64 Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -25,17 +25,25 @@ namespace fputil {
2525
2626#ifdef LIBC_TARGET_CPU_HAS_ARM_FPU_FLOAT
2727template <> LIBC_INLINE float sqrt<float >(float x) {
28+ #if __has_builtin(__builtin_elementwise_sqrt)
29+ return __builtin_elementwise_sqrt (x);
30+ #else
2831 float y;
2932 asm (" fsqrt %s0, %s1\n\t " : " =w" (y) : " w" (x));
3033 return y;
34+ #endif // __builtin_elementwise_sqrt
3135}
3236#endif // LIBC_TARGET_CPU_HAS_ARM_FPU_FLOAT
3337
3438#ifdef LIBC_TARGET_CPU_HAS_ARM_FPU_DOUBLE
3539template <> LIBC_INLINE double sqrt<double >(double x) {
40+ #if __has_builtin(__builtin_elementwise_sqrt)
41+ return __builtin_elementwise_sqrt (x);
42+ #else
3643 double y;
3744 asm (" fsqrt %d0, %d1\n\t " : " =w" (y) : " w" (x));
3845 return y;
46+ #endif // __builtin_elementwise_sqrt
3947}
4048#endif // LIBC_TARGET_CPU_HAS_ARM_FPU_DOUBLE
4149
You can’t perform that action at this time.
0 commit comments