public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Daniel Hellstrom <danielh@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc r11-9005] sparc: Prevent atomic instructions in beginning of functions for UT700
Date: Thu, 16 Sep 2021 11:44:28 +0000 (GMT)	[thread overview]
Message-ID: <20210916114428.200EA3858413@sourceware.org> (raw)

https://gcc.gnu.org/g:7b30a12edf7a3a461bbfc9cbb29b3050c7164032

commit r11-9005-g7b30a12edf7a3a461bbfc9cbb29b3050c7164032
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 2487caf72da..6f419f6fd58 100644
--- a/gcc/config/sparc/sparc.c
+++ b/gcc/config/sparc/sparc.c
@@ -1124,6 +1124,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 ();
@@ -1148,6 +1149,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


                 reply	other threads:[~2021-09-16 11:44 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20210916114428.200EA3858413@sourceware.org \
    --to=danielh@gcc.gnu.org \
    --cc=gcc-cvs@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).