diff options
-rw-r--r-- | gcc/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/match.pd | 16 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/nand.c | 12 |
4 files changed, 33 insertions, 4 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 769c7b5..ceb9444 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2015-05-22 Marc Glisse <marc.glisse@inria.fr> + + * match.pd ((x | y) & ~x -> y & ~x, (x & y) | ~x -> y | ~x): New + simplifications. + 2015-05-22 Jeff Law <law@redhat.com> * config/pa/pa.md (integer_indexed_store splitters): Use diff --git a/gcc/match.pd b/gcc/match.pd index 73ccfbd..33419ebd 100644 --- a/gcc/match.pd +++ b/gcc/match.pd @@ -280,10 +280,18 @@ along with GCC; see the file COPYING3. If not see /* x & ~(x & y) -> x & ~y */ /* x | ~(x | y) -> x | ~y */ (for bitop (bit_and bit_ior) - (simplify - (bitop:c @0 (bit_not (bitop:c@2 @0 @1))) - (if (TREE_CODE (@2) != SSA_NAME || has_single_use (@2)) - (bitop @0 (bit_not @1))))) + (simplify + (bitop:c @0 (bit_not (bitop:c@2 @0 @1))) + (if (TREE_CODE (@2) != SSA_NAME || has_single_use (@2)) + (bitop @0 (bit_not @1))))) + +/* (x | y) & ~x -> y & ~x */ +/* (x & y) | ~x -> y | ~x */ +(for bitop (bit_and bit_ior) + rbitop (bit_ior bit_and) + (simplify + (bitop:c (rbitop:c @0 @1) (bit_not@2 @0)) + (bitop @1 @2))) (simplify (abs (negate @0)) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 0b0de20..8d480a3 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2015-05-22 Marc Glisse <marc.glisse@inria.fr> + + * gcc.dg/nand.c: New testcase. + 2015-05-22 Sandra Loosemore <sandra@codesourcery.com> * gcc.target/aarch64/advsimd-intrinsics/advsimd-intrinsics.exp: diff --git a/gcc/testsuite/gcc.dg/nand.c b/gcc/testsuite/gcc.dg/nand.c new file mode 100644 index 0000000..28df581 --- /dev/null +++ b/gcc/testsuite/gcc.dg/nand.c @@ -0,0 +1,12 @@ +/* { dg-do compile } */ +/* { dg-options "-O -fdump-tree-original" } */ + +unsigned f(unsigned x, unsigned y){ + return (x | y) & ~x; +} +unsigned g(unsigned x, unsigned y){ + return ~x & (y | x); +} + +/* { dg-final { scan-tree-dump-times "return ~x & y;" 2 "original" } } */ +/* { dg-final { cleanup-tree-dump "original" } } */ |