From: Julian Seward Date: Thu, 11 Nov 2004 02:17:53 +0000 (+0000) Subject: Let the insn selector know that X-Git-Tag: svn/VALGRIND_3_0_1^2~788 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=d318858c0808abf494184a48eeec70ffdaf90cb3;p=thirdparty%2Fvalgrind.git Let the insn selector know that CmpNE32(1Sto32(bit),0) == bit and ditto in 64-bits, and do not generate any code for it. This helps some massive expressions made by memcheck on x86 FP code. git-svn-id: svn://svn.valgrind.org/vex/trunk@546 --- diff --git a/VEX/priv/host-x86/isel.c b/VEX/priv/host-x86/isel.c index 0ad7e64eb9..3992e7232b 100644 --- a/VEX/priv/host-x86/isel.c +++ b/VEX/priv/host-x86/isel.c @@ -112,22 +112,20 @@ static IRExpr* unop ( IROp op, IRExpr* a ) return IRExpr_Unop(op, a); } -#if 0 -/* Apparently unused. */ static IRExpr* binop ( IROp op, IRExpr* a1, IRExpr* a2 ) { return IRExpr_Binop(op, a1, a2); } -#endif -#if 0 -/* Apparently unused. */ -static IRExpr* mkU8 ( UInt i ) +static IRExpr* mkU64 ( ULong i ) { - vassert(i < 256); - return IRExpr_Const(IRConst_U8(i)); + return IRExpr_Const(IRConst_U64(i)); +} + +static IRExpr* mkU32 ( UInt i ) +{ + return IRExpr_Const(IRConst_U32(i)); } -#endif static IRExpr* bind ( Int binder ) { @@ -1342,6 +1340,17 @@ static X86CondCode iselCondCode_wrk ( ISelEnv* env, IRExpr* e ) } } + /* CmpNE32(1Sto32(b), 0) ==> b */ + { + DECLARE_PATTERN(p_CmpNE32_1Sto32); + DEFINE_PATTERN( + p_CmpNE32_1Sto32, + binop(Iop_CmpNE32, unop(Iop_1Sto32,bind(0)), mkU32(0))); + if (matchIRExpr(&mi, p_CmpNE32_1Sto32, e)) { + return iselCondCode(env, mi.bindee[0]); + } + } + /* Cmp*32*(x,y) */ if (e->tag == Iex_Binop && (e->Iex.Binop.op == Iop_CmpEQ32 @@ -1364,6 +1373,17 @@ static X86CondCode iselCondCode_wrk ( ISelEnv* env, IRExpr* e ) } } + /* CmpNE64(1Sto64(b), 0) ==> b */ + { + DECLARE_PATTERN(p_CmpNE64_1Sto64); + DEFINE_PATTERN( + p_CmpNE64_1Sto64, + binop(Iop_CmpNE64, unop(Iop_1Sto64,bind(0)), mkU64(0))); + if (matchIRExpr(&mi, p_CmpNE64_1Sto64, e)) { + return iselCondCode(env, mi.bindee[0]); + } + } + /* CmpNE64 */ if (e->tag == Iex_Binop && e->Iex.Binop.op == Iop_CmpNE64) { @@ -1581,7 +1601,6 @@ static void iselIntExpr64_wrk ( HReg* rHi, HReg* rLo, ISelEnv* env, IRExpr* e ) return; } - /* 1Sto64(e) */ /* could do better than this, but for now ... */ if (e->tag == Iex_Unop && e->Iex.Unop.op == Iop_1Sto64) {