this makes it possible to inline them with LTO, and is the simplest
approach to eliminating the use of .sub files.
this also makes VFP sqrt available for use with the standard EABI
(plain arm rather than armhf subarch) when libc is built with
-mfloat-abi=softfp. the same could have been done for fabs, but when
the argument and return value are in integer registers, moving to VFP
registers and back is almost certainly more costly than a simple
integer operation.
16 files changed:
--- /dev/null
+#include <math.h>
+
+#if __ARM_PCS_VFP
+
+double fabs(double x)
+{
+ __asm__ ("vabs.f64 %P0, %P1" : "=w"(x) : "w"(x));
+ return x;
+}
+
+#else
+
+#include "../fabs.c"
+
+#endif
--- /dev/null
+#include <math.h>
+
+#if __ARM_PCS_VFP
+
+float fabsf(float x)
+{
+ __asm__ ("vabs.f32 %0, %1" : "=t"(x) : "t"(x));
+ return x;
+}
+
+#else
+
+#include "../fabsf.c"
+
+#endif
--- /dev/null
+#include <math.h>
+
+#if __VFP_FP__ && !__SOFTFP__
+
+double sqrt(double x)
+{
+ __asm__ ("vsqrt.f64 %P0, %P1" : "=w"(x) : "w"(x));
+ return x;
+}
+
+#else
+
+#include "../sqrt.c"
+
+#endif
--- /dev/null
+#include <math.h>
+
+#if __VFP_FP__ && !__SOFTFP__
+
+float sqrtf(float x)
+{
+ __asm__ ("vsqrt.f32 %0, %1" : "=t"(x) : "t"(x));
+ return x;
+}
+
+#else
+
+#include "../sqrtf.c"
+
+#endif
+++ /dev/null
-../armhf/fabs.s
+++ /dev/null
-../armhf/fabsf.s
+++ /dev/null
-../armhf/sqrt.s
+++ /dev/null
-../armhf/sqrtf.s
+++ /dev/null
-.syntax unified
-.fpu vfp
-.text
-.global fabs
-.type fabs,%function
-fabs:
- vabs.f64 d0, d0
- bx lr
+++ /dev/null
-.syntax unified
-.fpu vfp
-.text
-.global fabsf
-.type fabsf,%function
-fabsf:
- vabs.f32 s0, s0
- bx lr
+++ /dev/null
-.syntax unified
-.fpu vfp
-.text
-.global sqrt
-.type sqrt,%function
-sqrt:
- vsqrt.f64 d0, d0
- bx lr
+++ /dev/null
-.syntax unified
-.fpu vfp
-.text
-.global sqrtf
-.type sqrtf,%function
-sqrtf:
- vsqrt.f32 s0, s0
- bx lr