From bb8b0096829209874018c0997f340a43ca8b0461 Mon Sep 17 00:00:00 2001 From: Richard Earnshaw Date: Tue, 31 Jul 2018 17:35:41 +0000 Subject: [PATCH] Arm - add speculation_barrier pattern 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. From-SVN: r263169 --- gcc/ChangeLog | 6 ++++++ gcc/config/arm/arm.md | 21 +++++++++++++++++++++ gcc/config/arm/unspecs.md | 1 + 3 files changed, 28 insertions(+) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index de37f1f879c..63971fa1c9a 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2018-07-31 Richard Earnshaw + + * 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 * builtin-types.def (BT_FN_PTR_PTR_VAR): New function type. diff --git a/gcc/config/arm/arm.md b/gcc/config/arm/arm.md index 361a02668b0..ca2a2f5469f 100644 --- a/gcc/config/arm/arm.md +++ b/gcc/config/arm/arm.md @@ -12012,6 +12012,27 @@ [(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 diff --git a/gcc/config/arm/unspecs.md b/gcc/config/arm/unspecs.md index b05f85e10e4..19416736ef9 100644 --- a/gcc/config/arm/unspecs.md +++ b/gcc/config/arm/unspecs.md @@ -168,6 +168,7 @@ 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. -- 2.30.2