Revert "Revert "Use compiler builtins for fabs.""
Don't enable the inlines when building libm itself. Otherwise clang gets
upset by seeing both an inline and a non-inline definition.
This reverts commit c5deb0f883cbdca7e5ab75f92f82c31d21367f49.
Change-Id: If7abdb351f5a5549d6a331b33af408e8fcfa9868
diff --git a/libm/include/math.h b/libm/include/math.h
index bc48b6a..ce8e3b2 100644
--- a/libm/include/math.h
+++ b/libm/include/math.h
@@ -20,6 +20,12 @@
#include <sys/cdefs.h>
#include <limits.h>
+#if !defined(__BIONIC_NO_MATH_INLINES)
+#define __BIONIC_MATH_INLINE(__def) extern __inline__ __always_inline __attribute__((gnu_inline)) __attribute__((__artificial__)) __def
+#else
+#define __BIONIC_MATH_INLINE(__def)
+#endif
+
__BEGIN_DECLS
#pragma GCC visibility push(default)
@@ -161,6 +167,7 @@
double ceil(double);
double fabs(double) __pure2;
+__BIONIC_MATH_INLINE(double fabs(double x) { return __builtin_fabs(x); })
double floor(double);
double fmod(double, double);
@@ -279,6 +286,7 @@
float ceilf(float);
float fabsf(float) __pure2;
+__BIONIC_MATH_INLINE(float fabsf(float x) { return __builtin_fabsf(x); })
float floorf(float);
float fmodf(float, float);
float roundf(float);
@@ -366,6 +374,7 @@
long double expl(long double);
long double expm1l(long double);
long double fabsl(long double) __pure2;
+__BIONIC_MATH_INLINE(long double fabsl(long double x) { return __builtin_fabsl(x); })
long double fdiml(long double, long double);
long double floorl(long double);
long double fmal(long double, long double, long double);