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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Version|unknown                     |11.0
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2021-01-05
             Status|UNCONFIRMED                 |NEW

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
There is no built-in way, and yes, reassoc-width is known to have this effect.

What could be done is move/duplicate FMA discovery from
pass_optimize_widening_mul to reassoc(*).  The simplistic idea would be to
perform a separate FMA detection on the OPS array.

The question is how to handle imperfect chains where reassoc would order
after rank, like

a[i] += b[i]* c[i] + d[i] + f[i] * g[i] + h[i] + k[i] * l[i] + m[i] + p[i];

and also how to not "break" the special heuristics the current FMA formation
pass has.  Alternatively altering rewrite_expr_tree_parallel only to avoid
splitting FMA chains in unwanted ways would be possible.

(*) note since reassoc doesn't handle signed integer arithmetic it cannot
fully replace late FMA detect

Reply via email to