about summary refs log tree commit diff
path: root/src/math/arm/fabsf.c
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2016-01-20 01:09:57 +0000
committerRich Felker <dalias@aerifal.cx>2016-01-20 01:09:57 +0000
commite4355bd6bec89688e8c739cd7b4c76e675643dca (patch)
tree53b4f0f0d7c5ba7e636edee2e0a977afacde931f /src/math/arm/fabsf.c
parentcb1875eb4ff755fe6c5d1909f64fc4be1ee396ab (diff)
downloadmusl-e4355bd6bec89688e8c739cd7b4c76e675643dca.tar.gz
musl-e4355bd6bec89688e8c739cd7b4c76e675643dca.tar.xz
musl-e4355bd6bec89688e8c739cd7b4c76e675643dca.zip
replace armhf math asm source files with inline asm
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.
Diffstat (limited to 'src/math/arm/fabsf.c')
-rw-r--r--src/math/arm/fabsf.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/math/arm/fabsf.c b/src/math/arm/fabsf.c
new file mode 100644
index 00000000..28153a61
--- /dev/null
+++ b/src/math/arm/fabsf.c
@@ -0,0 +1,15 @@
+#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