From: "Arnd Bergmann" <arnd@arndb.de>
To: "Nicolas Pitre" <nico@fluxnic.net>
Cc: "Russell King" <linux@armlinux.org.uk>,
Linux-Arch <linux-arch@vger.kernel.org>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 4/4] __arch_xprod64(): make __always_inline when optimizing for performance
Date: Mon, 08 Jul 2024 07:21:02 +0200 [thread overview]
Message-ID: <6fa4d8af-0f9e-4525-adf6-8c3c3d059b2f@app.fastmail.com> (raw)
In-Reply-To: <57srp3ps-n7p8-orqq-86rq-p04o2246pn7s@syhkavp.arg>
On Mon, Jul 8, 2024, at 03:21, Nicolas Pitre wrote:
> On Sun, 7 Jul 2024, Arnd Bergmann wrote:
>> On Sun, Jul 7, 2024, at 21:14, Nicolas Pitre wrote:
>
> Oh, most likely yes. The non-constant base has to go through the whole
> one-bit-at-a-time division loop whereas the constant base with
> __div64_const32 results in 4 64-bits multiply and add. Moving
> __arch_xprod_64() out of line adds the argument shuffling overhead and
> it can't skip overflow handling, but still.
>
> Here's some numbers. With latest patches using __always_inline:
>
> test_div64: Starting 64bit/32bit division and modulo test
> test_div64: Completed 64bit/32bit division and modulo test, 0.048285584s elapsed
>
> Latest patches but __always_inline left out:
>
> test_div64: Starting 64bit/32bit division and modulo test
> test_div64: Completed 64bit/32bit division and modulo test, 0.053023584s elapsed
>
> Forcing both constant and non-constant base through the same path:
>
> test_div64: Starting 64bit/32bit division and modulo test
> test_div64: Completed 64bit/32bit division and modulo test, 0.103263776s elapsed
>
> It is worth noting that test_div64 does half the test with non constant
> divisors already so the impact is greater than what those numbers show.
>
> And for what it is worth, those numbers were obtained using QEMU. The
> gcc version is 14.1.0.
Right, so with the numbers in qemu matching your explanation,
that seems reasonable to assume it will behave the same way
across a wide range of physical CPUs.
Arnd
next prev parent reply other threads:[~2024-07-08 5:21 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-07 17:17 [PATCH v2 0/4] do_div() with constant divisor simplification Nicolas Pitre
2024-07-07 17:17 ` [PATCH v2 1/4] lib/math/test_div64: add some edge cases relevant to __div64_const32() Nicolas Pitre
2024-07-07 17:17 ` [PATCH v2 2/4] asm-generic/div64: optimize/simplify __div64_const32() Nicolas Pitre
2024-07-07 17:17 ` [PATCH v2 3/4] ARM: div64: improve __arch_xprod_64() Nicolas Pitre
2024-07-07 17:17 ` [PATCH v2 4/4] __arch_xprod64(): make __always_inline when optimizing for performance Nicolas Pitre
2024-07-07 18:59 ` Arnd Bergmann
2024-07-07 19:14 ` Nicolas Pitre
2024-07-07 19:37 ` Arnd Bergmann
2024-07-08 1:21 ` Nicolas Pitre
2024-07-08 5:21 ` Arnd Bergmann [this message]
2024-07-07 19:40 ` kernel test robot
2024-07-07 19:40 ` kernel test robot
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=6fa4d8af-0f9e-4525-adf6-8c3c3d059b2f@app.fastmail.com \
--to=arnd@arndb.de \
--cc=linux-arch@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=nico@fluxnic.net \
/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®