This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: PR 61084: Use widest_int in sparc_fold_builtin
- From: Richard Sandiford <rdsandiford at googlemail dot com>
- To: Eric Botcazou <ebotcazou at adacore dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Mon, 19 May 2014 09:51:10 +0100
- Subject: Re: PR 61084: Use widest_int in sparc_fold_builtin
- Authentication-results: sourceware.org; auth=none
- References: <87bnuyexv7 dot fsf at sandifor-thinkpad dot stglab dot manchester dot uk dot ibm dot com> <14901342 dot qKrUO6pI85 at polaris> <87d2fakz3h dot fsf at talisman dot default> <1555122 dot Wjxm4ZpHZb at polaris>
Eric Botcazou <ebotcazou@adacore.com> writes:
>> Well, I understood the distinction between wide_int and widest_int.
>> I just didn't understand what pdist did. :-)
>>
>> The difference is documented (a bit verbosely) in wide-int.h.
>
> Yes, but not really why it's not correct to use wide_int for the computation
> made in pdist
It was wrong to use wide_int because the calculation does arithmetic on
mixed QImode and DImode values.
1) wide_int (the default). This flavor does the math in the
precision of its input arguments. It is assumed (and checked)
that the precisions of the operands and results are consistent.
The precisions weren't consistent in this case and we failed the
assertion checks.
> (and whether the use of widest_int could be avoided altogether
> by using a common type throughout the computation).
That would work too, but widest_int seemed simpler.
Thanks,
Richard