diff --git a/src/math/riscv32/copysign.c b/src/math/riscv32/copysign.c new file mode 100644 index 00000000..c7854178 --- /dev/null +++ b/src/math/riscv32/copysign.c @@ -0,0 +1,15 @@ +#include + +#if __riscv_flen >= 64 + +double copysign(double x, double y) +{ + __asm__ ("fsgnj.d %0, %1, %2" : "=f"(x) : "f"(x), "f"(y)); + return x; +} + +#else + +#include "../copysign.c" + +#endif diff --git a/src/math/riscv32/copysign.s b/src/math/riscv32/copysign.s deleted file mode 100644 index 81afa8b2..00000000 --- a/src/math/riscv32/copysign.s +++ /dev/null @@ -1,5 +0,0 @@ -.global copysign -.type copysign, %function -copysign: - fsgnj.d fa0, fa0, fa1 - ret diff --git a/src/math/riscv32/copysignf.c b/src/math/riscv32/copysignf.c new file mode 100644 index 00000000..a125611a --- /dev/null +++ b/src/math/riscv32/copysignf.c @@ -0,0 +1,15 @@ +#include + +#if __riscv_flen >= 32 + +float copysignf(float x, float y) +{ + __asm__ ("fsgnj.s %0, %1, %2" : "=f"(x) : "f"(x), "f"(y)); + return x; +} + +#else + +#include "../copysignf.c" + +#endif diff --git a/src/math/riscv32/copysignf.s b/src/math/riscv32/copysignf.s deleted file mode 100644 index fe36f909..00000000 --- a/src/math/riscv32/copysignf.s +++ /dev/null @@ -1,5 +0,0 @@ -.global copysignf -.type copysignf, %function -copysignf: - fsgnj.s fa0, fa0, fa1 - ret diff --git a/src/math/riscv32/fabs.c b/src/math/riscv32/fabs.c new file mode 100644 index 00000000..5290b6f0 --- /dev/null +++ b/src/math/riscv32/fabs.c @@ -0,0 +1,15 @@ +#include + +#if __riscv_flen >= 64 + +double fabs(double x) +{ + __asm__ ("fabs.d %0, %1" : "=f"(x) : "f"(x)); + return x; +} + +#else + +#include "../fabs.c" + +#endif diff --git a/src/math/riscv32/fabs.s b/src/math/riscv32/fabs.s deleted file mode 100644 index 27def33c..00000000 --- a/src/math/riscv32/fabs.s +++ /dev/null @@ -1,5 +0,0 @@ -.global fabs -.type fabs, %function -fabs: - fabs.d fa0, fa0 - ret diff --git a/src/math/riscv32/fabsf.c b/src/math/riscv32/fabsf.c new file mode 100644 index 00000000..f5032e35 --- /dev/null +++ b/src/math/riscv32/fabsf.c @@ -0,0 +1,15 @@ +#include + +#if __riscv_flen >= 32 + +float fabsf(float x) +{ + __asm__ ("fabs.s %0, %1" : "=f"(x) : "f"(x)); + return x; +} + +#else + +#include "../fabsf.c" + +#endif diff --git a/src/math/riscv32/fabsf.s b/src/math/riscv32/fabsf.s deleted file mode 100644 index 8e0b9d64..00000000 --- a/src/math/riscv32/fabsf.s +++ /dev/null @@ -1,5 +0,0 @@ -.global fabsf -.type fabsf, %function -fabsf: - fabs.s fa0, fa0 - ret diff --git a/src/math/riscv32/fma.c b/src/math/riscv32/fma.c new file mode 100644 index 00000000..99b05713 --- /dev/null +++ b/src/math/riscv32/fma.c @@ -0,0 +1,15 @@ +#include + +#if __riscv_flen >= 64 + +double fma(double x, double y, double z) +{ + __asm__ ("fmadd.d %0, %1, %2, %3" : "=f"(x) : "f"(x), "f"(y), "f"(z)); + return x; +} + +#else + +#include "../fma.c" + +#endif diff --git a/src/math/riscv32/fma.s b/src/math/riscv32/fma.s deleted file mode 100644 index 17e1d136..00000000 --- a/src/math/riscv32/fma.s +++ /dev/null @@ -1,5 +0,0 @@ -.global fma -.type fma, %function -fma: - fmadd.d fa0, fa0, fa1, fa2 - ret diff --git a/src/math/riscv32/fmaf.c b/src/math/riscv32/fmaf.c new file mode 100644 index 00000000..f9dc47ed --- /dev/null +++ b/src/math/riscv32/fmaf.c @@ -0,0 +1,15 @@ +#include + +#if __riscv_flen >= 32 + +float fmaf(float x, float y, float z) +{ + __asm__ ("fmadd.s %0, %1, %2, %3" : "=f"(x) : "f"(x), "f"(y), "f"(z)); + return x; +} + +#else + +#include "../fmaf.c" + +#endif diff --git a/src/math/riscv32/fmaf.s b/src/math/riscv32/fmaf.s deleted file mode 100644 index cfe17100..00000000 --- a/src/math/riscv32/fmaf.s +++ /dev/null @@ -1,5 +0,0 @@ -.global fmaf -.type fmaf, %function -fmaf: - fmadd.s fa0, fa0, fa1, fa2 - ret diff --git a/src/math/riscv32/fmax.c b/src/math/riscv32/fmax.c new file mode 100644 index 00000000..023709cd --- /dev/null +++ b/src/math/riscv32/fmax.c @@ -0,0 +1,15 @@ +#include + +#if __riscv_flen >= 64 + +double fmax(double x, double y) +{ + __asm__ ("fmax.d %0, %1, %2" : "=f"(x) : "f"(x), "f"(y)); + return x; +} + +#else + +#include "../fmax.c" + +#endif diff --git a/src/math/riscv32/fmax.s b/src/math/riscv32/fmax.s deleted file mode 100644 index 40655d37..00000000 --- a/src/math/riscv32/fmax.s +++ /dev/null @@ -1,5 +0,0 @@ -.global fmax -.type fmax, %function -fmax: - fmax.d fa0, fa0, fa1 - ret diff --git a/src/math/riscv32/fmaxf.c b/src/math/riscv32/fmaxf.c new file mode 100644 index 00000000..863d2bd1 --- /dev/null +++ b/src/math/riscv32/fmaxf.c @@ -0,0 +1,15 @@ +#include + +#if __riscv_flen >= 32 + +float fmaxf(float x, float y) +{ + __asm__ ("fmax.s %0, %1, %2" : "=f"(x) : "f"(x), "f"(y)); + return x; +} + +#else + +#include "../fmaxf.c" + +#endif diff --git a/src/math/riscv32/fmaxf.s b/src/math/riscv32/fmaxf.s deleted file mode 100644 index 490b6e91..00000000 --- a/src/math/riscv32/fmaxf.s +++ /dev/null @@ -1,5 +0,0 @@ -.global fmaxf -.type fmaxf, %function -fmaxf: - fmax.s fa0, fa0, fa1 - ret diff --git a/src/math/riscv32/fmin.c b/src/math/riscv32/fmin.c new file mode 100644 index 00000000..a4e3b067 --- /dev/null +++ b/src/math/riscv32/fmin.c @@ -0,0 +1,15 @@ +#include + +#if __riscv_flen >= 64 + +double fmin(double x, double y) +{ + __asm__ ("fmin.d %0, %1, %2" : "=f"(x) : "f"(x), "f"(y)); + return x; +} + +#else + +#include "../fmin.c" + +#endif diff --git a/src/math/riscv32/fmin.s b/src/math/riscv32/fmin.s deleted file mode 100644 index 97f72e08..00000000 --- a/src/math/riscv32/fmin.s +++ /dev/null @@ -1,5 +0,0 @@ -.global fmin -.type fmin, %function -fmin: - fmin.d fa0, fa0, fa1 - ret diff --git a/src/math/riscv32/fminf.c b/src/math/riscv32/fminf.c new file mode 100644 index 00000000..32156e80 --- /dev/null +++ b/src/math/riscv32/fminf.c @@ -0,0 +1,15 @@ +#include + +#if __riscv_flen >= 32 + +float fminf(float x, float y) +{ + __asm__ ("fmin.s %0, %1, %2" : "=f"(x) : "f"(x), "f"(y)); + return x; +} + +#else + +#include "../fminf.c" + +#endif diff --git a/src/math/riscv32/fminf.s b/src/math/riscv32/fminf.s deleted file mode 100644 index 4f8e55ee..00000000 --- a/src/math/riscv32/fminf.s +++ /dev/null @@ -1,5 +0,0 @@ -.global fminf -.type fminf, %function -fminf: - fmin.s fa0, fa0, fa1 - ret diff --git a/src/math/riscv32/sqrt.c b/src/math/riscv32/sqrt.c new file mode 100644 index 00000000..75c34f7a --- /dev/null +++ b/src/math/riscv32/sqrt.c @@ -0,0 +1,15 @@ +#include + +#if __riscv_flen >= 64 + +double sqrt(double x) +{ + __asm__ ("sqrt.d %0, %1" : "=f"(x) : "f"(x)); + return x; +} + +#else + +#include "../sqrt.c" + +#endif diff --git a/src/math/riscv32/sqrt.s b/src/math/riscv32/sqrt.s deleted file mode 100644 index a4c8b3ea..00000000 --- a/src/math/riscv32/sqrt.s +++ /dev/null @@ -1,5 +0,0 @@ -.global sqrt -.type sqrt, %function -sqrt: - fsqrt.d fa0, fa0 - ret diff --git a/src/math/riscv32/sqrtf.c b/src/math/riscv32/sqrtf.c new file mode 100644 index 00000000..610c2cf8 --- /dev/null +++ b/src/math/riscv32/sqrtf.c @@ -0,0 +1,15 @@ +#include + +#if __riscv_flen >= 32 + +float sqrtf(float x) +{ + __asm__ ("fsqrt.s %0, %1" : "=f"(x) : "f"(x)); + return x; +} + +#else + +#include "../sqrtf.c" + +#endif diff --git a/src/math/riscv32/sqrtf.s b/src/math/riscv32/sqrtf.s deleted file mode 100644 index ff7abcf3..00000000 --- a/src/math/riscv32/sqrtf.s +++ /dev/null @@ -1,5 +0,0 @@ -.global sqrtf -.type sqrtf, %function -sqrtf: - fsqrt.s fa0, fa0 - ret diff --git a/src/math/riscv64/copysign.c b/src/math/riscv64/copysign.c new file mode 100644 index 00000000..c7854178 --- /dev/null +++ b/src/math/riscv64/copysign.c @@ -0,0 +1,15 @@ +#include + +#if __riscv_flen >= 64 + +double copysign(double x, double y) +{ + __asm__ ("fsgnj.d %0, %1, %2" : "=f"(x) : "f"(x), "f"(y)); + return x; +} + +#else + +#include "../copysign.c" + +#endif diff --git a/src/math/riscv64/copysign.s b/src/math/riscv64/copysign.s deleted file mode 100644 index 81afa8b2..00000000 --- a/src/math/riscv64/copysign.s +++ /dev/null @@ -1,5 +0,0 @@ -.global copysign -.type copysign, %function -copysign: - fsgnj.d fa0, fa0, fa1 - ret diff --git a/src/math/riscv64/copysignf.c b/src/math/riscv64/copysignf.c new file mode 100644 index 00000000..a125611a --- /dev/null +++ b/src/math/riscv64/copysignf.c @@ -0,0 +1,15 @@ +#include + +#if __riscv_flen >= 32 + +float copysignf(float x, float y) +{ + __asm__ ("fsgnj.s %0, %1, %2" : "=f"(x) : "f"(x), "f"(y)); + return x; +} + +#else + +#include "../copysignf.c" + +#endif diff --git a/src/math/riscv64/copysignf.s b/src/math/riscv64/copysignf.s deleted file mode 100644 index fe36f909..00000000 --- a/src/math/riscv64/copysignf.s +++ /dev/null @@ -1,5 +0,0 @@ -.global copysignf -.type copysignf, %function -copysignf: - fsgnj.s fa0, fa0, fa1 - ret diff --git a/src/math/riscv64/fabs.c b/src/math/riscv64/fabs.c new file mode 100644 index 00000000..5290b6f0 --- /dev/null +++ b/src/math/riscv64/fabs.c @@ -0,0 +1,15 @@ +#include + +#if __riscv_flen >= 64 + +double fabs(double x) +{ + __asm__ ("fabs.d %0, %1" : "=f"(x) : "f"(x)); + return x; +} + +#else + +#include "../fabs.c" + +#endif diff --git a/src/math/riscv64/fabs.s b/src/math/riscv64/fabs.s deleted file mode 100644 index 27def33c..00000000 --- a/src/math/riscv64/fabs.s +++ /dev/null @@ -1,5 +0,0 @@ -.global fabs -.type fabs, %function -fabs: - fabs.d fa0, fa0 - ret diff --git a/src/math/riscv64/fabsf.c b/src/math/riscv64/fabsf.c new file mode 100644 index 00000000..f5032e35 --- /dev/null +++ b/src/math/riscv64/fabsf.c @@ -0,0 +1,15 @@ +#include + +#if __riscv_flen >= 32 + +float fabsf(float x) +{ + __asm__ ("fabs.s %0, %1" : "=f"(x) : "f"(x)); + return x; +} + +#else + +#include "../fabsf.c" + +#endif diff --git a/src/math/riscv64/fabsf.s b/src/math/riscv64/fabsf.s deleted file mode 100644 index 8e0b9d64..00000000 --- a/src/math/riscv64/fabsf.s +++ /dev/null @@ -1,5 +0,0 @@ -.global fabsf -.type fabsf, %function -fabsf: - fabs.s fa0, fa0 - ret diff --git a/src/math/riscv64/fma.c b/src/math/riscv64/fma.c new file mode 100644 index 00000000..99b05713 --- /dev/null +++ b/src/math/riscv64/fma.c @@ -0,0 +1,15 @@ +#include + +#if __riscv_flen >= 64 + +double fma(double x, double y, double z) +{ + __asm__ ("fmadd.d %0, %1, %2, %3" : "=f"(x) : "f"(x), "f"(y), "f"(z)); + return x; +} + +#else + +#include "../fma.c" + +#endif diff --git a/src/math/riscv64/fma.s b/src/math/riscv64/fma.s deleted file mode 100644 index 17e1d136..00000000 --- a/src/math/riscv64/fma.s +++ /dev/null @@ -1,5 +0,0 @@ -.global fma -.type fma, %function -fma: - fmadd.d fa0, fa0, fa1, fa2 - ret diff --git a/src/math/riscv64/fmaf.c b/src/math/riscv64/fmaf.c new file mode 100644 index 00000000..f9dc47ed --- /dev/null +++ b/src/math/riscv64/fmaf.c @@ -0,0 +1,15 @@ +#include + +#if __riscv_flen >= 32 + +float fmaf(float x, float y, float z) +{ + __asm__ ("fmadd.s %0, %1, %2, %3" : "=f"(x) : "f"(x), "f"(y), "f"(z)); + return x; +} + +#else + +#include "../fmaf.c" + +#endif diff --git a/src/math/riscv64/fmaf.s b/src/math/riscv64/fmaf.s deleted file mode 100644 index cfe17100..00000000 --- a/src/math/riscv64/fmaf.s +++ /dev/null @@ -1,5 +0,0 @@ -.global fmaf -.type fmaf, %function -fmaf: - fmadd.s fa0, fa0, fa1, fa2 - ret diff --git a/src/math/riscv64/fmax.c b/src/math/riscv64/fmax.c new file mode 100644 index 00000000..023709cd --- /dev/null +++ b/src/math/riscv64/fmax.c @@ -0,0 +1,15 @@ +#include + +#if __riscv_flen >= 64 + +double fmax(double x, double y) +{ + __asm__ ("fmax.d %0, %1, %2" : "=f"(x) : "f"(x), "f"(y)); + return x; +} + +#else + +#include "../fmax.c" + +#endif diff --git a/src/math/riscv64/fmax.s b/src/math/riscv64/fmax.s deleted file mode 100644 index 40655d37..00000000 --- a/src/math/riscv64/fmax.s +++ /dev/null @@ -1,5 +0,0 @@ -.global fmax -.type fmax, %function -fmax: - fmax.d fa0, fa0, fa1 - ret diff --git a/src/math/riscv64/fmaxf.c b/src/math/riscv64/fmaxf.c new file mode 100644 index 00000000..863d2bd1 --- /dev/null +++ b/src/math/riscv64/fmaxf.c @@ -0,0 +1,15 @@ +#include + +#if __riscv_flen >= 32 + +float fmaxf(float x, float y) +{ + __asm__ ("fmax.s %0, %1, %2" : "=f"(x) : "f"(x), "f"(y)); + return x; +} + +#else + +#include "../fmaxf.c" + +#endif diff --git a/src/math/riscv64/fmaxf.s b/src/math/riscv64/fmaxf.s deleted file mode 100644 index 490b6e91..00000000 --- a/src/math/riscv64/fmaxf.s +++ /dev/null @@ -1,5 +0,0 @@ -.global fmaxf -.type fmaxf, %function -fmaxf: - fmax.s fa0, fa0, fa1 - ret diff --git a/src/math/riscv64/fmin.c b/src/math/riscv64/fmin.c new file mode 100644 index 00000000..a4e3b067 --- /dev/null +++ b/src/math/riscv64/fmin.c @@ -0,0 +1,15 @@ +#include + +#if __riscv_flen >= 64 + +double fmin(double x, double y) +{ + __asm__ ("fmin.d %0, %1, %2" : "=f"(x) : "f"(x), "f"(y)); + return x; +} + +#else + +#include "../fmin.c" + +#endif diff --git a/src/math/riscv64/fmin.s b/src/math/riscv64/fmin.s deleted file mode 100644 index 97f72e08..00000000 --- a/src/math/riscv64/fmin.s +++ /dev/null @@ -1,5 +0,0 @@ -.global fmin -.type fmin, %function -fmin: - fmin.d fa0, fa0, fa1 - ret diff --git a/src/math/riscv64/fminf.c b/src/math/riscv64/fminf.c new file mode 100644 index 00000000..32156e80 --- /dev/null +++ b/src/math/riscv64/fminf.c @@ -0,0 +1,15 @@ +#include + +#if __riscv_flen >= 32 + +float fminf(float x, float y) +{ + __asm__ ("fmin.s %0, %1, %2" : "=f"(x) : "f"(x), "f"(y)); + return x; +} + +#else + +#include "../fminf.c" + +#endif diff --git a/src/math/riscv64/fminf.s b/src/math/riscv64/fminf.s deleted file mode 100644 index 4f8e55ee..00000000 --- a/src/math/riscv64/fminf.s +++ /dev/null @@ -1,5 +0,0 @@ -.global fminf -.type fminf, %function -fminf: - fmin.s fa0, fa0, fa1 - ret diff --git a/src/math/riscv64/sqrt.c b/src/math/riscv64/sqrt.c new file mode 100644 index 00000000..75c34f7a --- /dev/null +++ b/src/math/riscv64/sqrt.c @@ -0,0 +1,15 @@ +#include + +#if __riscv_flen >= 64 + +double sqrt(double x) +{ + __asm__ ("sqrt.d %0, %1" : "=f"(x) : "f"(x)); + return x; +} + +#else + +#include "../sqrt.c" + +#endif diff --git a/src/math/riscv64/sqrt.s b/src/math/riscv64/sqrt.s deleted file mode 100644 index a4c8b3ea..00000000 --- a/src/math/riscv64/sqrt.s +++ /dev/null @@ -1,5 +0,0 @@ -.global sqrt -.type sqrt, %function -sqrt: - fsqrt.d fa0, fa0 - ret diff --git a/src/math/riscv64/sqrtf.c b/src/math/riscv64/sqrtf.c new file mode 100644 index 00000000..610c2cf8 --- /dev/null +++ b/src/math/riscv64/sqrtf.c @@ -0,0 +1,15 @@ +#include + +#if __riscv_flen >= 32 + +float sqrtf(float x) +{ + __asm__ ("fsqrt.s %0, %1" : "=f"(x) : "f"(x)); + return x; +} + +#else + +#include "../sqrtf.c" + +#endif diff --git a/src/math/riscv64/sqrtf.s b/src/math/riscv64/sqrtf.s deleted file mode 100644 index ff7abcf3..00000000 --- a/src/math/riscv64/sqrtf.s +++ /dev/null @@ -1,5 +0,0 @@ -.global sqrtf -.type sqrtf, %function -sqrtf: - fsqrt.s fa0, fa0 - ret