This patch defines a speculation barrier for AArch32.
* config/arm/unspecs.md (unspecv): Add VUNSPEC_SPECULATION_BARRIER.
* config/arm/arm.md (speculation_barrier): New expand.
(speculation_barrier_insn): New pattern.
(backported
be626997e0edc646c17e9e1eadabf97152e82eeb)
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@263169
138bc75d-0d04-0410-961f-
82ee72b054a4
Change-Id: I5f587e22dd1a92440a6a208e2baca189427557da
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.
(BT_FN_I1_I1_VAR, BT_FN_I2_I2_VAR, BT_FN_I4_I4_VAR): Likewise.
(BT_FN_I8_I8_VAR, BT_FN_I16_I16_VAR): Likewise.
DONE;
})
+(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_GET_FPSCR ; Represent fetch of FPSCR content.
VUNSPEC_SET_FPSCR ; Represent assign of FPSCR content.
VUNSPEC_PROBE_STACK_RANGE ; Represent stack range probing.
+ VUNSPEC_SPECULATION_BARRIER ; Represents an unconditional speculation barrier.
])
;; Enumerators for NEON unspecs.