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.
This commit is contained in:
1 parent
cb1875eb4f
commit
e4355bd6be
16 files changed
+60
-40
No files matched your search
@@ -0,0 +1,15 @@
|
||||
#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
|
||||
@@ -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
|
||||
@@ -0,0 +1,15 @@
|
||||
#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
|
||||
@@ -0,0 +1,15 @@
|
||||
#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
|
||||
@@ -1 +0,0 @@
|
||||
../armhf/fabs.s
|
||||
@@ -1 +0,0 @@
|
||||
../armhf/fabsf.s
|
||||
@@ -1 +0,0 @@
|
||||
../armhf/sqrt.s
|
||||
@@ -1 +0,0 @@
|
||||
../armhf/sqrtf.s
|
||||
@@ -1,8 +0,0 @@
|
||||
.syntax unified
|
||||
.fpu vfp
|
||||
.text
|
||||
.global fabs
|
||||
.type fabs,%function
|
||||
fabs:
|
||||
vabs.f64 d0, d0
|
||||
bx lr
|
||||
@@ -1 +0,0 @@
|
||||
fabs.s
|
||||
@@ -1,8 +0,0 @@
|
||||
.syntax unified
|
||||
.fpu vfp
|
||||
.text
|
||||
.global fabsf
|
||||
.type fabsf,%function
|
||||
fabsf:
|
||||
vabs.f32 s0, s0
|
||||
bx lr
|
||||
@@ -1 +0,0 @@
|
||||
fabsf.s
|
||||
@@ -1,8 +0,0 @@
|
||||
.syntax unified
|
||||
.fpu vfp
|
||||
.text
|
||||
.global sqrt
|
||||
.type sqrt,%function
|
||||
sqrt:
|
||||
vsqrt.f64 d0, d0
|
||||
bx lr
|
||||
@@ -1 +0,0 @@
|
||||
sqrt.s
|
||||
@@ -1,8 +0,0 @@
|
||||
.syntax unified
|
||||
.fpu vfp
|
||||
.text
|
||||
.global sqrtf
|
||||
.type sqrtf,%function
|
||||
sqrtf:
|
||||
vsqrt.f32 s0, s0
|
||||
bx lr
|
||||
@@ -1 +0,0 @@
|
||||
sqrtf.s
|
||||
Reference in new issue
Block a user