diff mbox series

[SPARC] Fix PR target/86806

Message ID 2070690.lW1B8aZ1Eq@polaris
State New
Headers show
Series [SPARC] Fix PR target/86806 | expand

Commit Message

Eric Botcazou Dec. 12, 2018, 11:40 a.m. UTC
This adds the speculation barrier on SPARC-V9 in the form of membar #Sync.


2018-12-12  Eric Botcazou  <ebotcazou@adacore.com>

	PR target/86806
	* config/sparc/sparc.md (unspecv): Add UNSPECV_SPECULATION_BARRIER.
	(speculation_barrier): New instruction for V9.
diff mbox series

Patch

Index: config/sparc/sparc.md
===================================================================
--- config/sparc/sparc.md	(revision 267029)
+++ config/sparc/sparc.md	(working copy)
@@ -104,6 +104,9 @@  (define_c_enum "unspec" [
 
 (define_c_enum "unspecv" [
   UNSPECV_BLOCKAGE
+
+  UNSPECV_SPECULATION_BARRIER
+
   UNSPECV_PROBE_STACK_RANGE
 
   UNSPECV_FLUSHW
@@ -7309,6 +7312,14 @@  (define_insn "*frame_blockage<P:mode>"
   ""
   [(set_attr "length" "0")])
 
+;; We use membar #Sync for the speculation barrier on V9.
+
+(define_insn "speculation_barrier"
+  [(unspec_volatile [(const_int 0)] UNSPECV_SPECULATION_BARRIER)]
+  "TARGET_V9"
+  "membar\t64"
+  [(set_attr "type" "multi")])
+
 (define_expand "probe_stack"
   [(set (match_operand 0 "memory_operand" "") (const_int 0))]
   ""