|
From: <sv...@va...> - 2007-11-27 00:11:12
|
Author: sewardj
Date: 2007-11-27 00:11:13 +0000 (Tue, 27 Nov 2007)
New Revision: 1803
Log:
Handle the case Add64(expr,const) a bit better. Apparently Massif The
Second does that kind of thing a lot.
Modified:
trunk/priv/host-x86/isel.c
Modified: trunk/priv/host-x86/isel.c
===================================================================
--- trunk/priv/host-x86/isel.c 2007-11-26 23:18:52 UTC (rev 1802)
+++ trunk/priv/host-x86/isel.c 2007-11-27 00:11:13 UTC (rev 1803)
@@ -2107,6 +2107,25 @@
/* 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);
|