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> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6011 c046a42c-6fe2-441c-8c8c-71466251a162
This commit is contained in:
parent
13412c9d2f
commit
9db3ba4db2
|
@ -525,7 +525,13 @@ static void tcg_out_qemu_ld(TCGContext *s, const TCGArg *args,
|
||||||
tcg_out_modrm(s, 0xbf | P_EXT, data_reg, TCG_REG_EAX);
|
tcg_out_modrm(s, 0xbf | P_EXT, data_reg, TCG_REG_EAX);
|
||||||
break;
|
break;
|
||||||
case 0:
|
case 0:
|
||||||
|
/* movzbl */
|
||||||
|
tcg_out_modrm(s, 0xb6 | P_EXT, data_reg, TCG_REG_EAX);
|
||||||
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
|
/* movzwl */
|
||||||
|
tcg_out_modrm(s, 0xb7 | P_EXT, data_reg, TCG_REG_EAX);
|
||||||
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
default:
|
default:
|
||||||
tcg_out_mov(s, data_reg, TCG_REG_EAX);
|
tcg_out_mov(s, data_reg, TCG_REG_EAX);
|
||||||
|
|
|
@ -575,7 +575,13 @@ static void tcg_out_qemu_ld(TCGContext *s, const TCGArg *args,
|
||||||
tcg_out_modrm(s, 0x63 | P_REXW, data_reg, TCG_REG_RAX);
|
tcg_out_modrm(s, 0x63 | P_REXW, data_reg, TCG_REG_RAX);
|
||||||
break;
|
break;
|
||||||
case 0:
|
case 0:
|
||||||
|
/* movzbq */
|
||||||
|
tcg_out_modrm(s, 0xb6 | P_EXT | P_REXW, data_reg, TCG_REG_RAX);
|
||||||
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
|
/* movzwq */
|
||||||
|
tcg_out_modrm(s, 0xb7 | P_EXT | P_REXW, data_reg, TCG_REG_RAX);
|
||||||
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
default:
|
default:
|
||||||
/* movl */
|
/* movl */
|
||||||
|
|
Loading…
Reference in a new issue