From: Florian Krohm Date: Sun, 1 Sep 2013 14:22:05 +0000 (+0000) Subject: Add algebraic simplifications for Iop_And64 (same as for Iop_And32). X-Git-Tag: svn/VALGRIND_3_9_0^2~49 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=576b924834921ae84c2ce55d0d91c240b226e0da;p=thirdparty%2Fvalgrind.git Add algebraic simplifications for Iop_And64 (same as for Iop_And32). Remove isOnesU32 which is no longer needed. git-svn-id: svn://svn.valgrind.org/vex/trunk@2746 --- diff --git a/VEX/priv/ir_opt.c b/VEX/priv/ir_opt.c index ebf9149a29..f368ce5e38 100644 --- a/VEX/priv/ir_opt.c +++ b/VEX/priv/ir_opt.c @@ -1178,14 +1178,6 @@ static Bool isZeroU32 ( IRExpr* e ) && e->Iex.Const.con->Ico.U32 == 0); } -/* Is this literally IRExpr_Const(IRConst_U32(1---1)) ? */ -static Bool isOnesU32 ( IRExpr* e ) -{ - return toBool( e->tag == Iex_Const - && e->Iex.Const.con->tag == Ico_U32 - && e->Iex.Const.con->Ico.U32 == 0xFFFFFFFF ); -} - /* Is this an integer constant with value 0 ? */ static Bool isZeroU ( IRExpr* e ) { @@ -2123,23 +2115,24 @@ static IRExpr* fold_Expr ( IRExpr** env, IRExpr* e ) } break; + case Iop_And64: case Iop_And32: - /* And32(x,0xFFFFFFFF) ==> x */ - if (isOnesU32(e->Iex.Binop.arg2)) { + /* And32/And64(x,1---1b) ==> x */ + if (isOnesU(e->Iex.Binop.arg2)) { e2 = e->Iex.Binop.arg1; break; } - /* And32(x,0) ==> 0 */ - if (isZeroU32(e->Iex.Binop.arg2)) { + /* And32/And64(x,0) ==> 0 */ + if (isZeroU(e->Iex.Binop.arg2)) { e2 = e->Iex.Binop.arg2; break; } - /* And32(0,x) ==> 0 */ - if (isZeroU32(e->Iex.Binop.arg1)) { + /* And32/And64(0,x) ==> 0 */ + if (isZeroU(e->Iex.Binop.arg1)) { e2 = e->Iex.Binop.arg1; break; } - /* And32(t,t) ==> t, for some IRTemp t */ + /* And32/And64(t,t) ==> t, for some IRTemp t */ if (sameIRExprs(env, e->Iex.Binop.arg1, e->Iex.Binop.arg2)) { e2 = e->Iex.Binop.arg1; break; @@ -2148,10 +2141,9 @@ static IRExpr* fold_Expr ( IRExpr** env, IRExpr* e ) case Iop_And8: case Iop_And16: - case Iop_And64: case Iop_AndV128: case Iop_AndV256: - /* And8/And16/And64/AndV128/AndV256(t,t) + /* And8/And16/AndV128/AndV256(t,t) ==> t, for some IRTemp t */ if (sameIRExprs(env, e->Iex.Binop.arg1, e->Iex.Binop.arg2)) { e2 = e->Iex.Binop.arg1;