]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
iselIntExpr64(const): save a precious register in the case where
authorJulian Seward <jseward@acm.org>
Wed, 6 Apr 2005 01:11:53 +0000 (01:11 +0000)
committerJulian Seward <jseward@acm.org>
Wed, 6 Apr 2005 01:11:53 +0000 (01:11 +0000)
the two halves have the same value.

git-svn-id: svn://svn.valgrind.org/vex/trunk@1122

VEX/priv/host-x86/isel.c

index 105f639c18244e77e3e194729180a302cfc4f500..37bf943ed98c8b76220ce6e622b2b5813c5d8d95 100644 (file)
@@ -1691,10 +1691,17 @@ static void iselInt64Expr_wrk ( HReg* rHi, HReg* rLo, ISelEnv* env, IRExpr* e )
       HReg  tLo = newVRegI(env);
       HReg  tHi = newVRegI(env);
       vassert(e->Iex.Const.con->tag == Ico_U64);
-      addInstr(env, X86Instr_Alu32R(Xalu_MOV, X86RMI_Imm(wHi), tHi));
-      addInstr(env, X86Instr_Alu32R(Xalu_MOV, X86RMI_Imm(wLo), tLo));
-      *rHi = tHi;
-      *rLo = tLo;
+      if (wLo == wHi) {
+         /* Save a precious Int register in this special case. */
+         addInstr(env, X86Instr_Alu32R(Xalu_MOV, X86RMI_Imm(wLo), tLo));
+         *rHi = tLo;
+         *rLo = tLo;
+      } else {
+         addInstr(env, X86Instr_Alu32R(Xalu_MOV, X86RMI_Imm(wHi), tHi));
+         addInstr(env, X86Instr_Alu32R(Xalu_MOV, X86RMI_Imm(wLo), tLo));
+         *rHi = tHi;
+         *rLo = tLo;
+      }
       return;
    }