AnsweredAssumed Answered

FMA4 support

Question asked by hardcoregames™ on Jun 16, 2019
Latest reply on Jun 18, 2019 by hardcoregames™

I am a developer and I noticed some comments on a few sites that AMD does not support FMA4 properly. Not sure if the CPU microcode has been patched and if that works now.

 

FMA4 is a fused multiply add instruction. FMA4 supports d = (a * b) + c type of instruction but FMA3 does it differently using only 3 registers. This makes it more tricky as CPUID does not help me select which instruction to use.

 

I have an R5 2400G which is very recent so I expect it  to more or less support the modern instruction set.

 

I have Visual Studio 2019 which supports everything out there but I do not want my CPU to "blow up" on me.

 

Example of what I mean, use the following optimizations: 

/O1 /arch:AVX2 /fp:fast

 

float mul_add(float a, float b, float c) {
return a*b + c;
}

__m256 mul_addv(__m256 a, __m256 b, __m256 c) {
return _mm256_add_ps(_mm256_mul_ps(a, b), c);
}

Outcomes