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

Thomas Koenig <tkoenig at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|fortran                     |middle-end

--- Comment #3 from Thomas Koenig <tkoenig at gcc dot gnu.org> ---
Interesting problem.

For

  _19 = (*x_13(D))[0];
  _20 = (*y_14(D))[0];
  _21 = _19 * _20;
  _22 = _21 + 0.0;

the multiplication cannot produce a signalling NaN, so the addition
of zero should always be a no-op. For this, a simpler test case would
be

double add(double a, double b)
{
  return a*b + 0.0;
}

which gets me, on x86_64, 

        mulsd   %xmm1, %xmm0
        pxor    %xmm1, %xmm1
        addsd   %xmm1, %xmm0
        re

According to godbolt, icc produces

add:
        mulsd     %xmm1, %xmm0                                  #3.12
        ret                           

which should be fine.

So, an issue for tree optimization?

Reply via email to