[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL v5 09/18] tcg/mips: Add support for fence
From: |
Richard Henderson |
Subject: |
[Qemu-devel] [PULL v5 09/18] tcg/mips: Add support for fence |
Date: |
Wed, 14 Sep 2016 09:20:04 -0700 |
From: Pranith Kumar <address@hidden>
Signed-off-by: Pranith Kumar <address@hidden>
Message-Id: <address@hidden>
Signed-off-by: Richard Henderson <address@hidden>
---
tcg/mips/tcg-target.inc.c | 30 ++++++++++++++++++++++++++++++
1 file changed, 30 insertions(+)
diff --git a/tcg/mips/tcg-target.inc.c b/tcg/mips/tcg-target.inc.c
index acb6ff0..abce602 100644
--- a/tcg/mips/tcg-target.inc.c
+++ b/tcg/mips/tcg-target.inc.c
@@ -292,6 +292,7 @@ typedef enum {
OPC_JALR = OPC_SPECIAL | 0x09,
OPC_MOVZ = OPC_SPECIAL | 0x0A,
OPC_MOVN = OPC_SPECIAL | 0x0B,
+ OPC_SYNC = OPC_SPECIAL | 0x0F,
OPC_MFHI = OPC_SPECIAL | 0x10,
OPC_MFLO = OPC_SPECIAL | 0x12,
OPC_MULT = OPC_SPECIAL | 0x18,
@@ -339,6 +340,14 @@ typedef enum {
* backwards-compatible at the assembly level.
*/
OPC_MUL = use_mips32r6_instructions ? OPC_MUL_R6 : OPC_MUL_R5,
+
+ /* MIPS r6 introduced names for weaker variants of SYNC. These are
+ backward compatible to previous architecture revisions. */
+ OPC_SYNC_WMB = OPC_SYNC | 0x04 << 5,
+ OPC_SYNC_MB = OPC_SYNC | 0x10 << 5,
+ OPC_SYNC_ACQUIRE = OPC_SYNC | 0x11 << 5,
+ OPC_SYNC_RELEASE = OPC_SYNC | 0x12 << 5,
+ OPC_SYNC_RMB = OPC_SYNC | 0x13 << 5,
} MIPSInsn;
/*
@@ -1384,6 +1393,22 @@ static void tcg_out_qemu_st(TCGContext *s, const TCGArg
*args, bool is_64)
#endif
}
+static void tcg_out_mb(TCGContext *s, TCGArg a0)
+{
+ static const MIPSInsn sync[] = {
+ /* Note that SYNC_MB is a slightly weaker than SYNC 0,
+ as the former is an ordering barrier and the latter
+ is a completion barrier. */
+ [0 ... TCG_MO_ALL] = OPC_SYNC_MB,
+ [TCG_MO_LD_LD] = OPC_SYNC_RMB,
+ [TCG_MO_ST_ST] = OPC_SYNC_WMB,
+ [TCG_MO_LD_ST] = OPC_SYNC_RELEASE,
+ [TCG_MO_LD_ST | TCG_MO_ST_ST] = OPC_SYNC_RELEASE,
+ [TCG_MO_LD_ST | TCG_MO_LD_LD] = OPC_SYNC_ACQUIRE,
+ };
+ tcg_out32(s, sync[a0 & TCG_MO_ALL]);
+}
+
static inline void tcg_out_op(TCGContext *s, TCGOpcode opc,
const TCGArg *args, const int *const_args)
{
@@ -1653,6 +1678,9 @@ static inline void tcg_out_op(TCGContext *s, TCGOpcode
opc,
const_args[4], const_args[5], true);
break;
+ case INDEX_op_mb:
+ tcg_out_mb(s, a0);
+ break;
case INDEX_op_mov_i32: /* Always emitted via tcg_out_mov. */
case INDEX_op_movi_i32: /* Always emitted via tcg_out_movi. */
case INDEX_op_call: /* Always emitted via tcg_out_call. */
@@ -1733,6 +1761,8 @@ static const TCGTargetOpDef mips_op_defs[] = {
{ INDEX_op_qemu_ld_i64, { "L", "L", "lZ", "lZ" } },
{ INDEX_op_qemu_st_i64, { "SZ", "SZ", "SZ", "SZ" } },
#endif
+
+ { INDEX_op_mb, { } },
{ -1 },
};
--
2.7.4
- [Qemu-devel] [PULL v5 03/18] cpu-exec: Check -dfilter for -d cpu, (continued)
- [Qemu-devel] [PULL v5 03/18] cpu-exec: Check -dfilter for -d cpu, Richard Henderson, 2016/09/14
- [Qemu-devel] [PULL v5 01/18] tcg: Support arbitrary size + alignment, Richard Henderson, 2016/09/14
- [Qemu-devel] [PULL v5 04/18] Introduce TCGOpcode for memory barrier, Richard Henderson, 2016/09/14
- [Qemu-devel] [PULL v5 02/18] tcg: Merge GETPC and GETRA, Richard Henderson, 2016/09/14
- [Qemu-devel] [PULL v5 05/18] tcg/i386: Add support for fence, Richard Henderson, 2016/09/14
- [Qemu-devel] [PULL v5 06/18] tcg/aarch64: Add support for fence, Richard Henderson, 2016/09/14
- [Qemu-devel] [PULL v5 07/18] tcg/arm: Add support for fence, Richard Henderson, 2016/09/14
- [Qemu-devel] [PULL v5 08/18] tcg/ia64: Add support for fence, Richard Henderson, 2016/09/14
- [Qemu-devel] [PULL v5 10/18] tcg/ppc: Add support for fence, Richard Henderson, 2016/09/14
- [Qemu-devel] [PULL v5 11/18] tcg/s390: Add support for fence, Richard Henderson, 2016/09/14
- [Qemu-devel] [PULL v5 09/18] tcg/mips: Add support for fence,
Richard Henderson <=
- [Qemu-devel] [PULL v5 13/18] tcg/tci: Add support for fence, Richard Henderson, 2016/09/14
- [Qemu-devel] [PULL v5 15/18] target-arm: Generate fences in ARMv7 frontend, Richard Henderson, 2016/09/14
- [Qemu-devel] [PULL v5 12/18] tcg/sparc: Add support for fence, Richard Henderson, 2016/09/14
- [Qemu-devel] [PULL v5 14/18] target-alpha: Generate fence op, Richard Henderson, 2016/09/14
- [Qemu-devel] [PULL v5 16/18] target-aarch64: Generate fences for aarch64, Richard Henderson, 2016/09/14
- [Qemu-devel] [PULL v5 17/18] target-i386: Generate fences for x86, Richard Henderson, 2016/09/14
- [Qemu-devel] [PULL v5 18/18] tcg: Optimize fence instructions, Richard Henderson, 2016/09/14
- Re: [Qemu-devel] [PULL v5 00/18] tcg queued patches, Peter Maydell, 2016/09/15