On Thu, Jul 23, 2015 at 5:47 AM, Hurugalawadi, Naveen <naveen.hurugalaw...@caviumnetworks.com> wrote: >>> so using wi::mask is prefered here. > > Thanks for your review and comments. > > Please find attached the modified patch as per your comments. > > Please let me know if this version is okay?
Ok with adding /* { dg-require-effective-target int32 } */ to the testcase. Please omit the +/* Simplify (t * 2)/2 -> t. */ +(simplify + (exact_div (mult @0 INTEGER_CST@1) @1) + (if (TYPE_OVERFLOW_UNDEFINED (TREE_TYPE (@0))) + @0)) pattern. As a followup extend it - it shoudl also work for non-INTEGER_CST divisors and it should work for any kind of division, not just exact_div. The key here is TYPE_OVERFLOW_UNDEFINED. I believe you should find the equivalent operation in extract_trunc_div_1. Richard. > Thanks, > Naveen > > 2015-07-22 Naveen H.S <naveen.hurugalaw...@caviumnetworks.com> > > gcc/testsuite/ChangeLog: > PR middle-end/25529 > * gcc.dg/pr25529.c: New test. > > gcc/ChangeLog: > PR middle-end/25529 > * match.pd (exact_div (mult @0 INTEGER_CST@1) @1) : New > simplifier. > (trunc_div (mult @0 integer_pow2p@1) @1) : New simplifier.