Re: [PR25530] Convert (unsigned t / 2) * 2 into (unsigned t ~1)

2015-07-23 Thread Richard Biener
On Thu, Jul 23, 2015 at 5:49 AM, Hurugalawadi, Naveen naveen.hurugalaw...@caviumnetworks.com wrote: Your previous patch correctly restricted this to unsigned types. Thanks for your review and comments. Please find attached the modified patch as per your comments. Please let me know if this

Re: [PR25530] Convert (unsigned t / 2) * 2 into (unsigned t ~1)

2015-07-22 Thread Richard Biener
On Tue, Jul 21, 2015 at 11:16 AM, Hurugalawadi, Naveen naveen.hurugalaw...@caviumnetworks.com wrote: 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.

Re: [PR25530] Convert (unsigned t / 2) * 2 into (unsigned t ~1)

2015-07-22 Thread Hurugalawadi, Naveen
Your previous patch correctly restricted this to unsigned types. 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? Thanks, Naveen 2015-07-22 Naveen H.S naveen.hurugalaw...@caviumnetworks.com

Re: [PR25530] Convert (unsigned t / 2) * 2 into (unsigned t ~1)

2015-07-21 Thread Hurugalawadi, Naveen
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.

Re: [PR25530] Convert (unsigned t / 2) * 2 into (unsigned t ~1)

2015-07-09 Thread Paolo Bonzini
On 07/07/2015 11:08, Richard Biener wrote: Also I am not sure ceil_div and floor_div can be handled this way. (5 /[ceil] 2) * 2 == 6 but you compute it as 4. So I am only convinced trunc_div works this way. Of course also floor_div for unsigned arguments. For signed arguments, ceil_div

Re: [PR25530] Convert (unsigned t / 2) * 2 into (unsigned t ~1)

2015-07-09 Thread Richard Biener
On Thu, Jul 9, 2015 at 8:35 AM, Paolo Bonzini bonz...@gnu.org wrote: On 07/07/2015 11:08, Richard Biener wrote: Also I am not sure ceil_div and floor_div can be handled this way. (5 /[ceil] 2) * 2 == 6 but you compute it as 4. So I am only convinced trunc_div works this way. Of course

Re: [PR25530] Convert (unsigned t / 2) * 2 into (unsigned t ~1)

2015-07-07 Thread Richard Biener
On Tue, Jul 7, 2015 at 6:52 AM, Hurugalawadi, Naveen naveen.hurugalaw...@caviumnetworks.com wrote: Hi, Please find attached the patch PR25530.patch that converts the pattern:- (unsigned / 2) * 2 is into (unsigned ~1). Please review and let me know if its okay. For EXACT_DIV fold-const.c

[PR25530] Convert (unsigned t / 2) * 2 into (unsigned t ~1)

2015-07-06 Thread Hurugalawadi, Naveen
Hi, Please find attached the patch PR25530.patch that converts the pattern:- (unsigned / 2) * 2 is into (unsigned ~1). Please review and let me know if its okay. Regression tested on AARH64 and x86_64. Thanks, Naveen gcc/testsuite/ChangeLog: 2015-07-07 Naveen H.S