Hi, >> handle exact_div differently, like fold-const.c does. >> Then expressing ~1 with the result expression is really excessive - you >> should simply build this with @1 - 1 if @1 is a power of two. Thanks for the review and comments. Please find attached the modified patch as per your comments. Please review the same and let me know if any further modifications are required. Regression Tested on X86_64. Thanks, Naveen gcc/testsuite/ChangeLog: 2015-07-21 Naveen H.S PR middle-end/25530 * gcc.dg/pr25530.c: New test. gcc/ChangeLog: 2015-07-21 Naveen H.S PR middle-end/25530 * match.pd (mult (exact_div @0 INTEGET_CST@1) @1) : New simplifier. (mult (trunc_div @0 integer_pow2p@1) @1) : New simplifier.