Commit f79db4f6 by Andrew Pinski Committed by Andrew Pinski

re PR tree-optimization/33512 (Simple bitwise simplification missed)

2008-02-23  Andrew Pinski  <andrew_pinski@playstation.sony.com>

        PR rtl-opt/33512
        * simplify-rtx.c (simplify_binary_operation_1): Add simplification
        of (and X (ior (not X) Y) and (and (ior (not X) Y) X).

2008-02-23  Andrew Pinski  <andrew_pinski@playstation.sony.com>

        PR rtl-opt/33512
        * gcc.dg/and-1.c: New test.

From-SVN: r132575
parent bb1f73c2
2008-02-23 Andrew Pinski <andrew_pinski@playstation.sony.com>
PR rtl-opt/33512
* simplify-rtx.c (simplify_binary_operation_1): Add simplification
of (and X (ior (not X) Y) and (and (ior (not X) Y) X).
2008-02-23 Andrew Pinski <andrew_pinski@playstation.sony.com>
PR pch/35027
* c-pch.c (c_common_valid_pch): Make the "too short to be a PCH
file" warning condtional on -Winvalid-PCH.
......
......@@ -2428,6 +2428,19 @@ simplify_binary_operation_1 (enum rtx_code code, enum machine_mode mode,
return simplify_gen_binary (code, mode, tem, op1);
}
}
/* (and X (ior (not X) Y) -> (and X Y) */
if (GET_CODE (op1) == IOR
&& GET_CODE (XEXP (op1, 0)) == NOT
&& op0 == XEXP (XEXP (op1, 0), 0))
return simplify_gen_binary (AND, mode, op0, XEXP (op1, 1));
/* (and (ior (not X) Y) X) -> (and X Y) */
if (GET_CODE (op0) == IOR
&& GET_CODE (XEXP (op0, 0)) == NOT
&& op1 == XEXP (XEXP (op0, 0), 0))
return simplify_gen_binary (AND, mode, op1, XEXP (op0, 1));
tem = simplify_associative_operation (code, mode, op0, op1);
if (tem)
return tem;
......
2008-02-23 Andrew Pinski <andrew_pinski@playstation.sony.com>
PR rtl-opt/33512
* gcc.dg/and-1.c: New test.
2008-02-23 Daniel Jacobowitz <dan@codesourcery.com>
* gcc.c-torture/execute/20080222-1.c: New test.
/* { dg-do compile } */
/* { dg-options "-O2" } */
/* { dg-final { scan-assembler "and" { target powerpc*-*-* spu-*-* } } } */
/* There should be no nand for this testcase (for either PPC or SPU). */
/* { dg-final { scan-assembler-not "nand" { target powerpc*-*-* spu-*-* } } } */
int f(int y)
{
return y & ~(y & -y);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment