===================================================================
@@ -135,10 +135,23 @@ along with GCC; see the file COPYING3.
&& TYPE_PRECISION (TREE_TYPE (@1)) == 1)
(le @0 @1)))
+/* From tree-ssa-forwprop.c:simplify_not_neg_expr. */
+
+/* ~~x -> x */
+(simplify
+ (bit_not (bit_not @0))
+ @0)
+/* The corresponding (negate (negate @0)) -> @0 is in match-plusminus.pd. */
+
/* End of known transform origin. Note that some bitwise transforms
are handled in match-constant-folding.pd. */
+/* x & ~0 -> x */
+(simplify
+ (bit_and @0 integer_all_onesp)
+ @0)
+
/* ~x & ~y -> ~(x | y) */
(simplify
(bit_and (bit_not @0) (bit_not @1))
@@ -149,11 +162,6 @@ along with GCC; see the file COPYING3.
(bit_ior (bit_not @0) (bit_not @1))
(bit_not (bit_and @0 @1)))
-/* ~~x -> x */
-(simplify
- (bit_not (bit_not @0))
- @0)
-
/* Simple association cases that cancel one operand. */
/* ((a OP b) & ~a) -> (b & ~a) OP 0 */
===================================================================
@@ -30,6 +30,10 @@ along with GCC; see the file COPYING3.
(simplify
(minus @0 (negate @1))
(plus @0 @1))
+ /* From tree-ssa-forwprop.c:simplify_not_neg_expr. */
+ (simplify
+ (negate (negate @1))
+ @1)
/* We can't reassociate floating-point or fixed-point plus or minus
because of saturation to +-Inf. */
@@ -155,3 +159,13 @@ along with GCC; see the file COPYING3.
(pointer_plus @0 (negate (bit_and (convert @0) INTEGER_CST@1)))
(with { tree algn = wide_int_to_tree (TREE_TYPE (@0), wi::bit_not (@1)); }
(bit_and @0 { algn; })))
+
+
+/* From tree-ssa-forwprop.c:simplify_mult. */
+
+/* (X /[ex] A) * A -> X. */
+(simplify
+ (mult (convert? (exact_div @0 @1)) @1)
+ /* Look through a sign-changing conversion. */
+ (if (TYPE_PRECISION (TREE_TYPE (@0)) == TYPE_PRECISION (type))
+ (convert @0)))
===================================================================
@@ -60,11 +60,6 @@ along with GCC; see the file COPYING3.
(bit_ior @0 integer_all_onesp@1)
@1)
-/* x ^ ~0 -> ~x */
-(simplify
- (bit_and @0 integer_all_onesp)
- @0)
-
/* x & 0 -> 0 */
(simplify
(bit_and @0 integer_zerop@1)