diff mbox series

[2/4,SPARC] Errata workaround for GRLIB-TN-0011

Message ID 20171120125003.22670-3-cederman@gaisler.com
State New
Headers show
Series Workarounds for UT699, UT700, and GR712RC errata | expand

Commit Message

Daniel Cederman Nov. 20, 2017, 12:50 p.m. UTC
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 | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

Comments

Eric Botcazou Nov. 24, 2017, 10:47 a.m. UTC | #1
> 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.

You need to adjust the "length" attribute accordingly (and conservatively), 
see atomic_compare_and_swapdi_v8plus for reference.
diff mbox series

Patch

diff --git a/gcc/config/sparc/sync.md b/gcc/config/sparc/sync.md
index 1593bde..d5c505b 100644
--- a/gcc/config/sparc/sync.md
+++ b/gcc/config/sparc/sync.md
@@ -222,6 +222,8 @@ 
 	  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
@@ -275,7 +277,12 @@ 
    (set (match_dup 1)
 	(match_operand:SI 2 "register_operand" "0"))]
   "(TARGET_V8 || TARGET_V9) && !sparc_fix_ut699"
-  "swap\t%1, %0"
+{
+  if (sparc_fix_gr712rc)
+    return ".align\t16\n\tswap\t%1, %0";
+  else
+    return "swap\t%1, %0";
+}
   [(set_attr "type" "multi")])
 
 (define_expand "atomic_test_and_set"
@@ -307,5 +314,10 @@ 
 			    UNSPECV_LDSTUB))
    (set (match_dup 1) (const_int -1))]
   "!sparc_fix_ut699"
-  "ldstub\t%1, %0"
+{
+  if (sparc_fix_gr712rc)
+    return ".align\t16\n\tldstub\t%1, %0";
+  else
+    return "ldstub\t%1, %0";
+}
   [(set_attr "type" "multi")])