From b4f7b2ca350ccaa6f58ecec72ac46b7aef22d1c3 Mon Sep 17 00:00:00 2001 From: Stefan O'Rear Date: Thu, 3 Sep 2020 05:45:44 -0400 Subject: riscv32: add fenv and math These are identical to riscv64. --- src/math/riscv32/sqrt.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 src/math/riscv32/sqrt.c (limited to 'src/math/riscv32/sqrt.c') diff --git a/src/math/riscv32/sqrt.c b/src/math/riscv32/sqrt.c new file mode 100644 index 00000000..867a504c --- /dev/null +++ b/src/math/riscv32/sqrt.c @@ -0,0 +1,15 @@ +#include + +#if __riscv_flen >= 64 + +double sqrt(double x) +{ + __asm__ ("fsqrt.d %0, %1" : "=f"(x) : "f"(x)); + return x; +} + +#else + +#include "../sqrt.c" + +#endif -- cgit v1.2.1