[Development] Implicit VFMADD support (Was: Updating x86 SIMD support in Qt)
Thiago Macieira
thiago.macieira at intel.com
Mon Jan 24 18:32:50 CET 2022
On Monday, 24 January 2022 09:07:16 PST Konstantin Shegunov wrote:
> Related, but somewhat offtopic for the original thread.
> Do we get `-mfma` (or equivalent) added, whenever supported, while we build
> Qt.
Today, only in the two files with "_avx2" in the name, unless you raise the
CPU architecture yourself while configuring Qt. My proposal is to get that on
Linux by default with the v3 extra build.
> Is it part of the feature detection? Because I want `std::fma` to emit
> the instruction(s), but I've noticed that in the code I test a bugfix with
> I must force the issue by passing the flag explicitly; even with -O2 I get
> a function call otherwise.
For *your* code, you need to explicitly enable FMA yourself. The changes
proposed in this thread do not affect user code.
All compilers tested will use the FMA instruction if you enabled the CPU
feature, otherwise they'll make a call to the math lbrary's fma() function.
Both glibc, macOS libSystem, and Windows' ucrtbase have implementations using
the FMA instruction and will detect at runtime which one to use (this was the
*only* place in ucrtbase I found AVX2/FMA code). You're out of luck if you're
using MinGW, though.
Compare: https://gcc.godbolt.org/z/c5385d5GY (no FMA)
to: https://gcc.godbolt.org/z/jf3zhsjPf (with FMA)
--
Thiago Macieira - thiago.macieira (AT) intel.com
Software Architect - Intel DPG Cloud Engineering
More information about the Development
mailing list