summaryrefslogtreecommitdiff
path: root/gcc/config/sparc/sync.md
diff options
context:
space:
mode:
authorebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4>2011-06-28 22:03:44 +0000
committerebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4>2011-06-28 22:03:44 +0000
commit0e2a34c6ae002acc1344c7d5155331095369f3dd (patch)
treec8ae101d1719fb0c8279bb0fd67a8bf20739f912 /gcc/config/sparc/sync.md
parentf387b4930d29c1e21732ef77b43eefc718e72895 (diff)
downloadgcc-0e2a34c6ae002acc1344c7d5155331095369f3dd.tar.gz
* config/sparc/sync.md (*stbar): Delete.
(*membar_v8): New insn to implement UNSPEC_MEMBAR in SPARC-V8. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@175604 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/config/sparc/sync.md')
-rw-r--r--gcc/config/sparc/sync.md13
1 files changed, 9 insertions, 4 deletions
diff --git a/gcc/config/sparc/sync.md b/gcc/config/sparc/sync.md
index 5dd37d09475..a7380ab3c70 100644
--- a/gcc/config/sparc/sync.md
+++ b/gcc/config/sparc/sync.md
@@ -30,15 +30,20 @@
{
operands[0] = gen_rtx_MEM (BLKmode, gen_rtx_SCRATCH (Pmode));
MEM_VOLATILE_P (operands[0]) = 1;
-
})
-(define_insn "*stbar"
+;; In V8, loads are blocking and ordered wrt earlier loads, i.e. every load
+;; is virtually followed by a load barrier (membar #LoadStore | #LoadLoad).
+;; In PSO, stbar orders the stores (membar #StoreStore).
+;; In TSO, ldstub orders the stores wrt subsequent loads (membar #StoreLoad).
+;; The combination of the three yields a full memory barrier in all cases.
+(define_insn "*membar_v8"
[(set (match_operand:BLK 0 "" "")
(unspec:BLK [(match_dup 0)] UNSPEC_MEMBAR))]
"TARGET_V8"
- "stbar"
- [(set_attr "type" "multi")])
+ "stbar\n\tldstub\t[%%sp-1], %%g0"
+ [(set_attr "type" "multi")
+ (set_attr "length" "2")])
;; membar #StoreStore | #LoadStore | #StoreLoad | #LoadLoad
(define_insn "*membar"