Re: How to get a vector FMA with GCC in a portable way?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 15 Jan 2019, Vincent Lefevre wrote:

> I would like to know how to get a vector FMA with GCC in a portable
> way.
> 
> By "portable way", I mean that the behavior must not depend on the
> compilation options (e.g., if FP contraction is disabled, I still
> want a true FMA) and that the code must not depend on the architecture
> (thus intrinsics should not be used... even when restricting to x86,
> one reason is FMA3 vs FMA4 issues).
> 
> For instance, for addition, one can write "a + b". But for FMA?

In the context of autovectorized code or when using generic vector types?
When the source is supposed to be autovectorized and operates on scalar
variables, using fma function works (GCC recognizes it as a builtin;
__FP_FAST_FMA is predefined when the fma instruction is available).

For generic vector types I'm afraid GCC does not provide such a facility.
I think it would make a reasonable feature request.

Alexander.



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux