@@ -12012,6 +12012,27 @@ (define_insn "<mrrc>"
[(set_attr "length" "4")
(set_attr "type" "coproc")])
+(define_expand "speculation_barrier"
+ [(unspec_volatile [(const_int 0)] VUNSPEC_SPECULATION_BARRIER)]
+ "TARGET_EITHER"
+ "
+ /* Don't emit anything for Thumb1 and suppress the warning from the
+ generic expansion. */
+ if (!TARGET_32BIT)
+ DONE;
+ "
+)
+
+;; Generate a hard speculation barrier when we have not enabled speculation
+;; tracking.
+(define_insn "*speculation_barrier_insn"
+ [(unspec_volatile [(const_int 0)] VUNSPEC_SPECULATION_BARRIER)]
+ "TARGET_32BIT"
+ "isb\;dsb\\tsy"
+ [(set_attr "type" "block")
+ (set_attr "length" "8")]
+)
+
;; Vector bits common to IWMMXT and Neon
(include "vec-common.md")
;; Load the Intel Wireless Multimedia Extension patterns
@@ -168,6 +168,7 @@ (define_c_enum "unspecv" [
VUNSPEC_MCRR2 ; Represent the coprocessor mcrr2 instruction.
VUNSPEC_MRRC ; Represent the coprocessor mrrc instruction.
VUNSPEC_MRRC2 ; Represent the coprocessor mrrc2 instruction.
+ VUNSPEC_SPECULATION_BARRIER ; Represents an unconditional speculation barrier.
])
;; Enumerators for NEON unspecs.