public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "rguenth at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/98350] Reassociation breaks FMA chains
Date: Tue, 05 Jan 2021 08:31:20 +0000	[thread overview]
Message-ID: <bug-98350-4-Fi5yv9bhMi@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-98350-4@http.gcc.gnu.org/bugzilla/>

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	other threads:[~2021-01-05  8:31 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-17 15:24 [Bug tree-optimization/98350] New: " ktkachov at gcc dot gnu.org
2021-01-05  8:31 ` rguenth at gcc dot gnu.org [this message]
2021-09-06 18:40 ` [Bug tree-optimization/98350] " pinskia at gcc dot gnu.org
2023-03-23  4:16 ` dizhao at os dot amperecomputing.com
2023-03-23  4:22 ` dizhao at os dot amperecomputing.com
2023-05-19  7:24 ` pinskia at gcc dot gnu.org
2023-05-30  6:03 ` cvs-commit at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-98350-4-Fi5yv9bhMi@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).