summaryrefslogtreecommitdiff
path: root/gnu
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@cvs.openbsd.org>2015-12-17 11:28:02 +0000
committerMark Kettenis <kettenis@cvs.openbsd.org>2015-12-17 11:28:02 +0000
commit5d081ca74f2ed9c28890dd668d1ac1e827540496 (patch)
treed5f8afe51618fdd686f9e5e5de5f9b266ef38c45 /gnu
parent0d7c89a48a1daf972dd8aaaa7794b31b9f64331d (diff)
Implement a memory barrier for mips. Basically this makes __sync_synchronize()
emit a "sync" instruction. ok visa@
Diffstat (limited to 'gnu')
-rw-r--r--gnu/gcc/gcc/config/mips/mips.md16
1 files changed, 16 insertions, 0 deletions
diff --git a/gnu/gcc/gcc/config/mips/mips.md b/gnu/gcc/gcc/config/mips/mips.md
index 969d22fa00f..c20219e81f4 100644
--- a/gnu/gcc/gcc/config/mips/mips.md
+++ b/gnu/gcc/gcc/config/mips/mips.md
@@ -47,6 +47,7 @@
(UNSPEC_MFHILO 26)
(UNSPEC_TLS_LDM 27)
(UNSPEC_TLS_GET_TP 28)
+ (UNSPEC_SYNC 29)
(UNSPEC_ADDRESS_FIRST 100)
@@ -5483,3 +5484,18 @@
; The MIPS DSP Instructions.
(include "mips-dsp.md")
+
+(define_expand "memory_barrier"
+ [(set (mem:BLK (match_dup 0))
+ (unspec:BLK [(mem:BLK (match_dup 0))] UNSPEC_SYNC))]
+ ""
+{
+ operands[0] = gen_rtx_MEM (BLKmode, gen_rtx_SCRATCH (Pmode));
+ MEM_VOLATILE_P (operands[0]) = 1;
+})
+
+(define_insn "*sync_internal"
+ [(set (match_operand:BLK 0 "" "")
+ (unspec:BLK [(match_operand:BLK 1 "" "")] UNSPEC_SYNC))]
+ ""
+ "sync")