summaryrefslogtreecommitdiff
path: root/gcc/match.pd
diff options
context:
space:
mode:
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. */