https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79436

--- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
"this default behaviour produces invalid results."

No.
Read http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.22.6768

> The same code compiled at -O2 for x86-64 does not assert. 
That because the default x86_64 target does not have the fused multiple add
instruction.  On a newer Intel (or AMD) machine, add -march=naitve and you will
see the same behavior.

You are not understand what fused multiple add instruction does and how
floating point works.  

VFMA is not just multiply and accumulate but rather fused multiply and add. 
The multiplication is done in infinite precision and then the add is done in
that same infinite precision and then a round happens down to double.  Instead
of what happens with -ffp-contract=off which is not to used the fused multiple
add instruction which means round between the multiply and addition.

Reply via email to