From: Richard Henderson <rth@twiddle.net>
To: qemu-devel@nongnu.org
Cc: aurelien@aurel32.net, aliguori@amazon.com
Subject: [Qemu-devel] [PULL 04/17] tcg-i386: Remove "cb" output restriction from qemu_st8 for i386
Date: Sat, 12 Oct 2013 16:31:10 -0700 [thread overview]
Message-ID: <1381620683-4568-5-git-send-email-rth@twiddle.net> (raw)
In-Reply-To: <1381620683-4568-1-git-send-email-rth@twiddle.net>
Once we form a combined qemu_st_i32 opcode, we won't be able to
have separate constraints based on size. This one is fairly easy
to work around, since eax is available as a scratch register.
When storing variable data, this tends to merely exchange one mov
for another. E.g.
-: mov %esi,%ecx
...
-: mov %cl,(%edx)
+: mov %esi,%eax
+: mov %al,(%edx)
Where we do have a regression is when storing constant data, in which
we may load the constant into edi, when only ecx/ebx ought to be used.
The proper way to recover this regression is to allow constants as
arguments to qemu_st_i32, so that we never load the constant data into
a register at all, must less the wrong register. TBD.
Signed-off-by: Richard Henderson <rth@twiddle.net>
---
tcg/i386/tcg-target.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/tcg/i386/tcg-target.c b/tcg/i386/tcg-target.c
index a7ff8a3..f4fdce5 100644
--- a/tcg/i386/tcg-target.c
+++ b/tcg/i386/tcg-target.c
@@ -1479,6 +1479,12 @@ static void tcg_out_qemu_st_direct(TCGContext *s, TCGReg datalo, TCGReg datahi,
switch (memop & MO_SIZE) {
case MO_8:
+ /* In 32-bit mode, 8-byte stores can only happen from [abcd]x.
+ Use the scratch register if necessary. */
+ if (TCG_TARGET_REG_BITS == 32 && datalo >= 4) {
+ tcg_out_mov(s, TCG_TYPE_I32, scratch, datalo);
+ datalo = scratch;
+ }
tcg_out_modrm_offset(s, OPC_MOVB_EvGv + P_REXB_R + seg,
datalo, base, ofs);
break;
@@ -2084,7 +2090,7 @@ static const TCGTargetOpDef x86_op_defs[] = {
{ INDEX_op_qemu_ld32, { "r", "L" } },
{ INDEX_op_qemu_ld64, { "r", "r", "L" } },
- { INDEX_op_qemu_st8, { "cb", "L" } },
+ { INDEX_op_qemu_st8, { "L", "L" } },
{ INDEX_op_qemu_st16, { "L", "L" } },
{ INDEX_op_qemu_st32, { "L", "L" } },
{ INDEX_op_qemu_st64, { "L", "L", "L" } },
@@ -2096,7 +2102,7 @@ static const TCGTargetOpDef x86_op_defs[] = {
{ INDEX_op_qemu_ld32, { "r", "L", "L" } },
{ INDEX_op_qemu_ld64, { "r", "r", "L", "L" } },
- { INDEX_op_qemu_st8, { "cb", "L", "L" } },
+ { INDEX_op_qemu_st8, { "L", "L", "L" } },
{ INDEX_op_qemu_st16, { "L", "L", "L" } },
{ INDEX_op_qemu_st32, { "L", "L", "L" } },
{ INDEX_op_qemu_st64, { "L", "L", "L", "L" } },
--
1.8.1.4
next prev parent reply other threads:[~2013-10-12 23:31 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-12 23:31 [Qemu-devel] [PULL 00/17] tcg ldst conversions Richard Henderson
2013-10-12 23:31 ` [Qemu-devel] [PULL 01/17] tcg: Use TCGMemOp for TCGLabelQemuLdst.opc Richard Henderson
2013-10-12 23:31 ` [Qemu-devel] [PULL 02/17] tcg-i386: Use TCGMemOp within qemu_ldst routines Richard Henderson
2013-10-12 23:31 ` [Qemu-devel] [PULL 03/17] tcg-i386: Tidy softmmu routines Richard Henderson
2013-10-12 23:31 ` Richard Henderson [this message]
2013-10-12 23:31 ` [Qemu-devel] [PULL 05/17] tcg-i386: Support new ldst opcodes Richard Henderson
2013-10-12 23:31 ` [Qemu-devel] [PULL 06/17] tcg-arm: Use TCGMemOp within qemu_ldst routines Richard Henderson
2013-10-12 23:31 ` [Qemu-devel] [PULL 07/17] tcg-arm: Convert to le/be ldst helpers Richard Henderson
2013-10-12 23:31 ` [Qemu-devel] [PULL 08/17] tcg-arm: Tidy variable naming convention in qemu_ld/st Richard Henderson
2013-10-12 23:31 ` [Qemu-devel] [PULL 09/17] tcg-arm: Convert to new ldst opcodes Richard Henderson
2013-10-12 23:31 ` [Qemu-devel] [PULL 10/17] tcg-arm: Improve GUEST_BASE qemu_ld/st Richard Henderson
2013-10-12 23:31 ` [Qemu-devel] [PULL 11/17] tcg-ppc: Use TCGMemOp within qemu_ldst routines Richard Henderson
2013-10-12 23:31 ` [Qemu-devel] [PULL 12/17] tcg-ppc64: " Richard Henderson
2013-10-12 23:31 ` [Qemu-devel] [PULL 13/17] tcg-ppc: Convert to le/be ldst helpers Richard Henderson
2013-10-12 23:31 ` [Qemu-devel] [PULL 14/17] tcg-ppc64: " Richard Henderson
2013-10-12 23:31 ` [Qemu-devel] [PULL 15/17] tcg-ppc: Support new ldst opcodes Richard Henderson
2013-10-12 23:31 ` [Qemu-devel] [PULL 16/17] tcg-ppc64: " Richard Henderson
2013-10-12 23:31 ` [Qemu-devel] [PULL 17/17] target-alpha: Convert to " 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=1381620683-4568-5-git-send-email-rth@twiddle.net \
--to=rth@twiddle.net \
--cc=aliguori@amazon.com \
--cc=aurelien@aurel32.net \
--cc=qemu-devel@nongnu.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).