From 4abab5ad6c8465a7528ccdd5f49367da05f78bbd Mon Sep 17 00:00:00 2001 From: Vladimir Azarov Date: Tue, 1 Oct 2024 15:47:05 +0200 Subject: Initial version --- src/math/x32/fmaf.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 src/math/x32/fmaf.c (limited to 'src/math/x32/fmaf.c') diff --git a/src/math/x32/fmaf.c b/src/math/x32/fmaf.c new file mode 100644 index 0000000..30b971f --- /dev/null +++ b/src/math/x32/fmaf.c @@ -0,0 +1,23 @@ +#include + +#if __FMA__ + +float fmaf(float x, float y, float z) +{ + __asm__ ("vfmadd132ss %1, %2, %0" : "+x" (x) : "x" (y), "x" (z)); + return x; +} + +#elif __FMA4__ + +float fmaf(float x, float y, float z) +{ + __asm__ ("vfmaddss %3, %2, %1, %0" : "=x" (x) : "x" (x), "x" (y), "x" (z)); + return x; +} + +#else + +#include "../fmaf.c" + +#endif -- cgit v1.2.3