public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Daniel Hellstrom <danielh@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc r12-3576] sparc: Add NOP in stack_protect_set32 if sparc_fix_b2bst enabled
Date: Thu, 16 Sep 2021 11:08:52 +0000 (GMT)	[thread overview]
Message-ID: <20210916110852.22CF73857418@sourceware.org> (raw)

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

commit r12-3576-ga053dab90e69c2a8289c95caec236f239a2a764b
Author: Daniel Cederman <cederman@gaisler.com>
Date:   Thu Oct 1 09:11:38 2020 +0200

    sparc: Add NOP in stack_protect_set32 if sparc_fix_b2bst enabled
    
    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.

Diff:
---
 gcc/config/sparc/sparc.md | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

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


                 reply	other threads:[~2021-09-16 11:08 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20210916110852.22CF73857418@sourceware.org \
    --to=danielh@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    /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).