[U-Boot] [PATCH] arm: add 64-64 bit divider

Marek Vasut marek.vasut at gmail.com
Thu Sep 1 12:16:13 CEST 2011


On Thursday, September 01, 2011 12:09:18 PM Che-liang Chiou wrote:
> Hi,
> 
> Thanks for the insightful comments. Here are my responses:
> 
> * Why don't I implement the divider in C?
> It is not because I think it's performance critical (I haven't
> benchmarked it yet), but because I have a probably wrong impression
> that the divider has to be written in assembly --- all dividers in
> arch/arm/lib/ are written in ARM assembly. What is the policy here for
> using assembly or C?

No, C is just fine and is more generic. Those assembler versions are just 
optimized things, you don't need to be bothered by those.

> 
> * When do we need a 64-bit divider?
> In kernel code do_div() is used for various purposes. So I think it
> should be quite often that we would need a 64-bit divider in U-Boot.

Not much really ... and for the rare cases, we can do with do_div() as is.

> 
> * Do we need a 64-64 bit divider?
> do_div() defines 64-32 bit division semantics (dividend is 64-bit and
> divisor is 32-bit), and this patch implements a 64-64 bit divider
> (both dividend and divisor are 64-bit). I have to admit that I can't
> think of scenarios or reasons to justify a 64-64 bit divider instead
> of a 64-32 bit divider, except that a 64-64 bit divider is more
> generic than a 64-32 bit one.

So we don't need 64/64 divide at all.

> 
> So I guess we can agree that a 64-bit divider is feature that is nice
> to have, and we should decide:
> * Do we need a 64-64 bit divider or a 64-32 bit one?

64-32 is do_div()

> * Do we write it in C or assembly?

C is OK.

> 
> Depending on our decisions, I will rewrite (or abandon) this patch
> accordingly.

Look, I don't mean to be rough, but honestly. I see no use for this code. Adding 
code to anywhere so it'd just sit there is bad.

Cheers

> 
> Regards,
> Che-Liang
> 
> On Thu, Sep 1, 2011 at 4:03 AM, Wolfgang Denk <wd at denx.de> wrote:
> > Dear Che-Liang Chiou,
> > 
> > In message <1314787130-1043-1-git-send-email-clchiou at chromium.org> you 
wrote:
> >> This patch adds a 64-64 bit divider that supports ARMv4 and above.
> > 
> > To summarize the misc feedback:  Please explain in detail which
> > problem you are trying to fix.  We see no need for this patch so far.
> > 
> > Best regards,
> > 
> > Wolfgang Denk
> > 
> > --
> > DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
> > HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
> > Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
> > "Success covers a multitude of blunders."       - George Bernard Shaw


More information about the U-Boot mailing list