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 8f6e269a-dfd6-0310-a8e1-e2731360e62c
diff --git a/priv/ir_opt.c b/priv/ir_opt.c
index ebf9149..f368ce5 100644
--- a/priv/ir_opt.c
+++ b/priv/ir_opt.c
@@ -1178,14 +1178,6 @@
&& 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 @@
}
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 @@
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;