]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Handle the case Add64(expr,const) a bit better. Apparently Massif The
authorJulian Seward <jseward@acm.org>
Tue, 27 Nov 2007 00:11:13 +0000 (00:11 +0000)
committerJulian Seward <jseward@acm.org>
Tue, 27 Nov 2007 00:11:13 +0000 (00:11 +0000)
Second does that kind of thing a lot.

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

VEX/priv/host-x86/isel.c

index 5b6319f043a6f896c2c8aecd158ffac0917a144e..c00ec049b056d3fe74d7e346159e5017b0444261 100644 (file)
@@ -2107,6 +2107,25 @@ static void iselInt64Expr_wrk ( HReg* rHi, HReg* rLo, ISelEnv* env, IRExpr* e )
 
          /* Add64/Sub64 */
          case Iop_Add64:
+            if (e->Iex.Binop.arg2->tag == Iex_Const) {
+               /* special case Add64(e, const) */
+               ULong w64 = e->Iex.Binop.arg2->Iex.Const.con->Ico.U64;
+               UInt  wHi = toUInt(w64 >> 32);
+               UInt  wLo = toUInt(w64);
+               HReg  tLo = newVRegI(env);
+               HReg  tHi = newVRegI(env);
+               HReg  xLo, xHi;
+               vassert(e->Iex.Binop.arg2->Iex.Const.con->tag == Ico_U64);
+               iselInt64Expr(&xHi, &xLo, env, e->Iex.Binop.arg1);
+               addInstr(env, mk_iMOVsd_RR(xHi, tHi));
+               addInstr(env, mk_iMOVsd_RR(xLo, tLo));
+               addInstr(env, X86Instr_Alu32R(Xalu_ADD, X86RMI_Imm(wLo), tLo));
+               addInstr(env, X86Instr_Alu32R(Xalu_ADC, X86RMI_Imm(wHi), tHi));
+               *rHi = tHi;
+               *rLo = tLo;
+               return;
+            }
+            /* else fall through to the generic case */
          case Iop_Sub64: {
             HReg xLo, xHi, yLo, yHi;
             HReg tLo = newVRegI(env);