From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LBZg3-00014U-8w for qemu-devel@nongnu.org; Sat, 13 Dec 2008 13:57:23 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LBZg2-000145-Mm for qemu-devel@nongnu.org; Sat, 13 Dec 2008 13:57:22 -0500 Received: from [199.232.76.173] (port=39742 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LBZg2-000140-Jp for qemu-devel@nongnu.org; Sat, 13 Dec 2008 13:57:22 -0500 Received: from savannah.gnu.org ([199.232.41.3]:47118 helo=sv.gnu.org) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1LBZg2-0003Z8-8R for qemu-devel@nongnu.org; Sat, 13 Dec 2008 13:57:22 -0500 Received: from cvs.savannah.gnu.org ([199.232.41.69]) by sv.gnu.org with esmtp (Exim 4.63) (envelope-from ) id 1LBZg1-0005jm-Qx for qemu-devel@nongnu.org; Sat, 13 Dec 2008 18:57:21 +0000 Received: from aurel32 by cvs.savannah.gnu.org with local (Exim 4.63) (envelope-from ) id 1LBZg1-0005ji-Ia for qemu-devel@nongnu.org; Sat, 13 Dec 2008 18:57:21 +0000 MIME-Version: 1.0 Errors-To: aurel32 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Aurelien Jarno Message-Id: Date: Sat, 13 Dec 2008 18:57:21 +0000 Subject: [Qemu-devel] [6011] TCG x86/x86-64: use move with zero-extend for loads/stores Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org 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 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 */