Commit 5f8d832e by Naveen H.S Committed by Naveen H.S

re PR middle-end/25530 ((unsigned / 2)*2 is not changed into unsigned &~1)

PR middle-end/25530
2015-07-24  Naveen H.S  <Naveen.Hurugalawadi@caviumnetworks.com>

gcc/testsuite/ChangeLog:
	* gcc.dg/pr25530.c: New test.

gcc/ChangeLog:
	* match.pd (mult (trunc_div @0 integer_pow2p@1) @1) : New simplifier.

From-SVN: r226137
parent 887ab609
2015-07-24 Naveen H.S <Naveen.Hurugalawadi@caviumnetworks.com> 2015-07-24 Naveen H.S <Naveen.Hurugalawadi@caviumnetworks.com>
PR middle-end/25530
* match.pd (mult (trunc_div @0 integer_pow2p@1) @1) : New simplifier.
2015-07-24 Naveen H.S <Naveen.Hurugalawadi@caviumnetworks.com>
PR middle-end/25529 PR middle-end/25529
* match.pd (trunc_div (mult @0 integer_pow2p@1) @1) : New simplifier. * match.pd (trunc_div (mult @0 integer_pow2p@1) @1) : New simplifier.
......
...@@ -289,6 +289,12 @@ along with GCC; see the file COPYING3. If not see ...@@ -289,6 +289,12 @@ along with GCC; see the file COPYING3. If not see
(type, wi::mask (TYPE_PRECISION (type) - wi::exact_log2 (@1), (type, wi::mask (TYPE_PRECISION (type) - wi::exact_log2 (@1),
false, TYPE_PRECISION (type))); }))) false, TYPE_PRECISION (type))); })))
/* Simplify (unsigned t / 2) * 2 -> unsigned t & ~1. */
(simplify
(mult (trunc_div @0 integer_pow2p@1) @1)
(if (TYPE_UNSIGNED (TREE_TYPE (@0)))
(bit_and @0 (negate @1))))
/* X % Y is smaller than Y. */ /* X % Y is smaller than Y. */
(for cmp (lt ge) (for cmp (lt ge)
(simplify (simplify
......
2015-07-24 Naveen H.S <Naveen.Hurugalawadi@caviumnetworks.com> 2015-07-24 Naveen H.S <Naveen.Hurugalawadi@caviumnetworks.com>
PR middle-end/25530
* gcc.dg/pr25530.c: New test.
2015-07-24 Naveen H.S <Naveen.Hurugalawadi@caviumnetworks.com>
PR middle-end/25529 PR middle-end/25529
* gcc.dg/pr25529.c: New test. * gcc.dg/pr25529.c: New test.
......
/* { dg-do compile } */
/* { dg-options "-O2 -fdump-tree-optimized" } */
/* { dg-require-effective-target int32 } */
int
f (unsigned t)
{
return (t / 2) * 2;
}
/* { dg-final { scan-tree-dump "\& -2" "optimized" } } */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment