From: Denys Vlasenko <vda.linux@googlemail.com>
To: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
linux-kernel@vger.kernel.org,
Douglas W Jones <jones@cs.uiowa.edu>,
Michal Nazarewicz <mnazarewicz@google.com>
Subject: Re: [PATCH 1/1] vsprintf: optimize decimal conversion (again)
Date: Tue, 27 Mar 2012 01:18:38 +0200 [thread overview]
Message-ID: <201203270118.38639.vda.linux@googlemail.com> (raw)
In-Reply-To: <CAMuHMdWK-0m9-LUc90e7e8pYsOsECkZ3gjBYVAP-A4p7p=Pyug@mail.gmail.com>
On Monday 26 March 2012 22:18, Geert Uytterhoeven wrote:
> On Mon, Mar 26, 2012 at 22:13, Andrew Morton <akpm@linux-foundation.org> wrote:
> > On Mon, 26 Mar 2012 21:56:38 +0200
> > Denys Vlasenko <vda.linux@googlemail.com> wrote:
> >
> >> >> +#if BITS_PER_LONG != 32 || (~(0ULL)>>1) != ((1ULL<<63)-1)
> >> >
> >> > What's this for?
> >>
> >> The second check should be just BITS_PER_LONG_LONG != 64,
> >> but we don't have BITS_PER_LONG_LONG.
> >
> > So let's add BITS_PER_LONG_LONG rather than hacking around its absence!
>
> I don't think Linux runs on anything with BITS_PER_LONG_LONG != 64...
>
> BTW, what about CPUs with slow 32x32 multiplication and/or slow 64-bit
> division?
Without 32x32->64 multiply, the best we can generate is 4 decimal digits:
we produce next digit by approximating x/10 with (x * 0xcccd) >> 19,
and the first x where it gives wrong result is 81920 if multiply result
is truncated to 32 bits.
With it, we can generate 9 digits using (x * 0x1999999a) >> 32.
Regrading "slow 64-bit division" - after this patch, 32-bit machines
wouldn't use it at all. Only 64-bit machines will perform 64-bit
division, one per 9 decimal digits (thus, at most three divisions
per one long_long->string conversion).
In fact, with small change to #ifdefs, all machines with long long <= 64
bits can use division-less routine. It might be a good thing to try...
Any people with ARM hardware in hand interesting in running the test
program I sent in first email?
--
vda
next prev parent reply other threads:[~2012-03-26 23:18 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-03-26 18:47 [PATCH 0/1] vsprintf: optimize decimal conversion (again) Denys Vlasenko
2012-03-26 18:51 ` [PATCH 1/1] " Denys Vlasenko
2012-03-26 19:51 ` Andrew Morton
2012-03-26 19:56 ` Denys Vlasenko
2012-03-26 20:13 ` Andrew Morton
2012-03-26 20:18 ` Geert Uytterhoeven
2012-03-26 23:18 ` Denys Vlasenko [this message]
2012-03-27 0:30 ` Denys Vlasenko
2012-03-27 3:49 ` H. Peter Anvin
2012-03-26 20:20 ` H. Peter Anvin
2012-03-27 17:12 ` Michal Nazarewicz
2012-03-27 17:17 ` H. Peter Anvin
2012-03-27 0:26 ` Denys Vlasenko
2012-03-27 12:08 ` [PATCH 0/1] " roma1390
2012-03-27 15:32 ` Denys Vlasenko
2012-03-27 15:42 ` Denys Vlasenko
2012-03-28 5:56 ` roma1390
2012-03-28 10:13 ` Denys Vlasenko
2012-03-28 10:24 ` roma1390
2012-03-28 10:33 ` Denys Vlasenko
2012-03-28 10:39 ` roma1390
2012-03-28 11:20 ` Denys Vlasenko
2012-03-29 10:35 ` Denys Vlasenko
2012-03-28 10:31 ` roma1390
2012-03-28 11:23 ` Denys Vlasenko
2012-03-29 5:23 ` roma1390
2012-03-29 10:33 ` Denys Vlasenko
2012-03-27 13:49 ` roma1390
2012-03-27 15:33 ` Denys Vlasenko
2012-03-29 5:16 ` roma1390
2012-03-29 10:33 ` Denys Vlasenko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=201203270118.38639.vda.linux@googlemail.com \
--to=vda.linux@googlemail.com \
--cc=akpm@linux-foundation.org \
--cc=geert@linux-m68k.org \
--cc=jones@cs.uiowa.edu \
--cc=linux-kernel@vger.kernel.org \
--cc=mnazarewicz@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.