From: Daniel Cederman <cederman@gaisler.com>
To: gcc-patches@gcc.gnu.org
Cc: daniel@gaisler.com, ebotcazou@libertysurf.fr
Subject: [PATCH 3/4] sparc: Prevent atomic instructions in beginning of functions for UT700
Date: Wed, 15 Sep 2021 11:36:09 +0200 [thread overview]
Message-ID: <20210915093610.3112669-5-cederman@gaisler.com> (raw)
In-Reply-To: <20210915093610.3112669-1-cederman@gaisler.com>
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.
---
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 b087c5b3fc8..5177d48793d 100644
--- a/gcc/config/sparc/sparc.c
+++ b/gcc/config/sparc/sparc.c
@@ -1106,6 +1106,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 ();
@@ -1130,6 +1131,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
--
2.25.1
next prev parent reply other threads:[~2021-09-15 9:36 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-15 9:36 [PATCH] sparc: Add scheduling information for LEON5 Daniel Cederman
2021-09-15 9:36 ` [PATCH] sparc: Print out bit names for LEON and LEON3 with -mdebug Daniel Cederman
2021-09-15 10:19 ` Eric Botcazou
2021-09-15 9:36 ` [PATCH 1/4] sparc: Treat more instructions as load or store in errata workarounds Daniel Cederman
2021-09-15 10:23 ` Eric Botcazou
2021-09-15 9:36 ` [PATCH 2/4] sparc: Skip all empty assembly statements Daniel Cederman
2021-09-15 10:31 ` Eric Botcazou
2021-09-15 9:36 ` Daniel Cederman [this message]
2021-09-15 10:32 ` [PATCH 3/4] sparc: Prevent atomic instructions in beginning of functions for UT700 Eric Botcazou
2021-09-15 9:36 ` [PATCH 4/4] sparc: Add NOP in stack_protect_setsi if sparc_fix_b2bst enabled Daniel Cederman
2021-09-15 10:37 ` Eric Botcazou
2021-09-15 10:18 ` [PATCH] sparc: Add scheduling information for LEON5 Eric Botcazou
2021-09-15 11:04 ` Daniel Cederman
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=20210915093610.3112669-5-cederman@gaisler.com \
--to=cederman@gaisler.com \
--cc=daniel@gaisler.com \
--cc=ebotcazou@libertysurf.fr \
--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).