[gcc r10-10128] sparc: Prevent atomic instructions in beginning of functions for UT700
Daniel Hellstrom
danielh@gcc.gnu.org
Thu Sep 16 11:48:11 GMT 2021
https://gcc.gnu.org/g:d19b49e5c397b9271079a6421e4efa574dbfbd78
commit r10-10128-gd19b49e5c397b9271079a6421e4efa574dbfbd78
Author: Daniel Cederman <cederman@gaisler.com>
Date: Mon Oct 12 08:50:35 2020 +0200
sparc: Prevent atomic instructions in beginning of functions for UT700
A call to the function might have a load instruction in the delay slot
and a load followed by an atomic function could cause a deadlock.
gcc/ChangeLog:
* config/sparc/sparc.c (sparc_do_work_around_errata): Do not begin
functions with atomic instruction in the UT700 errata workaround.
Diff:
---
gcc/config/sparc/sparc.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/gcc/config/sparc/sparc.c b/gcc/config/sparc/sparc.c
index 7941937e3aa..5894ad692d4 100644
--- a/gcc/config/sparc/sparc.c
+++ b/gcc/config/sparc/sparc.c
@@ -1120,6 +1120,7 @@ static unsigned int
sparc_do_work_around_errata (void)
{
rtx_insn *insn, *next;
+ bool find_first_useful = true;
/* Force all instructions to be split into their final form. */
split_all_insns_noflow ();
@@ -1144,6 +1145,16 @@ sparc_do_work_around_errata (void)
else
jump = NULL;
+ /* Do not begin function with atomic instruction. */
+ if (sparc_fix_ut700
+ && find_first_useful
+ && USEFUL_INSN_P (insn))
+ {
+ find_first_useful = false;
+ if (atomic_insn_for_leon3_p (insn))
+ emit_insn_before (gen_nop (), insn);
+ }
+
/* Place a NOP at the branch target of an integer branch if it is a
floating-point operation or a floating-point branch. */
if (sparc_fix_gr712rc
More information about the Gcc-cvs
mailing list