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

--- Comment #7 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Richard Biener from comment #6)
> Note that all "bad" transforms can be done by users on the source level
> already.  So the _only_ proper solution is to handle the situation in the
> passes that now refuse to do an important optimization (like combine).

For an example take:
float f(float x, float y, float z, int a)
{
   float t = y * z;
   if (a > 100)
     x += t;
   else
     x -= t;
   return x;
}

Note we are able to optimize the follow (use -O2) to use fmadds:
float f(float x, float y, float z, int a)
{
   float t = y * z;
   x += t;
   x -= t;
   return x;
}

---- CUT ----
and it is optimized in the widening_mul pass (which includes the FMA
optimization pass).

Reply via email to