public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Daniel Cederman <cederman@gaisler.com>
To: gcc-patches@gcc.gnu.org
Cc: ebotcazou@adacore.com,	sebastian.huber@embedded-brains.de,
	daniel@gaisler.com
Subject: [PATCH v2 2/4] [SPARC] Errata workaround for GRLIB-TN-0011
Date: Mon, 27 Nov 2017 09:57:00 -0000	[thread overview]
Message-ID: <20171127095715.5938-3-cederman@gaisler.com> (raw)
In-Reply-To: <20171127095715.5938-1-cederman@gaisler.com>

This patch provides a workaround for the errata described in GRLIB-TN-0011.

If the workaround is enabled it will:

* Insert .align 16 before atomic instructions (swap, ldstub, casa).

It is applicable to GR712RC.

gcc/ChangeLog:

2017-11-17  Daniel Cederman  <cederman@gaisler.com>

	* config/sparc/sync.md (swapsi): 16-byte align if sparc_fix_gr712rc.
	(atomic_compare_and_swap_leon3_1): Likewise.
	(ldstub): Likewise.
---
 gcc/config/sparc/sync.md | 28 +++++++++++++++++++++++-----
 1 file changed, 23 insertions(+), 5 deletions(-)

diff --git a/gcc/config/sparc/sync.md b/gcc/config/sparc/sync.md
index 1593bde..ead7c77 100644
--- a/gcc/config/sparc/sync.md
+++ b/gcc/config/sparc/sync.md
@@ -222,12 +222,16 @@
 	  UNSPECV_CAS))]
   "TARGET_LEON3"
 {
+  if (sparc_fix_gr712rc)
+    output_asm_insn (".align\t16", operands);
   if (TARGET_SV_MODE)
     return "casa\t%1 0xb, %2, %0"; /* ASI for supervisor data space.  */
   else
     return "casa\t%1 0xa, %2, %0"; /* ASI for user data space.  */
 }
-  [(set_attr "type" "multi")])
+  [(set_attr "type" "multi")
+   (set (attr "length") (if_then_else (eq_attr "fix_gr712rc" "true")
+		      (const_int 4) (const_int 1)))])
 
 (define_insn "*atomic_compare_and_swapdi_v8plus"
   [(set (match_operand:DI 0 "register_operand" "=h")
@@ -275,8 +279,15 @@
    (set (match_dup 1)
 	(match_operand:SI 2 "register_operand" "0"))]
   "(TARGET_V8 || TARGET_V9) && !sparc_fix_ut699"
-  "swap\t%1, %0"
-  [(set_attr "type" "multi")])
+{
+  if (sparc_fix_gr712rc)
+    return ".align\t16\n\tswap\t%1, %0";
+  else
+    return "swap\t%1, %0";
+}
+  [(set_attr "type" "multi")
+   (set (attr "length") (if_then_else (eq_attr "fix_gr712rc" "true")
+		      (const_int 4) (const_int 1)))])
 
 (define_expand "atomic_test_and_set"
   [(match_operand:QI 0 "register_operand" "")
@@ -307,5 +318,12 @@
 			    UNSPECV_LDSTUB))
    (set (match_dup 1) (const_int -1))]
   "!sparc_fix_ut699"
-  "ldstub\t%1, %0"
-  [(set_attr "type" "multi")])
+{
+  if (sparc_fix_gr712rc)
+    return ".align\t16\n\tldstub\t%1, %0";
+  else
+    return "ldstub\t%1, %0";
+}
+  [(set_attr "type" "multi")
+   (set (attr "length") (if_then_else (eq_attr "fix_gr712rc" "true")
+		      (const_int 4) (const_int 1)))])
-- 
2.9.3

  parent reply	other threads:[~2017-11-27  9:57 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-27  9:57 [PATCH v2 0/4] [SPARC] Workarounds for UT699, UT700, and GR712RC errata Daniel Cederman
2017-11-27  9:57 ` [PATCH v2 3/4] [SPARC] Errata workaround for GRLIB-TN-0010 Daniel Cederman
2017-11-28 10:04   ` Eric Botcazou
2017-12-04 11:06   ` Eric Botcazou
2017-12-04 12:25     ` Daniel Cederman
2017-12-04 23:14       ` Eric Botcazou
2017-11-27  9:57 ` Daniel Cederman [this message]
2017-11-28 10:03   ` [PATCH v2 2/4] [SPARC] Errata workaround for GRLIB-TN-0011 Eric Botcazou
2017-11-27 10:04 ` [PATCH v2 4/4] [SPARC] Errata workaround for GRLIB-TN-0013 Daniel Cederman
2017-11-27 16:43   ` Daniel Cederman
2017-11-28 10:08     ` Eric Botcazou
2017-11-28 10:05   ` Eric Botcazou
2017-11-27 10:04 ` [PATCH v2 1/4] [SPARC] Errata workaround for GRLIB-TN-0012 Daniel Cederman
2017-11-28 10:01   ` Eric Botcazou
2017-11-28 12:26     ` 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=20171127095715.5938-3-cederman@gaisler.com \
    --to=cederman@gaisler.com \
    --cc=daniel@gaisler.com \
    --cc=ebotcazou@adacore.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=sebastian.huber@embedded-brains.de \
    /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).