From 4abab5ad6c8465a7528ccdd5f49367da05f78bbd Mon Sep 17 00:00:00 2001 From: Vladimir Azarov Date: Tue, 1 Oct 2024 15:47:05 +0200 Subject: Initial version --- src/math/powerpc/fabs.c | 15 +++++++++++++++ src/math/powerpc/fabsf.c | 15 +++++++++++++++ src/math/powerpc/fma.c | 15 +++++++++++++++ src/math/powerpc/fmaf.c | 15 +++++++++++++++ src/math/powerpc/sqrt.c | 15 +++++++++++++++ src/math/powerpc/sqrtf.c | 15 +++++++++++++++ 6 files changed, 90 insertions(+) create mode 100644 src/math/powerpc/fabs.c create mode 100644 src/math/powerpc/fabsf.c create mode 100644 src/math/powerpc/fma.c create mode 100644 src/math/powerpc/fmaf.c create mode 100644 src/math/powerpc/sqrt.c create mode 100644 src/math/powerpc/sqrtf.c (limited to 'src/math/powerpc') diff --git a/src/math/powerpc/fabs.c b/src/math/powerpc/fabs.c new file mode 100644 index 0000000..9453a3a --- /dev/null +++ b/src/math/powerpc/fabs.c @@ -0,0 +1,15 @@ +#include + +#if defined(_SOFT_FLOAT) || defined(__NO_FPRS__) || defined(BROKEN_PPC_D_ASM) + +#include "../fabs.c" + +#else + +double fabs(double x) +{ + __asm__ ("fabs %0, %1" : "=d"(x) : "d"(x)); + return x; +} + +#endif diff --git a/src/math/powerpc/fabsf.c b/src/math/powerpc/fabsf.c new file mode 100644 index 0000000..2e9da58 --- /dev/null +++ b/src/math/powerpc/fabsf.c @@ -0,0 +1,15 @@ +#include + +#if defined(_SOFT_FLOAT) || defined(__NO_FPRS__) + +#include "../fabsf.c" + +#else + +float fabsf(float x) +{ + __asm__ ("fabs %0, %1" : "=f"(x) : "f"(x)); + return x; +} + +#endif diff --git a/src/math/powerpc/fma.c b/src/math/powerpc/fma.c new file mode 100644 index 0000000..0eb2ba1 --- /dev/null +++ b/src/math/powerpc/fma.c @@ -0,0 +1,15 @@ +#include + +#if defined(_SOFT_FLOAT) || defined(__NO_FPRS__) || defined(BROKEN_PPC_D_ASM) + +#include "../fma.c" + +#else + +double fma(double x, double y, double z) +{ + __asm__("fmadd %0, %1, %2, %3" : "=d"(x) : "d"(x), "d"(y), "d"(z)); + return x; +} + +#endif diff --git a/src/math/powerpc/fmaf.c b/src/math/powerpc/fmaf.c new file mode 100644 index 0000000..dc1a749 --- /dev/null +++ b/src/math/powerpc/fmaf.c @@ -0,0 +1,15 @@ +#include + +#if defined(_SOFT_FLOAT) || defined(__NO_FPRS__) + +#include "../fmaf.c" + +#else + +float fmaf(float x, float y, float z) +{ + __asm__("fmadds %0, %1, %2, %3" : "=f"(x) : "f"(x), "f"(y), "f"(z)); + return x; +} + +#endif diff --git a/src/math/powerpc/sqrt.c b/src/math/powerpc/sqrt.c new file mode 100644 index 0000000..8718dbd --- /dev/null +++ b/src/math/powerpc/sqrt.c @@ -0,0 +1,15 @@ +#include + +#if !defined _SOFT_FLOAT && defined _ARCH_PPCSQ + +double sqrt(double x) +{ + __asm__ ("fsqrt %0, %1\n" : "=d" (x) : "d" (x)); + return x; +} + +#else + +#include "../sqrt.c" + +#endif diff --git a/src/math/powerpc/sqrtf.c b/src/math/powerpc/sqrtf.c new file mode 100644 index 0000000..3431b67 --- /dev/null +++ b/src/math/powerpc/sqrtf.c @@ -0,0 +1,15 @@ +#include + +#if !defined _SOFT_FLOAT && defined _ARCH_PPCSQ + +float sqrtf(float x) +{ + __asm__ ("fsqrts %0, %1\n" : "=f" (x) : "f" (x)); + return x; +} + +#else + +#include "../sqrtf.c" + +#endif -- cgit v1.2.3