On Friday, 10 January 2020 at 00:02:52 UTC, Johan wrote:

For LDC:
```
double fma(double a, double b, double c)
{
    import ldc.llvmasm;
    return __irEx!(
`declare double @llvm.fma.f64(double %a, double %b, double %c)`, `%r = call double @llvm.fma.f64(double %0, double %1, double %2)
              ret double %r`,
             "",
             double, double, double, double)(a,b,c);
}
```

You have to tell LDC that you are compiling for a CPU that has FMA capability (otherwise it will insert a call to a "fma" runtime library function that most likely you are not linking with). For example, "-mattr=fma" or "-mcpu=skylake".
https://d.godbolt.org/z/ddwORl

Or you add it only for the "fma" function, using
```
import ldc.attributes;
@target("fma") double fma(double a, double b, double c) ...
```
https://d.godbolt.org/z/-X7FnC
https://wiki.dlang.org/LDC-specific_language_changes#.40.28ldc.attributes.target.28.22feature.22.29.29

cheers,
  Johan

Reply via email to