S/390: Implement speculation barrier
authorAndreas Krebbel <krebbel@linux.ibm.com>
Thu, 27 Sep 2018 08:03:42 +0000 (08:03 +0000)
committerAndreas Krebbel <krebbel@gcc.gnu.org>
Thu, 27 Sep 2018 08:03:42 +0000 (08:03 +0000)
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.

From-SVN: r264663

gcc/ChangeLog
gcc/config/s390/s390.md

index 54eb0b8d15a957e50c682b8a23823654914e7c91..8691d52462a43b6ff7750e99cd9694d01489d0c4 100644 (file)
@@ -1,3 +1,11 @@
+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.
+
 2018-09-26  Indu Bhagat  <indu.bhagat@oracle.com>
 
        PR gcov-profile/86957
index 537ed35af184b1cf6490e44b7434d409e8f7b0b8..1286d2ca33632ba6ff5e1ba69c4c9e685006528d 100644 (file)
    (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
 (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"
   "")
                     (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")])
 
   ""
   "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"
+  "")