* [PATCH 1/2] Add verification of gimple_assign_nontemporal_move_p [PR112976]
@ 2024-04-26 23:03 Andrew Pinski
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 ` [PATCH 1/2] Add verification of gimple_assign_nontemporal_move_p [PR112976] Richard Biener
0 siblings, 2 replies; 4+ messages in thread
From: Andrew Pinski @ 2024-04-26 23:03 UTC (permalink / raw)
To: gcc-patches; +Cc: Andrew Pinski
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
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 2/2] Remove support for nontemporal stores with ssa_names on lhs [PR112976]
2024-04-26 23:03 [PATCH 1/2] Add verification of gimple_assign_nontemporal_move_p [PR112976] Andrew Pinski
@ 2024-04-26 23:03 ` 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
1 sibling, 1 reply; 4+ messages in thread
From: Andrew Pinski @ 2024-04-26 23:03 UTC (permalink / raw)
To: gcc-patches; +Cc: Andrew Pinski
When cfgexpand was changed to support expanding from tuple gimple
(r0-95521-g28ed065ef9f345), the code was added to support
doing nontemporal stores with LHS of a SSA_NAME but that will
never be a nontemporal store.
This patch removes that and asserts that expanding with a LHS
of a SSA_NAME is not a nontemporal store.
Bootstrapped and tested on x86_64-linux-gnu.
gcc/ChangeLog:
PR middle-end/112976
* cfgexpand.cc (expand_gimple_stmt_1): Remove
support for expanding nontemporal "moves" with
ssa names on the LHS.
Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com>
---
gcc/cfgexpand.cc | 11 ++++-------
1 file changed, 4 insertions(+), 7 deletions(-)
diff --git a/gcc/cfgexpand.cc b/gcc/cfgexpand.cc
index eef565eddb5..cfc5291aa0c 100644
--- a/gcc/cfgexpand.cc
+++ b/gcc/cfgexpand.cc
@@ -4002,17 +4002,16 @@ expand_gimple_stmt_1 (gimple *stmt)
else
{
rtx target, temp;
- bool nontemporal = gimple_assign_nontemporal_move_p (assign_stmt);
+ gcc_assert (!gimple_assign_nontemporal_move_p (assign_stmt));
bool promoted = false;
target = expand_expr (lhs, NULL_RTX, VOIDmode, EXPAND_WRITE);
if (GET_CODE (target) == SUBREG && SUBREG_PROMOTED_VAR_P (target))
promoted = true;
- /* If we want to use a nontemporal store, force the value to
- register first. If we store into a promoted register,
- don't directly expand to target. */
- temp = nontemporal || promoted ? NULL_RTX : target;
+ /* If we store into a promoted register, don't directly
+ expand to target. */
+ temp = promoted ? NULL_RTX : target;
temp = expand_expr_real_gassign (assign_stmt, temp,
GET_MODE (target), EXPAND_NORMAL);
@@ -4034,8 +4033,6 @@ expand_gimple_stmt_1 (gimple *stmt)
convert_move (SUBREG_REG (target), temp, unsignedp);
}
- else if (nontemporal && emit_storent_insn (target, temp))
- ;
else
{
temp = force_operand (temp, target);
--
2.43.0
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 1/2] Add verification of gimple_assign_nontemporal_move_p [PR112976]
2024-04-26 23:03 [PATCH 1/2] Add verification of gimple_assign_nontemporal_move_p [PR112976] Andrew Pinski
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
1 sibling, 0 replies; 4+ messages in thread
From: Richard Biener @ 2024-04-30 8:00 UTC (permalink / raw)
To: Andrew Pinski; +Cc: gcc-patches
On Sat, Apr 27, 2024 at 1:04 AM Andrew Pinski <quic_apinski@quicinc.com> wrote:
>
> 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.
OK.
> 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
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 2/2] Remove support for nontemporal stores with ssa_names on lhs [PR112976]
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
0 siblings, 0 replies; 4+ messages in thread
From: Richard Biener @ 2024-04-30 8:00 UTC (permalink / raw)
To: Andrew Pinski; +Cc: gcc-patches
On Sat, Apr 27, 2024 at 1:04 AM Andrew Pinski <quic_apinski@quicinc.com> wrote:
>
> When cfgexpand was changed to support expanding from tuple gimple
> (r0-95521-g28ed065ef9f345), the code was added to support
> doing nontemporal stores with LHS of a SSA_NAME but that will
> never be a nontemporal store.
> This patch removes that and asserts that expanding with a LHS
> of a SSA_NAME is not a nontemporal store.
>
> Bootstrapped and tested on x86_64-linux-gnu.
OK.
> gcc/ChangeLog:
>
> PR middle-end/112976
> * cfgexpand.cc (expand_gimple_stmt_1): Remove
> support for expanding nontemporal "moves" with
> ssa names on the LHS.
>
> Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com>
> ---
> gcc/cfgexpand.cc | 11 ++++-------
> 1 file changed, 4 insertions(+), 7 deletions(-)
>
> diff --git a/gcc/cfgexpand.cc b/gcc/cfgexpand.cc
> index eef565eddb5..cfc5291aa0c 100644
> --- a/gcc/cfgexpand.cc
> +++ b/gcc/cfgexpand.cc
> @@ -4002,17 +4002,16 @@ expand_gimple_stmt_1 (gimple *stmt)
> else
> {
> rtx target, temp;
> - bool nontemporal = gimple_assign_nontemporal_move_p (assign_stmt);
> + gcc_assert (!gimple_assign_nontemporal_move_p (assign_stmt));
> bool promoted = false;
>
> target = expand_expr (lhs, NULL_RTX, VOIDmode, EXPAND_WRITE);
> if (GET_CODE (target) == SUBREG && SUBREG_PROMOTED_VAR_P (target))
> promoted = true;
>
> - /* If we want to use a nontemporal store, force the value to
> - register first. If we store into a promoted register,
> - don't directly expand to target. */
> - temp = nontemporal || promoted ? NULL_RTX : target;
> + /* If we store into a promoted register, don't directly
> + expand to target. */
> + temp = promoted ? NULL_RTX : target;
> temp = expand_expr_real_gassign (assign_stmt, temp,
> GET_MODE (target), EXPAND_NORMAL);
>
> @@ -4034,8 +4033,6 @@ expand_gimple_stmt_1 (gimple *stmt)
>
> convert_move (SUBREG_REG (target), temp, unsignedp);
> }
> - else if (nontemporal && emit_storent_insn (target, temp))
> - ;
> else
> {
> temp = force_operand (temp, target);
> --
> 2.43.0
>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-04-30 8:01 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-26 23:03 [PATCH 1/2] Add verification of gimple_assign_nontemporal_move_p [PR112976] Andrew Pinski
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
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).