This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Fix wide_int unsigned division (PR tree-optimization/69546, take 2)
- From: Richard Sandiford <richard dot sandiford at arm dot com>
- To: Jakub Jelinek <jakub at redhat dot com>
- Cc: Mike Stump <mikestump at comcast dot net>, Richard Biener <rguenther at suse dot de>, <gcc-patches at gcc dot gnu dot org>, <nd at arm dot com>
- Date: Tue, 2 Feb 2016 15:49:37 +0000
- Subject: Re: [PATCH] Fix wide_int unsigned division (PR tree-optimization/69546, take 2)
- Authentication-results: sourceware.org; auth=none
- Nodisclaimer: True
- References: <20160129142014 dot GP3017 at tucnak dot redhat dot com> <87a8nnw8om dot fsf at googlemail dot com> <20160130131525 dot GY3017 at tucnak dot redhat dot com> <87zivnups2 dot fsf at googlemail dot com> <20160201202527 dot GL3017 at tucnak dot redhat dot com>
- Spamdiagnosticmetadata: NSPM
- Spamdiagnosticoutput: 1:23
Jakub Jelinek <jakub@redhat.com> writes:
> On Sat, Jan 30, 2016 at 02:04:45PM +0000, Richard Sandiford wrote:
>> Not sure what to call it. Maybe canonize_uhwi? Like canonize, except
>> that it takes a uhwi instead of a length.
>>
>> > Can that be done as a follow-up? Certainly it would need
>> > to take the uhwi to store, pointer to the array of hwis, and precision.
>>
>> Yeah, guess it can wait.
>
> So like this?
> Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?
>
> 2016-02-01 Jakub Jelinek <jakub@redhat.com>
>
> * wide-int.cc (canonize_uhwi): New function.
> (wi::divmod_internal): Use it.
>
> --- gcc/wide-int.cc.jj 2016-01-30 19:03:35.000000000 +0100
> +++ gcc/wide-int.cc 2016-02-01 12:28:23.501519292 +0100
> @@ -118,6 +118,20 @@ canonize (HOST_WIDE_INT *val, unsigned i
> return 1;
> }
>
> +/* VAL[0] is unsigned result of operation. Canonize it by adding
> + another 0 block if needed, and return number of blocks needed. */
> +
> +static inline unsigned int
> +canonize_uhwi (HOST_WIDE_INT *val, unsigned int precision)
s/is unsigned result of operation/is the unsigned result of an operation/
LGTM otherwise, thanks.
Richard