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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |INVALID
             Status|UNCONFIRMED                 |RESOLVED

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
ubuntu@ubuntu:~/src/upstream-gcc-aarch64\# g++ t55.cc -ffp-contract=on -O2
ubuntu@ubuntu:~/src/upstream-gcc-aarch64\# ./a.out
3e+09 3e+09
0
0
ubuntu@ubuntu:~/src/upstream-gcc-aarch64\# g++ t55.cc -ffp-contract=fast -O2
ubuntu@ubuntu:~/src/upstream-gcc-aarch64\# ./a.out
3e+09 3e+09
512
0


GCC defaults to "-ffp-contract=fast" which enables the use of the Fused
multiple add instruction in some cases. 

What is happening in this case is the second print is being constant folded
(before the FMA instruction is formed) and the first print uses a fnmsub
instruction.

That is there is no bug, you just don't understand floating point.

Reply via email to