match.pd ((x | y) & ~x -> y & ~x, (x & y) | ~x -> y | ~x): New simplifications.

2015-05-22  Marc Glisse  <marc.glisse@inria.fr>

gcc/
	* match.pd ((x | y) & ~x -> y & ~x, (x & y) | ~x -> y | ~x): New
	simplifications.
gcc/testsuite/
	* gcc.dg/nand.c: New testcase.

From-SVN: r223587
This commit is contained in:
Marc Glisse 2015-05-22 22:37:04 +02:00 committed by Marc Glisse
parent ddc75e8baf
commit af563d4bb7
4 changed files with 33 additions and 4 deletions

View File

@ -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> 2015-05-22 Jeff Law <law@redhat.com>
* config/pa/pa.md (integer_indexed_store splitters): Use * config/pa/pa.md (integer_indexed_store splitters): Use

View File

@ -280,10 +280,18 @@ along with GCC; see the file COPYING3. If not see
/* x & ~(x & y) -> x & ~y */ /* x & ~(x & y) -> x & ~y */
/* x | ~(x | y) -> x | ~y */ /* x | ~(x | y) -> x | ~y */
(for bitop (bit_and bit_ior) (for bitop (bit_and bit_ior)
(simplify (simplify
(bitop:c @0 (bit_not (bitop:c@2 @0 @1))) (bitop:c @0 (bit_not (bitop:c@2 @0 @1)))
(if (TREE_CODE (@2) != SSA_NAME || has_single_use (@2)) (if (TREE_CODE (@2) != SSA_NAME || has_single_use (@2))
(bitop @0 (bit_not @1))))) (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 (simplify
(abs (negate @0)) (abs (negate @0))

View File

@ -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> 2015-05-22 Sandra Loosemore <sandra@codesourcery.com>
* gcc.target/aarch64/advsimd-intrinsics/advsimd-intrinsics.exp: * gcc.target/aarch64/advsimd-intrinsics/advsimd-intrinsics.exp:

View File

@ -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" } } */