[gcc(refs/users/wschmidt/heads/dd2)] rs6000: Fixes to hashst and hashchk

William Schmidt wschmidt@gcc.gnu.org
Wed Mar 17 22:02:24 GMT 2021


https://gcc.gnu.org/g:66e5b0c67e43fd66244bc5bf61314a6f762ff54d

commit 66e5b0c67e43fd66244bc5bf61314a6f762ff54d
Author: Bill Schmidt <wschmidt@linux.ibm.com>
Date:   Wed Mar 17 17:02:01 2021 -0500

    rs6000: Fixes to hashst and hashchk
    
    2021-03-17  Bill Schmidt  <wschmidt@linux.ibm.com>
    
    gcc/
            * config/rs6000/rs6000.md (hashst): Condition on
            rs6000_rop_protect.
            (hashstp): Likewise.
            (hashchk): Likewise, and change to only RHS parameters.
            (hashchkp): Likewise.

Diff:
---
 gcc/config/rs6000/rs6000.md | 29 +++++++++++++++--------------
 1 file changed, 15 insertions(+), 14 deletions(-)

diff --git a/gcc/config/rs6000/rs6000.md b/gcc/config/rs6000/rs6000.md
index 2065116487a..827c578b1e3 100644
--- a/gcc/config/rs6000/rs6000.md
+++ b/gcc/config/rs6000/rs6000.md
@@ -14946,39 +14946,40 @@
   "cmpeqb %0,%1,%2"
   [(set_attr "type" "logical")])
 
-;; TBD -- restrict to when -mrop-protect is specified.
+
+;; ROP mitigation instructions.
+
 (define_insn "hashst"
   [(set (match_operand:DI 0 "memory_operand" "=m")
         (unspec:DI [(match_operand:DI 1 "int_reg_operand" "r")]
 	           UNSPEC_HASHST))]
-  "TARGET_POWER10"
+  "TARGET_POWER10 && rs6000_rop_protect"
   "hashst %1,%0"
   [(set_attr "type" "store")])
 
-;; TBD -- restrict to when -mrop-protect is specified and privileged.
+;; TBD -- restrict to -mprivileged.
 (define_insn "hashstp"
   [(set (match_operand:DI 0 "memory_operand" "=m")
         (unspec:DI [(match_operand:DI 1 "int_reg_operand" "r")]
 	           UNSPEC_HASHSTP))]
-  "TARGET_POWER10"
+  "TARGET_POWER10 && rs6000_rop_protect"
   "hashstp %1,%0"
   [(set_attr "type" "store")])
 
-;; TBD -- restrict to when -mrop-protect is specified.
 (define_insn "hashchk"
-  [(set (match_operand:DI 0 "int_reg_operand" "=r")
-        (unspec:DI [(match_operand:DI 1 "memory_operand" "m")]
-	           UNSPEC_HASHCHK))]
-  "TARGET_POWER10"
+  [(match_operand:DI 0 "int_reg_operand" "r")
+   (unspec:DI [(match_operand:DI 1 "memory_operand" "m")]
+	      UNSPEC_HASHCHK)]
+  "TARGET_POWER10 && rs6000_rop_protect"
   "hashchk %0,%1"
   [(set_attr "type" "load")])
 
-;; TBD -- restrict to when -mrop-protect is specified and privileged.
+;; TBD -- restrict to -mprivileged.
 (define_insn "hashchkp"
-  [(set (match_operand:DI 0 "int_reg_operand" "=r")
-        (unspec:DI [(match_operand:DI 1 "memory_operand" "m")]
-	           UNSPEC_HASHCHKP))]
-  "TARGET_POWER10"
+  [(match_operand:DI 0 "int_reg_operand" "=r")
+   (unspec:DI [(match_operand:DI 1 "memory_operand" "m")]
+	      UNSPEC_HASHCHKP)]
+  "TARGET_POWER10 && rs6000_rop_protect"
   "hashchkp %0,%1"
   [(set_attr "type" "load")])


More information about the Gcc-cvs mailing list