diff options
author | Takayuki 'January June' Suwa <jjsuwa_sys3175@yahoo.co.jp> | 2024-06-19 13:59:54 +0900 |
---|---|---|
committer | Max Filippov <jcmvbkbc@gmail.com> | 2024-06-19 10:06:51 -0700 |
commit | 0982552bc4eeffb5520deba10dedecfb2390a8de (patch) | |
tree | 0071bbfb1e7cfc48ecca8428640a91709ed3f2e4 /gcc | |
parent | bcb9dad9f6123c14ab8b14d2c3d360461dd5ee17 (diff) | |
download | gcc-0982552bc4eeffb5520deba10dedecfb2390a8de.zip gcc-0982552bc4eeffb5520deba10dedecfb2390a8de.tar.gz gcc-0982552bc4eeffb5520deba10dedecfb2390a8de.tar.bz2 |
xtensa: Eliminate double MEMW insertions for volatile memory
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.
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/config/xtensa/xtensa.cc | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/gcc/config/xtensa/xtensa.cc b/gcc/config/xtensa/xtensa.cc index bc12799..e2549de 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"); |