diff options
Diffstat (limited to 'src/math/arm')
-rw-r--r-- | src/math/arm/fabs.c | 15 | ||||
-rw-r--r-- | src/math/arm/fabsf.c | 15 | ||||
-rw-r--r-- | src/math/arm/sqrt.c | 15 | ||||
-rw-r--r-- | src/math/arm/sqrtf.c | 15 |
4 files changed, 60 insertions, 0 deletions
diff --git a/src/math/arm/fabs.c b/src/math/arm/fabs.c new file mode 100644 index 00000000..f890520a --- /dev/null +++ b/src/math/arm/fabs.c @@ -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 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 diff --git a/src/math/arm/sqrt.c b/src/math/arm/sqrt.c new file mode 100644 index 00000000..c9c00083 --- /dev/null +++ b/src/math/arm/sqrt.c @@ -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 diff --git a/src/math/arm/sqrtf.c b/src/math/arm/sqrtf.c new file mode 100644 index 00000000..e6576655 --- /dev/null +++ b/src/math/arm/sqrtf.c @@ -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 |