From: Julian Seward Date: Tue, 24 Aug 2004 23:34:39 +0000 (+0000) Subject: Fix bug in assembly of CMov32(reg,reg) in which the regs were handled X-Git-Tag: svn/VALGRIND_3_0_1^2~1128 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=05a291ab8cf35cf0120630f801ef0a4e4474d880;p=thirdparty%2Fvalgrind.git Fix bug in assembly of CMov32(reg,reg) in which the regs were handled the wrong way round. This was causing test/test-i386.c to fail on shifts of zero. Now that test works completely. git-svn-id: svn://svn.valgrind.org/vex/trunk@206 --- diff --git a/VEX/priv/host-x86/hdefs.c b/VEX/priv/host-x86/hdefs.c index e20fd058de..b112b9e299 100644 --- a/VEX/priv/host-x86/hdefs.c +++ b/VEX/priv/host-x86/hdefs.c @@ -1552,12 +1552,16 @@ Int emit_X86Instr ( UChar* buf, Int nbuf, X86Instr* i ) switch (i->Xin.CMov32.src->tag) { case Xrm_Reg: + /* Big sigh. This is movl E -> G ... */ *p++ = 0x89; - p = doAMode_R(p, i->Xin.CMov32.dst, - i->Xin.CMov32.src->Xrm.Reg.reg); + p = doAMode_R(p, i->Xin.CMov32.src->Xrm.Reg.reg, + i->Xin.CMov32.dst); break; case Xrm_Mem: + /* ... whereas this is movl G -> E. That's why the args + to doAMode_R appear to be the wrong way round in the + Xrm_Reg case. */ *p++ = 0x8B; p = doAMode_M(p, i->Xin.CMov32.dst, i->Xin.CMov32.src->Xrm.Mem.am);