summaryrefslogtreecommitdiff
path: root/src/math/riscv64/fma.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/math/riscv64/fma.c')
-rw-r--r--src/math/riscv64/fma.c15
1 files changed, 15 insertions, 0 deletions
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 <math.h>
+
+#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