AArch64 - add speculation barrier
authorRichard Earnshaw <rearnsha@arm.com>
Tue, 31 Jul 2018 17:35:50 +0000 (17:35 +0000)
committerRichard Earnshaw <rearnsha@gcc.gnu.org>
Tue, 31 Jul 2018 17:35:50 +0000 (17:35 +0000)
Similar to Arm, this adds an unconditional speculation barrier for AArch64.

* config/aarch64.md (unspecv): Add UNSPECV_SPECULAION_BARRIER.
(speculation_barrier): New insn.

From-SVN: r263170

gcc/ChangeLog
gcc/config/aarch64/aarch64.md

index 63971fa1c9a854c78fcfe9f8472a279a03b86cb9..179f97ad50dd817d36f59eb5fb07f30ef069ce78 100644 (file)
@@ -1,3 +1,8 @@
+2018-07-31  Richard Earnshaw  <rearnsha@arm.com>
+
+       * config/aarch64.md (unspecv): Add UNSPECV_SPECULAION_BARRIER.
+       (speculation_barrier): New insn.
+
 2018-07-31  Richard Earnshaw  <rearnsha@arm.com>
 
        * config/arm/unspecs.md (unspecv): Add VUNSPEC_SPECULATION_BARRIER.
index e9c16f9697b766a5c56b6269a83b7276654c5668..de5230682d02f6ee68d7de841563f9f4bc7a3199 100644 (file)
     UNSPECV_SET_FPSR           ; Represent assign of FPSR content.
     UNSPECV_BLOCKAGE           ; Represent a blockage
     UNSPECV_PROBE_STACK_RANGE  ; Represent stack range probing.
+    UNSPECV_SPECULATION_BARRIER ; Represent speculation barrier.
   ]
 )
 
                   (match_operand 1))
              (clobber (reg:CC CC_REGNUM))])])
 
+;; Hard speculation barrier.
+(define_insn "speculation_barrier"
+  [(unspec_volatile [(const_int 0)] UNSPECV_SPECULATION_BARRIER)]
+  ""
+  "isb\;dsb\\tsy"
+  [(set_attr "length" "8")
+   (set_attr "type" "block")]
+)
+
 ;; AdvSIMD Stuff
 (include "aarch64-simd.md")