public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Martin Jambor <jamborm@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc r14-3906] math-opts: Add dbgcounter for FMA formation Date: Tue, 12 Sep 2023 17:23:53 +0000 (GMT) [thread overview] Message-ID: <20230912172354.0091B3858C50@sourceware.org> (raw) https://gcc.gnu.org/g:27e2e7c93e48bcbb63877cc5964fae8dba47d706 commit r14-3906-g27e2e7c93e48bcbb63877cc5964fae8dba47d706 Author: Martin Jambor <mjambor@suse.cz> Date: Tue Sep 12 19:22:37 2023 +0200 math-opts: Add dbgcounter for FMA formation This patch is a simple addition of a debug counter to FMA formation in tree-ssa-math-opts.cc. Given that issues with FMAs do occasionally pop up, it seems genuinely useful. I simply added an if right after the initial checks in convert_mult_to_fma even though when FMA formation deferring is active (i.e. when targeting Zen CPUs) this would interact with it (and at this moment lead to producing all deferred candidates), so when using the dbg counter to find a harmful set of FMAs, it is probably best to also set param_avoid_fma_max_bits to zero. I could not find a better place which would not also make the code unnecessarily more complicated. gcc/ChangeLog: 2023-09-06 Martin Jambor <mjambor@suse.cz> * dbgcnt.def (form_fma): New. * tree-ssa-math-opts.cc: Include dbgcnt.h. (convert_mult_to_fma): Bail out if the debug counter say so. Diff: --- gcc/dbgcnt.def | 1 + gcc/tree-ssa-math-opts.cc | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/gcc/dbgcnt.def b/gcc/dbgcnt.def index 9e2f1d857b49..871cbf75d931 100644 --- a/gcc/dbgcnt.def +++ b/gcc/dbgcnt.def @@ -162,6 +162,7 @@ DEBUG_COUNTER (dom_unreachable_edges) DEBUG_COUNTER (dse) DEBUG_COUNTER (dse1) DEBUG_COUNTER (dse2) +DEBUG_COUNTER (form_fma) DEBUG_COUNTER (gcse2_delete) DEBUG_COUNTER (gimple_unroll) DEBUG_COUNTER (global_alloc_at_func) diff --git a/gcc/tree-ssa-math-opts.cc b/gcc/tree-ssa-math-opts.cc index 95c22694368c..3db69ad5733c 100644 --- a/gcc/tree-ssa-math-opts.cc +++ b/gcc/tree-ssa-math-opts.cc @@ -116,6 +116,7 @@ along with GCC; see the file COPYING3. If not see #include "targhooks.h" #include "domwalk.h" #include "tree-ssa-math-opts.h" +#include "dbgcnt.h" /* This structure represents one basic block that either computes a division, or is a common dominator for basic block that compute a @@ -3366,6 +3367,9 @@ convert_mult_to_fma (gimple *mul_stmt, tree op1, tree op2, && !has_single_use (mul_result)) return false; + if (!dbg_cnt (form_fma)) + return false; + /* Make sure that the multiplication statement becomes dead after the transformation, thus that all uses are transformed to FMAs. This means we assume that an FMA operation has the same cost
reply other threads:[~2023-09-12 17:23 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20230912172354.0091B3858C50@sourceware.org \ --to=jamborm@gcc.gnu.org \ --cc=gcc-cvs@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: linkBe 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).