qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Aurelien Jarno <aurelien@aurel32.net>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [6011] TCG x86/x86-64: use move with zero-extend for loads/stores
Date: Sat, 13 Dec 2008 18:57:21 +0000	[thread overview]
Message-ID: <E1LBZg1-0005ji-Ia@cvs.savannah.gnu.org> (raw)

Revision: 6011
          http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=6011
Author:   aurel32
Date:     2008-12-13 18:57:21 +0000 (Sat, 13 Dec 2008)

Log Message:
-----------
TCG x86/x86-64: use move with zero-extend for loads/stores

Starting with version 4.3, gcc returns the result of a function in
rax/eax/ax/al instead of rax/eax, depending of the return type. As
a consequence we should use a zero extend moe in TCG loads/stores.

See http://gcc.gnu.org/ml/gcc/2008-01/msg00052.html for more details.

A big thanks to malc who founds the problem and wrote the x86 patch.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>

Modified Paths:
--------------
    trunk/tcg/i386/tcg-target.c
    trunk/tcg/x86_64/tcg-target.c

Modified: trunk/tcg/i386/tcg-target.c
===================================================================
--- trunk/tcg/i386/tcg-target.c	2008-12-13 18:57:12 UTC (rev 6010)
+++ trunk/tcg/i386/tcg-target.c	2008-12-13 18:57:21 UTC (rev 6011)
@@ -525,7 +525,13 @@
         tcg_out_modrm(s, 0xbf | P_EXT, data_reg, TCG_REG_EAX);
         break;
     case 0:
+        /* movzbl */
+        tcg_out_modrm(s, 0xb6 | P_EXT, data_reg, TCG_REG_EAX);
+        break;
     case 1:
+        /* movzwl */
+        tcg_out_modrm(s, 0xb7 | P_EXT, data_reg, TCG_REG_EAX);
+        break;
     case 2:
     default:
         tcg_out_mov(s, data_reg, TCG_REG_EAX);

Modified: trunk/tcg/x86_64/tcg-target.c
===================================================================
--- trunk/tcg/x86_64/tcg-target.c	2008-12-13 18:57:12 UTC (rev 6010)
+++ trunk/tcg/x86_64/tcg-target.c	2008-12-13 18:57:21 UTC (rev 6011)
@@ -575,7 +575,13 @@
         tcg_out_modrm(s, 0x63 | P_REXW, data_reg, TCG_REG_RAX);
         break;
     case 0:
+        /* movzbq */
+        tcg_out_modrm(s, 0xb6 | P_EXT | P_REXW, data_reg, TCG_REG_RAX);
+        break;
     case 1:
+        /* movzwq */
+        tcg_out_modrm(s, 0xb7 | P_EXT | P_REXW, data_reg, TCG_REG_RAX);
+        break;
     case 2:
     default:
         /* movl */

                 reply	other threads:[~2008-12-13 18:57 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=E1LBZg1-0005ji-Ia@cvs.savannah.gnu.org \
    --to=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).