Hi, Thanks for all the suggestions. Please find attached the modified patch as per your suggestions. I had missed a mail as pointed by Marc Glisse. Now I have implemented everything suggested. Please review the patch and let me know if any further modifications are required. I have some queries regarding the whole discussions along the course of this patch. It would be very helpful for my understanding of the code. >> /* Fold (A & ~B) - (A & B) into (A ^ B) - B. */ >> Likewise the fold code handles both constant and non-constant B. How do we know that fold code handles both constant and non-constant B and not A? >> Fold (a * (1 << b)) into (a << b) >> So either way I think we should only allow nop conversions >> here (as fold-const.c did). How do we recognize from the fold-const code that it allows only nop conversions. >> We want to minimize the number of lines in match.pd and this doesn't >> really achieve this compared to duplicating the whole pattern. Yes. Even, I have the same question to understand this better. Is it worth and does it acheive any extra optimization after moving it using simplify and match? Should I have the other three patterns duplicated and implemented or leave it in fold-const code? Thanks, Naveen