From: Andrew Pinski <quic_apinski@quicinc.com>
To: <gcc-patches@gcc.gnu.org>
Cc: Andrew Pinski <quic_apinski@quicinc.com>
Subject: [PATCH 1/2] Add verification of gimple_assign_nontemporal_move_p [PR112976]
Date: Fri, 26 Apr 2024 16:03:52 -0700 [thread overview]
Message-ID: <20240426230353.3131438-1-quic_apinski@quicinc.com> (raw)
Currently the middle-end only knows how to support temporal stores
(the undocumented storent optab) so let's verify that the only time
we set nontemporal_move on an assign is if the the lhs is not a
gimple reg.
Bootstrapped and tested on x86_64-linux-gnu no regressions.
gcc/ChangeLog:
PR middle-end/112976
* tree-cfg.cc (verify_gimple_assign): Verify that
nontmporal moves are stores.
* gimple.h (struct gimple): Note that only
nontemporal stores are supported.
Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com>
---
gcc/gimple.h | 3 ++-
gcc/tree-cfg.cc | 11 +++++++++++
2 files changed, 13 insertions(+), 1 deletion(-)
diff --git a/gcc/gimple.h b/gcc/gimple.h
index 8a8ca109bbf..bd315ffc2dd 100644
--- a/gcc/gimple.h
+++ b/gcc/gimple.h
@@ -236,7 +236,8 @@ struct GTY((desc ("gimple_statement_structure (&%h)"), tag ("GSS_BASE"),
for clearing this bit before using it. */
unsigned int visited : 1;
- /* Nonzero if this tuple represents a non-temporal move. */
+ /* Nonzero if this tuple represents a non-temporal move; currently
+ only stores are supported. */
unsigned int nontemporal_move : 1;
/* Pass local flags. These flags are free for any pass to use as
diff --git a/gcc/tree-cfg.cc b/gcc/tree-cfg.cc
index b1ba33018fd..06a96f96be7 100644
--- a/gcc/tree-cfg.cc
+++ b/gcc/tree-cfg.cc
@@ -4837,6 +4837,17 @@ verify_gimple_assign_single (gassign *stmt)
static bool
verify_gimple_assign (gassign *stmt)
{
+ if (gimple_assign_nontemporal_move_p (stmt))
+ {
+ tree lhs = gimple_assign_lhs (stmt);
+ if (is_gimple_reg (lhs))
+ {
+ error ("nontemporal store lhs cannot a gimple register");
+ debug_generic_stmt (lhs);
+ return true;
+ }
+ }
+
switch (gimple_assign_rhs_class (stmt))
{
case GIMPLE_SINGLE_RHS:
--
2.43.0
next reply other threads:[~2024-04-26 23:04 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-26 23:03 Andrew Pinski [this message]
2024-04-26 23:03 ` [PATCH 2/2] Remove support for nontemporal stores with ssa_names on lhs [PR112976] Andrew Pinski
2024-04-30 8:00 ` Richard Biener
2024-04-30 8:00 ` [PATCH 1/2] Add verification of gimple_assign_nontemporal_move_p [PR112976] Richard Biener
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=20240426230353.3131438-1-quic_apinski@quicinc.com \
--to=quic_apinski@quicinc.com \
--cc=gcc-patches@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).