public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r12-3575] sparc: Prevent atomic instructions in beginning of functions for UT700
@ 2021-09-16 11:08 Daniel Hellstrom
  0 siblings, 0 replies; only message in thread
From: Daniel Hellstrom @ 2021-09-16 11:08 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:d4aa16699d4bcf9d335a206d3d8f6c1a80142aab

commit r12-3575-gd4aa16699d4bcf9d335a206d3d8f6c1a80142aab
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 94061e111bd..7c9b347254c 100644
--- a/gcc/config/sparc/sparc.c
+++ b/gcc/config/sparc/sparc.c
@@ -1116,6 +1116,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 ();
@@ -1140,6 +1141,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


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-09-16 11:08 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-16 11:08 [gcc r12-3575] sparc: Prevent atomic instructions in beginning of functions for UT700 Daniel Hellstrom

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).