summaryrefslogtreecommitdiff
path: root/gcc/match.pd
diff options
context:
space:
mode:
authorrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2014-10-30 13:13:35 +0000
committerrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2014-10-30 13:13:35 +0000
commit58810b9285500100e394e26b337e48b1f58d435c (patch)
tree503ff6868c680195720861d2ad6beb4789e69889 /gcc/match.pd
parent1eae76ccc61ff31d0165234180ffc5633746cc0f (diff)
downloadgcc-58810b9285500100e394e26b337e48b1f58d435c.tar.gz
2014-10-30 Richard Biener <rguenther@suse.de>
* match.pd: Implement more patterns that simplify to a single value. * fold-const.c (fold_binary_loc): Remove them here. * tree-ssa-forwprop.c (simplify_bitwise_binary): Likewise. (fwprop_ssa_val): Remove restriction on single uses. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@216933 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/match.pd')
-rw-r--r--gcc/match.pd18
1 files changed, 17 insertions, 1 deletions
diff --git a/gcc/match.pd b/gcc/match.pd
index e9571d158a5..2057dccba46 100644
--- a/gcc/match.pd
+++ b/gcc/match.pd
@@ -31,7 +31,7 @@ along with GCC; see the file COPYING3. If not see
/* Simplifications of operations with one constant operand and
- simplifications to constants. */
+ simplifications to constants or single values. */
(for op (plus pointer_plus minus bit_ior bit_xor)
(simplify
@@ -88,6 +88,22 @@ along with GCC; see the file COPYING3. If not see
(bit_xor @0 @0)
{ build_zero_cst (type); })
+/* Canonicalize X ^ ~0 to ~X. */
+(simplify
+ (bit_xor @0 integer_all_onesp@1)
+ (bit_not @0))
+
+/* x & ~0 -> x */
+(simplify
+ (bit_and @0 integer_all_onesp)
+ (non_lvalue @0))
+
+/* x & x -> x, x | x -> x */
+(for bitop (bit_and bit_ior)
+ (simplify
+ (bitop @0 @0)
+ (non_lvalue @0)))
+
/* Simplifications of conversions. */