From 1c9d2cba11ef2c9de31a6edb48eb20777be4a4f8 Mon Sep 17 00:00:00 2001 From: "info@mobile-stream.com" Date: Wed, 11 Sep 2019 13:05:04 +0300 Subject: mips: add single-instruction math functions SQRT.fmt exists on MIPS II+ (float), MIPS III+ (double). ABS.fmt exists on MIPS I+ but only cores with ABS2008 flag in FCSR implement the required behaviour. --- src/math/mips/fabsf.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 src/math/mips/fabsf.c (limited to 'src/math/mips/fabsf.c') diff --git a/src/math/mips/fabsf.c b/src/math/mips/fabsf.c new file mode 100644 index 00000000..35307be6 --- /dev/null +++ b/src/math/mips/fabsf.c @@ -0,0 +1,16 @@ +#if !defined(__mips_soft_float) && defined(__mips_abs2008) + +#include + +float fabsf(float x) +{ + float r; + __asm__("abs.s %0,%1" : "=f"(r) : "f"(x)); + return r; +} + +#else + +#include "../fabsf.c" + +#endif -- cgit 1.4.1