Re: [PATCH] Fix MULT_HIGHPART_EXPR folding (PR tree-optimization/56918)

2013-04-12 Thread Jakub Jelinek
On Fri, Apr 12, 2013 at 10:10:45AM +0200, Marc Glisse wrote: > unsigned_p changes the computation of the high part of the product: > it returns early for unsigned products and adjusts the high part > later for signed. overflow_dummy looks good. I don't remember > exactly, but I think the overflow p

Re: [PATCH] Fix MULT_HIGHPART_EXPR folding (PR tree-optimization/56918)

2013-04-12 Thread Marc Glisse
On Fri, 12 Apr 2013, Jakub Jelinek wrote: On Thu, Apr 11, 2013 at 09:13:17PM +0200, Marc Glisse wrote: The comments on PREC in the rshift function really confused me. Yeah, me too. But if count == prec, the code always: /* Zero / sign extend all bits that are beyond the precision. */ if

Re: [PATCH] Fix MULT_HIGHPART_EXPR folding (PR tree-optimization/56918)

2013-04-12 Thread Richard Biener
On Fri, 12 Apr 2013, Jakub Jelinek wrote: > On Thu, Apr 11, 2013 at 09:13:17PM +0200, Marc Glisse wrote: > > On Thu, 11 Apr 2013, Jakub Jelinek wrote: > > > > >The op1 - op2 line instead of multiplication is something that has been > > >introduced in C++ double_int changes, but without the 2 * TY

Re: [PATCH] Fix MULT_HIGHPART_EXPR folding (PR tree-optimization/56918)

2013-04-12 Thread Jakub Jelinek
On Thu, Apr 11, 2013 at 09:13:17PM +0200, Marc Glisse wrote: > On Thu, 11 Apr 2013, Jakub Jelinek wrote: > > >The op1 - op2 line instead of multiplication is something that has been > >introduced in C++ double_int changes, but without the 2 * TYPE_PRECISION > >prec it would always return 0 or -1 a

Re: [PATCH] Fix MULT_HIGHPART_EXPR folding (PR tree-optimization/56918)

2013-04-11 Thread Marc Glisse
On Thu, 11 Apr 2013, Jakub Jelinek wrote: The op1 - op2 line instead of multiplication is something that has been introduced in C++ double_int changes, but without the 2 * TYPE_PRECISION prec it would always return 0 or -1 anyway. The comments on PREC in the rshift function really confused me.

[PATCH] Fix MULT_HIGHPART_EXPR folding (PR tree-optimization/56918)

2013-04-11 Thread Jakub Jelinek
Hi! The op1 - op2 line instead of multiplication is something that has been introduced in C++ double_int changes, but without the 2 * TYPE_PRECISION prec it would always return 0 or -1 anyway. And, with wide_mul_with_sign we can also handle 2 * HOST_BITS_PER_WIDE_INT precisions. Bootstrapped/reg