[Committed] S/390: Implement speculation barrier

Message ID 1538035482-19350-1-git-send-email-krebbel@linux.ibm.com
State New
Headers show
Series
  • [Committed] S/390: Implement speculation barrier
Related show

Commit Message

Andreas Krebbel Sept. 27, 2018, 8:04 a.m.
gcc/ChangeLog:

2018-09-27  Andreas Krebbel  <krebbel@linux.ibm.com>

	* config/s390/s390.md (PPA_TX_ABORT, PPA_OOO_BARRIER): New
	constant definitions.
	("tx_assist"): Replace magic number with PPA_TX_ABORT.
	("*ppa"): Enable pattern also for -march=zEC12 -mno-htm.
	("speculation_barrier"): New expander definition.
---
 gcc/config/s390/s390.md | 21 +++++++++++++++++++--
 1 file changed, 19 insertions(+), 2 deletions(-)

-- 
2.7.4

Patch

diff --git a/gcc/config/s390/s390.md b/gcc/config/s390/s390.md
index 537ed35..1286d2c 100644
--- a/gcc/config/s390/s390.md
+++ b/gcc/config/s390/s390.md
@@ -410,6 +410,15 @@ 
    (PFPO_RND_MODE_BFP             1)
   ])
 
+;; PPA constants
+
+; Immediate values which can be used as the third operand to the
+; perform processor assist instruction
+
+(define_constants
+  [(PPA_TX_ABORT                 1)
+   (PPA_OOO_BARRIER             15)])
+
 ; Immediate operands for tbegin and tbeginc
 (define_constants [(TBEGIN_MASK  65292)]) ; 0xff0c
 (define_constants [(TBEGINC_MASK 65288)]) ; 0xff08
@@ -11415,7 +11424,7 @@ 
 (define_expand "tx_assist"
   [(unspec_volatile [(match_operand:SI 0 "register_operand" "")
 		     (reg:SI GPR0_REGNUM)
-		     (const_int 1)]
+		     (const_int PPA_TX_ABORT)]
 		    UNSPECV_PPA)]
   "TARGET_HTM"
   "")
@@ -11425,7 +11434,7 @@ 
 		     (match_operand:SI 1 "register_operand" "d")
 		     (match_operand 2 "const_int_operand" "I")]
 		    UNSPECV_PPA)]
-  "TARGET_HTM && INTVAL (operands[2]) < 16"
+  "(TARGET_ZEC12 || TARGET_HTM) && INTVAL (operands[2]) < 16"
   "ppa\t%0,%1,%2"
   [(set_attr "op_type" "RRF")])
 
@@ -11592,3 +11601,11 @@ 
   ""
   "bcr\t7,%%r0"
   [(set_attr "op_type" "RR")])
+
+(define_expand "speculation_barrier"
+  [(unspec_volatile [(reg:SI GPR0_REGNUM)
+		     (reg:SI GPR0_REGNUM)
+		     (const_int PPA_OOO_BARRIER)]
+		    UNSPECV_PPA)]
+  "TARGET_ZEC12"
+  "")