diff --git a/gcc/match.pd b/gcc/match.pd index 4230f9a..18045b8 100644 --- a/gcc/match.pd +++ b/gcc/match.pd @@ -296,6 +296,13 @@ along with GCC; see the file COPYING3. If not see (if (TYPE_UNSIGNED (TREE_TYPE (@0))) (bit_and @0 (negate @1)))) +/* Simplify (t * 2) / 2) -> t. */ +(for div (trunc_div ceil_div floor_div round_div exact_div) + (simplify + (div (mult @0 @1) @1) + (if (TYPE_OVERFLOW_UNDEFINED (TREE_TYPE (@0))) + @0))) + /* X % Y is smaller than Y. */ (for cmp (lt ge) (simplify