]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Fix bug in assembly of CMov32(reg,reg) in which the regs were handled
authorJulian Seward <jseward@acm.org>
Tue, 24 Aug 2004 23:34:39 +0000 (23:34 +0000)
committerJulian Seward <jseward@acm.org>
Tue, 24 Aug 2004 23:34:39 +0000 (23:34 +0000)
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

VEX/priv/host-x86/hdefs.c

index e20fd058de4d3859793b2e8638d9f091fdc1203f..b112b9e299ccdbf860bb6ce4a3b7b94cc861183d 100644 (file)
@@ -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);