Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1262744 > unrolled thread

Re: [PATCH] __div64_32: implement division by multiplication for 32-bit arches

Started byNicolas Pitre <nicolas.pitre@linaro.org>
First post2015-11-05 00:50 +0100
Last post2015-11-05 06:10 +0100
Articles 5 — 3 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [PATCH] __div64_32: implement division by multiplication for  32-bit arches Nicolas Pitre <nicolas.pitre@linaro.org> - 2015-11-05 00:50 +0100
    Re: [PATCH] __div64_32: implement division by multiplication for 32-bit arches Måns Rullgård <mans@mansr.com> - 2015-11-05 00:50 +0100
    Re: [PATCH] __div64_32: implement division by multiplication for  32-bit arches Nicolas Pitre <nicolas.pitre@linaro.org> - 2015-11-05 00:50 +0100
      Re: [PATCH] __div64_32: implement division by multiplication for  32-bit arches Vineet Gupta <Vineet.Gupta1@synopsys.com> - 2015-11-05 04:20 +0100
        Re: [PATCH] __div64_32: implement division by multiplication for  32-bit arches Nicolas Pitre <nicolas.pitre@linaro.org> - 2015-11-05 06:10 +0100

#1262744 — Re: [PATCH] __div64_32: implement division by multiplication for 32-bit arches

FromNicolas Pitre <nicolas.pitre@linaro.org>
Date2015-11-05 00:50 +0100
SubjectRe: [PATCH] __div64_32: implement division by multiplication for 32-bit arches
Message-ID<qrfYt-7c7-1@gated-at.bofh.it>

[Multipart message — attachments visible in raw view] — view raw

On Fri, 30 Oct 2015, Måns Rullgård wrote:

> Nicolas Pitre <nicolas.pitre@linaro.org> writes:
> 
> > I'm going to do it anyway given that I already have it for ARM.  It'll 
> > be opt-in, so if your arch doesn't provide it then the current C 
> > implementation will be used by default.
> 
> Great.  I'll try it out on MIPS once you've posted the patch.

You should have seen the patches by now.

I've put them along with a bunch of do_div() usage fixes here:

  http://git.linaro.org/people/nicolas.pitre/linux.git


Nicolas

[toc] | [next] | [standalone]


#1262746 — Re: [PATCH] __div64_32: implement division by multiplication for 32-bit arches

FromMåns Rullgård <mans@mansr.com>
Date2015-11-05 00:50 +0100
SubjectRe: [PATCH] __div64_32: implement division by multiplication for 32-bit arches
Message-ID<qrfYt-7c7-9@gated-at.bofh.it>
In reply to#1262744
Nicolas Pitre <nicolas.pitre@linaro.org> writes:

> On Fri, 30 Oct 2015, Måns Rullgård wrote:
>
>> Nicolas Pitre <nicolas.pitre@linaro.org> writes:
>> 
>> > I'm going to do it anyway given that I already have it for ARM.  It'll 
>> > be opt-in, so if your arch doesn't provide it then the current C 
>> > implementation will be used by default.
>> 
>> Great.  I'll try it out on MIPS once you've posted the patch.
>
> You should have seen the patches by now.

Yes, I've seen them.  I've been busy with other things but hope get to
it before the end of the week.  At first glance, it looks good to me.

-- 
Måns Rullgård
mans@mansr.com
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1262748

FromNicolas Pitre <nicolas.pitre@linaro.org>
Date2015-11-05 00:50 +0100
Message-ID<qrfYu-7c7-13@gated-at.bofh.it>
In reply to#1262744

[Multipart message — attachments visible in raw view] — view raw

On Wed, 4 Nov 2015, Nicolas Pitre wrote:

> On Fri, 30 Oct 2015, Måns Rullgård wrote:
> 
> > Nicolas Pitre <nicolas.pitre@linaro.org> writes:
> > 
> > > I'm going to do it anyway given that I already have it for ARM.  It'll 
> > > be opt-in, so if your arch doesn't provide it then the current C 
> > > implementation will be used by default.
> > 
> > Great.  I'll try it out on MIPS once you've posted the patch.
> 
> You should have seen the patches by now.
> 
> I've put them along with a bunch of do_div() usage fixes here:
> 
>   http://git.linaro.org/people/nicolas.pitre/linux.git

More precisely:

  http://git.linaro.org/people/nicolas.pitre/linux.git div64


Nicolas

[toc] | [prev] | [next] | [standalone]


#1262872

FromVineet Gupta <Vineet.Gupta1@synopsys.com>
Date2015-11-05 04:20 +0100
Message-ID<qrjfI-16l-9@gated-at.bofh.it>
In reply to#1262748
On Thursday 05 November 2015 05:18 AM, Nicolas Pitre wrote:
> On Wed, 4 Nov 2015, Nicolas Pitre wrote:
>
>> On Fri, 30 Oct 2015, Måns Rullgård wrote:
>>
>>> Nicolas Pitre <nicolas.pitre@linaro.org> writes:
>>>
>>>> I'm going to do it anyway given that I already have it for ARM.  It'll 
>>>> be opt-in, so if your arch doesn't provide it then the current C 
>>>> implementation will be used by default.
>>> Great.  I'll try it out on MIPS once you've posted the patch.
>> You should have seen the patches by now.
>>
>> I've put them along with a bunch of do_div() usage fixes here:
>>
>>   http://git.linaro.org/people/nicolas.pitre/linux.git
> More precisely:
>
>   http://git.linaro.org/people/nicolas.pitre/linux.git div64

Hi Nico,

While we are current on the topic I was wondering about another optimization in
this area.
The slowpath __div64_32() generates both quotient and remainder. The more general
use case in kernel only cares about quotient.

git grep "\sdo_div(" |  wc -l
841
git grep "=\sdo_div(" |  wc -l
116

Is it possible to optimize the code, if remainder was *not* needed explicitly. I
understand that the hand divide will still need some sort of running tally of
remainder but can the code be any better in this case. That way we can introduce
another API do_div_norem() and start proliferating it for the cases where
remainder is not used.

Thx,
-Vineet
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1262908

FromNicolas Pitre <nicolas.pitre@linaro.org>
Date2015-11-05 06:10 +0100
Message-ID<qrkY9-2c9-7@gated-at.bofh.it>
In reply to#1262872

[Multipart message — attachments visible in raw view] — view raw

On Thu, 5 Nov 2015, Vineet Gupta wrote:

> On Thursday 05 November 2015 05:18 AM, Nicolas Pitre wrote:
> > On Wed, 4 Nov 2015, Nicolas Pitre wrote:
> >
> >> On Fri, 30 Oct 2015, Måns Rullgård wrote:
> >>
> >>> Nicolas Pitre <nicolas.pitre@linaro.org> writes:
> >>>
> >>>> I'm going to do it anyway given that I already have it for ARM.  It'll 
> >>>> be opt-in, so if your arch doesn't provide it then the current C 
> >>>> implementation will be used by default.
> >>> Great.  I'll try it out on MIPS once you've posted the patch.
> >> You should have seen the patches by now.
> >>
> >> I've put them along with a bunch of do_div() usage fixes here:
> >>
> >>   http://git.linaro.org/people/nicolas.pitre/linux.git
> > More precisely:
> >
> >   http://git.linaro.org/people/nicolas.pitre/linux.git div64
> 
> Hi Nico,
> 
> While we are current on the topic I was wondering about another optimization in
> this area.
> The slowpath __div64_32() generates both quotient and remainder. The more general
> use case in kernel only cares about quotient.
> 
> git grep "\sdo_div(" |  wc -l
> 841
> git grep "=\sdo_div(" |  wc -l
> 116
> 
> Is it possible to optimize the code, if remainder was *not* needed explicitly. I
> understand that the hand divide will still need some sort of running tally of
> remainder but can the code be any better in this case. That way we can introduce
> another API do_div_norem() and start proliferating it for the cases where
> remainder is not used.

I don't think you'll be able to optimize the code much.  If you look at 
the division loop, you always have the current remainder to process as 
you say, so when you can't substract from the remainder anymore you 
simply return that value.  And on ARM we simply tell the calling code 
about which register contains the remainder if it wants it.  Therefore 
on ARM the code would be exactly the same in either cases.


Nicolas

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web