qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Richard Henderson <rth@twiddle.net>
To: qemu-devel@nongnu.org
Cc: aurelien@aurel32.net, aliguori@amazon.com
Subject: [Qemu-devel] [PULL 2/5] tcg/i386: remove hardcoded P_REXW value
Date: Sat, 25 Jan 2014 15:32:49 -0800	[thread overview]
Message-ID: <1390692772-15282-3-git-send-email-rth@twiddle.net> (raw)
In-Reply-To: <1390692772-15282-1-git-send-email-rth@twiddle.net>

From: Aurelien Jarno <aurelien@aurel32.net>

P_REXW is defined has a constant at the beginning of i386/tcg-target.c,
but the corresponding bit is later used in a harcoded way, which defeat
the purpose of a constant.

Fix that by using a conditional expression operator instead of a shift.
On x86 this actually makes the code slightly smaller as GCC does in
practice (opc >> 8) & 8 instead of (opc & 0x800) >> 8 so the constants
are smaller to load.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Richard Henderson <rth@twiddle.net>
---
 tcg/i386/tcg-target.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tcg/i386/tcg-target.c b/tcg/i386/tcg-target.c
index 495b901..753b3a1 100644
--- a/tcg/i386/tcg-target.c
+++ b/tcg/i386/tcg-target.c
@@ -381,7 +381,7 @@ static void tcg_out_opc(TCGContext *s, int opc, int r, int rm, int x)
     }
 
     rex = 0;
-    rex |= (opc & P_REXW) >> 8;		/* REX.W */
+    rex |= (opc & P_REXW) ? 0x8 : 0x0;  /* REX.W */
     rex |= (r & 8) >> 1;		/* REX.R */
     rex |= (x & 8) >> 2;		/* REX.X */
     rex |= (rm & 8) >> 3;		/* REX.B */
-- 
1.8.5.3

  parent reply	other threads:[~2014-01-25 23:33 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-25 23:32 [Qemu-devel] [PULL 0/5] tcg/i386 movbe support Richard Henderson
2014-01-25 23:32 ` [Qemu-devel] [PULL 1/5] disas/i386.c: disassemble movbe instruction Richard Henderson
2014-01-25 23:32 ` Richard Henderson [this message]
2014-01-25 23:32 ` [Qemu-devel] [PULL 3/5] tcg/i386: add support for three-byte opcodes Richard Henderson
2014-01-25 23:32 ` [Qemu-devel] [PULL 4/5] tcg/i386: use movbe instruction in qemu_ldst routines Richard Henderson
2014-01-25 23:32 ` [Qemu-devel] [PULL 5/5] tcg/i386: cleanup useless #ifdef Richard Henderson
2014-01-30 19:11 ` [Qemu-devel] [PULL 0/5] tcg/i386 movbe support Peter Maydell

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=1390692772-15282-3-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).