From 95765f369f6f6ee15399d352593cb6912a024d28 Mon Sep 17 00:00:00 2001 From: "Naveen H.S" Date: Thu, 13 Aug 2015 04:37:22 +0000 Subject: [PATCH] re PR middle-end/25529 ((unsigned * 2)/2 is not changed into unsigned &0x7FFFFFFF) 2015-08-13 Naveen H.S PR middle-end/25529 * match.pd (div (mult @0 @1) @1) : New simplifier. From-SVN: r226847 --- gcc/ChangeLog | 5 +++++ gcc/match.pd | 8 ++++++++ 2 files changed, 13 insertions(+) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 65a4f2a0012..67f9a11aba7 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2015-08-13 Naveen H.S + + PR middle-end/25529 + * match.pd (div (mult @0 @1) @1) : New simplifier. + 2015-08-12 Michael Meissner PR target/67071 diff --git a/gcc/match.pd b/gcc/match.pd index 4230f9a7d18..42b9951c122 100644 --- a/gcc/match.pd +++ b/gcc/match.pd @@ -296,6 +296,14 @@ 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 (ANY_INTEGRAL_TYPE_P (type) + && TYPE_OVERFLOW_UNDEFINED (type)) + @0))) + /* X % Y is smaller than Y. */ (for cmp (lt ge) (simplify -- 2.30.2