Easiest way to use FMA instruction

Ben Jones fake at fake.fake
Fri Jan 10 01:11:23 UTC 2020


On Friday, 10 January 2020 at 00:08:44 UTC, Johan wrote:
> On Friday, 10 January 2020 at 00:02:52 UTC, Johan wrote:
>> [...]
>
> 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

I need it for the rounding behavior.  Thanks for the pointers, 
that's very helpful.


More information about the Digitalmars-d-learn mailing list