From: Pranith Kumar <bobby.prani@gmail.com>
To: "Peter Maydell" <peter.maydell@linaro.org>,
"Richard Henderson" <rth@twiddle.net>,
"Alex Bennée" <alex.bennee@linaro.org>,
"Sergey Fedorov" <serge.fdrv@gmail.com>,
"open list:i386 target" <qemu-devel@nongnu.org>
Subject: [Qemu-devel] [RFC PATCH 2/3] tcg: Add support for fence generation in x86 backend
Date: Tue, 24 May 2016 13:18:55 -0400 [thread overview]
Message-ID: <20160524171856.1000-3-bobby.prani@gmail.com> (raw)
In-Reply-To: <20160524171856.1000-1-bobby.prani@gmail.com>
Signed-off-by: Pranith Kumar <bobby.prani@gmail.com>
---
tcg/i386/tcg-target.h | 1 +
tcg/i386/tcg-target.inc.c | 9 +++++++++
tcg/tcg-opc.h | 2 +-
tcg/tcg.c | 1 +
4 files changed, 12 insertions(+), 1 deletion(-)
diff --git a/tcg/i386/tcg-target.h b/tcg/i386/tcg-target.h
index 92be341..93ea42e 100644
--- a/tcg/i386/tcg-target.h
+++ b/tcg/i386/tcg-target.h
@@ -100,6 +100,7 @@ extern bool have_bmi1;
#define TCG_TARGET_HAS_muls2_i32 1
#define TCG_TARGET_HAS_muluh_i32 0
#define TCG_TARGET_HAS_mulsh_i32 0
+#define TCG_TARGET_HAS_fence 1
#if TCG_TARGET_REG_BITS == 64
#define TCG_TARGET_HAS_extrl_i64_i32 0
diff --git a/tcg/i386/tcg-target.inc.c b/tcg/i386/tcg-target.inc.c
index 238fa10..cf49272 100644
--- a/tcg/i386/tcg-target.inc.c
+++ b/tcg/i386/tcg-target.inc.c
@@ -347,6 +347,7 @@ static inline int tcg_target_const_match(tcg_target_long val, TCGType type,
#define OPC_SHRX (0xf7 | P_EXT38 | P_SIMDF2)
#define OPC_TESTL (0x85)
#define OPC_XCHG_ax_r32 (0x90)
+#define OPC_MFENCE (0xAE | P_EXT)
#define OPC_GRP3_Ev (0xf7)
#define OPC_GRP5 (0xff)
@@ -686,6 +687,14 @@ static inline void tcg_out_pushi(TCGContext *s, tcg_target_long val)
}
}
+static inline void tcg_out_fence(TCGContext *s)
+{
+ /* TODO: Figure out an appropriate place for the encoding */
+ tcg_out8(s, 0x0F);
+ tcg_out8(s, 0xAE);
+ tcg_out8(s, 0xF0);
+}
+
static inline void tcg_out_push(TCGContext *s, int reg)
{
tcg_out_opc(s, OPC_PUSH_r32 + LOWREGMASK(reg), 0, reg, 0);
diff --git a/tcg/tcg-opc.h b/tcg/tcg-opc.h
index 4696cf1..b772d90 100644
--- a/tcg/tcg-opc.h
+++ b/tcg/tcg-opc.h
@@ -42,7 +42,7 @@ DEF(br, 0, 0, 1, TCG_OPF_BB_END)
# define IMPL64 TCG_OPF_64BIT
#endif
-DEF(fence, 0, 0, 0, 0)
+DEF(fence, 0, 0, 0, TCG_OPF_SIDE_EFFECTS)
DEF(mov_i32, 1, 1, 0, TCG_OPF_NOT_PRESENT)
DEF(movi_i32, 1, 0, 1, TCG_OPF_NOT_PRESENT)
diff --git a/tcg/tcg.c b/tcg/tcg.c
index b5a22ba..461a33e 100644
--- a/tcg/tcg.c
+++ b/tcg/tcg.c
@@ -2444,6 +2444,7 @@ int tcg_gen_code(TCGContext *s, TranslationBlock *tb)
dead_args, sync_args);
break;
case INDEX_op_fence:
+ tcg_out_fence(s);
break;
default:
/* Sanity check that we've not introduced any unhandled opcodes. */
--
2.8.3
next prev parent reply other threads:[~2016-05-24 17:19 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20160524171856.1000-1-bobby.prani@gmail.com>
2016-05-24 17:18 ` [Qemu-devel] [RFC PATCH 1/3] Introduce TCGOpcode for fence instruction Pranith Kumar
2016-05-24 17:32 ` Peter Maydell
2016-05-24 18:05 ` Pranith Kumar
2016-05-24 17:18 ` Pranith Kumar [this message]
2016-05-25 17:35 ` [Qemu-devel] [RFC PATCH 2/3] tcg: Add support for fence generation in x86 backend Richard Henderson
2016-05-25 19:25 ` Alex Bennée
2016-05-25 19:43 ` Sergey Fedorov
2016-05-25 19:59 ` Pranith Kumar
2016-05-25 20:02 ` Sergey Fedorov
2016-05-25 19:50 ` Richard Henderson
2016-05-25 19:57 ` Pranith Kumar
2016-05-25 19:56 ` Pranith Kumar
2016-05-26 16:09 ` Alex Bennée
2016-05-24 17:18 ` [RFC PATCH 3/3] tcg: Add frontend support for fence gen in ARMv7 Pranith Kumar
2016-05-24 17:18 ` [Qemu-devel] " Pranith Kumar
2016-05-25 17:36 ` Richard Henderson
2016-05-25 17:36 ` [Qemu-devel] " Richard Henderson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20160524171856.1000-3-bobby.prani@gmail.com \
--to=bobby.prani@gmail.com \
--cc=alex.bennee@linaro.org \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=rth@twiddle.net \
--cc=serge.fdrv@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.