]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
sparc: Add NOP in stack_protect_set32 if sparc_fix_b2bst enabled
authorDaniel Cederman <cederman@gaisler.com>
Thu, 1 Oct 2020 07:11:38 +0000 (09:11 +0200)
committerDaniel Hellstrom <daniel@gaisler.com>
Thu, 16 Sep 2021 11:05:51 +0000 (13:05 +0200)
This is needed to prevent the Store -> (Non-store or load) -> Store
sequence.

gcc/ChangeLog:

* config/sparc/sparc.md (stack_protect_set32): Add NOP to prevent
sensitive sequence for B2BST errata workaround.

gcc/config/sparc/sparc.md

index 24b76e0cacd49fde7f130558dde6113bc88013bd..3ac074a244d503fce6ed7388b162e5e38e5de428 100644 (file)
@@ -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")