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
+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
(type, wi::mask (TYPE_PRECISION (type) - wi::exact_log2 (@1),
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. */
(for cmp (lt ge)
(simplify
+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
--- /dev/null
+/* { 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" } } */