* [PATCH] xtensa: Eliminate double MEMW insertions for volatile memory
[not found] <dc4aa186-58e5-452d-abe2-01bc34b58736.ref@yahoo.co.jp>
@ 2024-06-19 4:59 ` Takayuki 'January June' Suwa
2024-06-19 17:07 ` Max Filippov
0 siblings, 1 reply; 2+ messages in thread
From: Takayuki 'January June' Suwa @ 2024-06-19 4:59 UTC (permalink / raw)
To: gcc-patches; +Cc: Max Filippov
This patch makes avoid inserting a MEMW instruction before a load/store
nstruction with volatile memory reference if there is already a MEMW
immediately before it.
gcc/ChangeLog:
* config/xtensa/xtensa.cc (print_operand):
When outputting MEMW before the instruction, check if the previous
instruction is already that.
---
gcc/config/xtensa/xtensa.cc | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/gcc/config/xtensa/xtensa.cc b/gcc/config/xtensa/xtensa.cc
index bc127997ac6..e2549de5df0 100644
--- a/gcc/config/xtensa/xtensa.cc
+++ b/gcc/config/xtensa/xtensa.cc
@@ -3078,7 +3078,17 @@ print_operand (FILE *file, rtx x, int letter)
/* For a volatile memory reference, emit a MEMW before the
load or store. */
if (MEM_VOLATILE_P (x) && TARGET_SERIALIZE_VOLATILE)
- fprintf (file, "memw\n\t");
+ {
+ rtx_insn *prev_insn
+ = prev_nonnote_nondebug_insn (current_output_insn);
+ rtx pat, src;
+
+ if (! (prev_insn && NONJUMP_INSN_P (prev_insn)
+ && GET_CODE (pat = PATTERN (prev_insn)) == SET
+ && GET_CODE (src = SET_SRC (pat)) == UNSPEC
+ && XINT (src, 1) == UNSPEC_MEMW))
+ fprintf (file, "memw\n\t");
+ }
}
else
output_operand_lossage ("invalid %%v value");
--
2.39.2
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] xtensa: Eliminate double MEMW insertions for volatile memory
2024-06-19 4:59 ` [PATCH] xtensa: Eliminate double MEMW insertions for volatile memory Takayuki 'January June' Suwa
@ 2024-06-19 17:07 ` Max Filippov
0 siblings, 0 replies; 2+ messages in thread
From: Max Filippov @ 2024-06-19 17:07 UTC (permalink / raw)
To: Takayuki 'January June' Suwa; +Cc: gcc-patches
On Tue, Jun 18, 2024 at 10:00 PM Takayuki 'January June' Suwa
<jjsuwa_sys3175@yahoo.co.jp> wrote:
>
> This patch makes avoid inserting a MEMW instruction before a load/store
> nstruction with volatile memory reference if there is already a MEMW
> immediately before it.
>
> gcc/ChangeLog:
>
> * config/xtensa/xtensa.cc (print_operand):
> When outputting MEMW before the instruction, check if the previous
> instruction is already that.
> ---
> gcc/config/xtensa/xtensa.cc | 12 +++++++++++-
> 1 file changed, 11 insertions(+), 1 deletion(-)
Regtested for target=xtensa-linux-uclibc, no new regressions.
Committed to master.
--
Thanks.
-- Max
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-06-19 17:08 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <dc4aa186-58e5-452d-abe2-01bc34b58736.ref@yahoo.co.jp>
2024-06-19 4:59 ` [PATCH] xtensa: Eliminate double MEMW insertions for volatile memory Takayuki 'January June' Suwa
2024-06-19 17:07 ` Max Filippov
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).