[4/4] sparc: Add NOP in stack_protect_setsi if sparc_fix_b2bst enabled

Message ID 20210915093610.3112669-6-cederman@gaisler.com
State New
Headers show
Series
  • sparc: Print out bit names for LEON and LEON3 with -mdebug
Related show

Commit Message

Daniel Cederman Sept. 15, 2021, 9:36 a.m.
This is needed to prevent the Store -> (Non-store or load) -> Store
sequence.

gcc/ChangeLog:

        * config/sparc/sparc.md: Add NOP to prevent sensitive sequence for
        B2BST errata workaround.
---
 gcc/config/sparc/sparc.md | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

-- 
2.25.1

Comments

Eric Botcazou Sept. 15, 2021, 10:37 a.m. | #1
> gcc/ChangeLog:

> 

>         * config/sparc/sparc.md: Add NOP to prevent sensitive sequence for

>         B2BST errata workaround.


OK everywhere, but the ChangeLog entry should be:

	* config/sparc/sparc.md (stack_protect_set32): Add NOP...

Note that it's stack_protect_set32 on mainline and stack_protect_setsi before.

-- 
Eric Botcazou

Patch

diff --git a/gcc/config/sparc/sparc.md b/gcc/config/sparc/sparc.md
index 24b76e0cacd..3ac074a244d 100644
--- a/gcc/config/sparc/sparc.md
+++ b/gcc/config/sparc/sparc.md
@@ -8353,9 +8353,15 @@  visl")
 	(unspec:SI [(match_operand:SI 1 "memory_operand" "m")] UNSPEC_SP_SET))
    (set (match_scratch:SI 2 "=&r") (const_int 0))]
   "TARGET_ARCH32"
-  "ld\t%1, %2\;st\t%2, %0\;mov\t0, %2"
+{
+  if (sparc_fix_b2bst)
+    return "ld\t%1, %2\;st\t%2, %0\;mov\t0, %2\;nop";
+  else
+    return "ld\t%1, %2\;st\t%2, %0\;mov\t0, %2";
+}
   [(set_attr "type" "multi")
-   (set_attr "length" "3")])
+   (set (attr "length") (if_then_else (eq_attr "fix_b2bst" "true")
+		      (const_int 4) (const_int 3)))])
 
 (define_insn "stack_protect_set64"
   [(set (match_operand:DI 0 "memory_operand" "=m")