x86_64: add single instruction fma
[oweals/musl.git] / src / math / x32 / fma.c
1 #include <math.h>
2
3 #if __FMA__
4
5 double fma(double x, double y, double z)
6 {
7         __asm__ ("vfmadd132sd %1, %2, %0" : "+x" (x) : "x" (y), "x" (z));
8         return x;
9 }
10
11 #elif __FMA4__
12
13 double fma(double x, double y, double z)
14 {
15         __asm__ ("vfmaddsd %3, %2, %1, %0" : "=x" (x) : "x" (x), "x" (y), "x" (z));
16         return x;
17 }
18
19 #else
20
21 #include "../fma.c"
22
23 #endif