From: Julian Seward Date: Tue, 27 Nov 2007 00:11:13 +0000 (+0000) Subject: Handle the case Add64(expr,const) a bit better. Apparently Massif The X-Git-Tag: svn/VALGRIND_3_3_1^2~14 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bee23d2dfdceff6505c10898cb162f3214e4c228;p=thirdparty%2Fvalgrind.git Handle the case Add64(expr,const) a bit better. Apparently Massif The Second does that kind of thing a lot. git-svn-id: svn://svn.valgrind.org/vex/trunk@1803 --- diff --git a/VEX/priv/host-x86/isel.c b/VEX/priv/host-x86/isel.c index 5b6319f043..c00ec049b0 100644 --- a/VEX/priv/host-x86/isel.c +++ b/VEX/priv/host-x86/isel.c @@ -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);