+2018-07-31 Richard Earnshaw <rearnsha@arm.com>
+
+ * config/arm/unspecs.md (unspecv): Add VUNSPEC_SPECULATION_BARRIER.
+ * config/arm/arm.md (speculation_barrier): New expand.
+ (speculation_barrier_insn): New pattern.
+
2018-07-31 Richard Earnshaw <rearnsha@arm.com>
* builtin-types.def (BT_FN_PTR_PTR_VAR): New function type.
[(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
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.