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