summaryrefslogtreecommitdiff
path: root/gcc/match.pd
diff options
context:
space:
mode:
authorglisse <glisse@138bc75d-0d04-0410-961f-82ee72b054a4>2015-05-22 20:37:04 +0000
committerglisse <glisse@138bc75d-0d04-0410-961f-82ee72b054a4>2015-05-22 20:37:04 +0000
commit5af95dbe5f13d5d33ed6b5f55dce97c281f2ce12 (patch)
tree497c816f02e5ac350d7ae5f72a165edcf4c08eec /gcc/match.pd
parent3cc6ed0243c566e90cea1db5bc8338298b26b2a6 (diff)
downloadgcc-5af95dbe5f13d5d33ed6b5f55dce97c281f2ce12.tar.gz
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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@223587 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/match.pd')
-rw-r--r--gcc/match.pd16
1 files changed, 12 insertions, 4 deletions
diff --git a/gcc/match.pd b/gcc/match.pd
index 73ccfbd4b00..33419ebdcb6 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))