From: "George Spelvin" <linux@horizon.com>
To: linux@horizon.com, vda.linux@googlemail.com
Cc: hughd@google.com, linux-kernel@vger.kernel.org, mina86@mina86.com
Subject: Re: [PATCH 2/4] lib: vsprintf: Optimize division by 10000
Date: 24 Sep 2012 08:35:27 -0400 [thread overview]
Message-ID: <20120924123527.9284.qmail@science.horizon.com> (raw)
In-Reply-To: <CAK1hOcOO7MoDDzJgKJ+2dra5n3ogyKR+mKyTh+o_isgRi3yRxQ@mail.gmail.com>
> Here is the comparison of the x86-32 assembly
> of the fragment which does "x / 10000" thing,
> before and after the patch:
> -01 c6 add %eax,%esi
> -b8 59 17 b7 d1 mov $0xd1b71759,%eax
> -f7 e6 mul %esi
> -89 d3 mov %edx,%ebx
> -89 f2 mov %esi,%edx
> -c1 eb 0d shr $0xd,%ebx
>
> +01 c7 add %eax,%edi
> +b8 d7 c5 6d 34 mov $0x346dc5d7,%eax
> +f7 e7 mul %edi
> +89 55 e8 mov %edx,-0x18(%ebp)
> +8b 5d e8 mov -0x18(%ebp),%ebx
> +89 fa mov %edi,%edx
> +89 45 e4 mov %eax,-0x1c(%ebp)
> +c1 eb 0b shr $0xb,%ebx
>
> Poor gcc got confused, and generated somewhat
> worse code (spilling and immediately reloading upper
> part of 32x32->64 multiply).
> Please test and benchmark your changes to this code
> before submitting them.
Thanks for the feedback! It very much *was* intended to start a
conversation with you, but the 7 week response delay somewhat interfered
with that process.
I was playing with it on ARM, where the results are a bit different.
As you can see, it fell out of some other word which *did* make a
useful difference. I just hadn't tested this change in isolation,
which I realized as I wrote the final commit comment while cleaning
up the series for publication.
(And please excuse me if there's some paging delay on my part
to swap the whole business back in; it's been a while.)
I'll see if I can come up with something that provides the cleaner code
(do you agree that the source *looks* nicer?) and still makes GCC do
the right thing.
next prev parent reply other threads:[~2012-09-24 12:35 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-08-03 5:21 [PATCH 1/4] lib: vsprintf: Optimize division by 10 for small integers George Spelvin
2012-08-03 5:21 ` [PATCH 2/4] lib: vsprintf: Optimize division by 10000 George Spelvin
2012-09-23 17:30 ` Michal Nazarewicz
2012-09-24 12:16 ` George Spelvin
2012-09-24 12:41 ` Michal Nazarewicz
2012-09-24 13:56 ` George Spelvin
2012-09-24 15:14 ` Geert Uytterhoeven
2012-09-24 15:48 ` George Spelvin
2012-09-24 9:03 ` Denys Vlasenko
2012-09-24 12:35 ` George Spelvin [this message]
2012-09-24 15:02 ` Denys Vlasenko
2012-08-03 5:21 ` [PATCH 3/4] lib: vsprintf: Optimize put_dec_trunc8 George Spelvin
2012-09-23 14:18 ` Rabin Vincent
2012-09-24 11:13 ` George Spelvin
2012-09-24 14:33 ` George Spelvin
2012-09-24 14:53 ` Michal Nazarewicz
2012-09-24 14:57 ` Michal Nazarewicz
2012-09-23 18:22 ` Michal Nazarewicz
2012-09-24 11:46 ` George Spelvin
2012-09-24 12:29 ` Michal Nazarewicz
2012-09-24 13:49 ` George Spelvin
2012-09-24 15:06 ` Michal Nazarewicz
2012-09-25 11:44 ` George Spelvin
2012-09-25 13:00 ` Denys Vlasenko
2012-08-03 5:21 ` [PATCH 4/4] lib: vsprintf: Fix broken comments George Spelvin
2012-09-23 17:22 ` [PATCH 1/4] lib: vsprintf: Optimize division by 10 for small integers Michal Nazarewicz
2012-09-24 14:18 ` George Spelvin
2012-09-24 9:06 ` Denys Vlasenko
2012-09-24 11:27 ` George Spelvin
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=20120924123527.9284.qmail@science.horizon.com \
--to=linux@horizon.com \
--cc=hughd@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mina86@mina86.com \
--cc=vda.linux@googlemail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®