From: David Laight <David.Laight@ACULAB.COM>
To: "'Christian König'" <christian.koenig@amd.com>,
"Jani Nikula" <jani.nikula@linux.intel.com>,
"Alex Deucher" <alexdeucher@gmail.com>,
"Bernard Zhao" <bernard@vivo.com>
Cc: Alex Sierra <alex.sierra@amd.com>, Oak Zeng <Oak.Zeng@amd.com>,
"Maling list - DRI developers" <dri-devel@lists.freedesktop.org>,
David Airlie <airlied@linux.ie>,
Felix Kuehling <Felix.Kuehling@amd.com>,
LKML <linux-kernel@vger.kernel.org>,
amd-gfx list <amd-gfx@lists.freedesktop.org>,
"kernel@vivo.com" <kernel@vivo.com>,
Huang Rui <ray.huang@amd.com>,
"Kent Russell" <kent.russell@amd.com>,
Alex Deucher <alexander.deucher@amd.com>,
"Sam Ravnborg" <sam@ravnborg.org>,
Xiaojie Yuan <xiaojie.yuan@amd.com>
Subject: RE: [PATCH] Optimized division operation to shift operation
Date: Wed, 15 Apr 2020 09:39:29 +0000 [thread overview]
Message-ID: <e891ca9944774cbdba577982f0bc7738@AcuMS.aculab.com> (raw)
In-Reply-To: <b5ffc6b7-bfa5-0827-a267-4e8c20027982@amd.com>
From: Christian König
> Sent: 15 April 2020 08:57
> Am 15.04.20 um 09:41 schrieb Jani Nikula:
> > On Tue, 14 Apr 2020, Alex Deucher <alexdeucher@gmail.com> wrote:
> >> On Tue, Apr 14, 2020 at 9:05 AM Bernard Zhao <bernard@vivo.com> wrote:
> >>> On some processors, the / operate will call the compiler`s div lib,
> >>> which is low efficient, We can replace the / operation with shift,
> >>> so that we can replace the call of the division library with one
> >>> shift assembly instruction.
> > This was applied already, and it's not in a driver I look after... but
> > to me this feels like something that really should be
> > justified. Using >> instead of / for multiples of 2 division mattered 20
> > years ago, I'd be surprised if it still did on modern compilers.
>
> I have similar worries, especially since we replace the "/ (4 * 2)" with
> ">> 3" it's making the code just a bit less readable.
>
> And that the code runs exactly once while loading the driver and pushing
> the firmware into the hardware. So performance is completely irrelevant
> here.
Force the division to be unsigned and the compiler will use a shift.
David
-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)
prev parent reply other threads:[~2020-04-15 9:39 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-14 11:35 Bernard Zhao
2020-04-14 18:15 ` Alex Deucher
2020-04-15 7:41 ` Jani Nikula
2020-04-15 7:57 ` Christian König
2020-04-15 9:16 ` Daniel Vetter
2020-04-15 9:39 ` David Laight [this message]
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=e891ca9944774cbdba577982f0bc7738@AcuMS.aculab.com \
--to=david.laight@aculab.com \
--cc=Felix.Kuehling@amd.com \
--cc=Oak.Zeng@amd.com \
--cc=airlied@linux.ie \
--cc=alex.sierra@amd.com \
--cc=alexander.deucher@amd.com \
--cc=alexdeucher@gmail.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=bernard@vivo.com \
--cc=christian.koenig@amd.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=jani.nikula@linux.intel.com \
--cc=kent.russell@amd.com \
--cc=kernel@vivo.com \
--cc=linux-kernel@vger.kernel.org \
--cc=ray.huang@amd.com \
--cc=sam@ravnborg.org \
--cc=xiaojie.yuan@amd.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
Powered by JetHome