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 (count >= prec)
{
*hv = signmask;
*lv = signmask;
}
which is definitely not what we want.
I agree. I meant something like: if someone knows how to improve that
comment...
I have one question below.
+ {
+ if (TYPE_PRECISION (type) != 2 * HOST_BITS_PER_WIDE_INT)
+ return NULL_TREE;
+ op1.wide_mul_with_sign (op2, false, &res, &overflow);
Why "false" and not something involving "uns"?
false was what rth used in his original code. Looking at what is the
difference, it seems unsigned_p only matters for the computation of
overflow, and, MULT_HIGHPART_EXPR should never overflow, thus perhaps
we should either have a dummy bool overflow_dummy; there and use it
instead of &overflow, or just set overflow = false; afterwards.
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 parameter is only there because the regular multiplication
forwards to the wide multiplication.
--
Marc Glisse