[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAMRc=MdtM-zVmvSbxjkPyLN1YTqcS7P=aYXxzWEk0xQiu8WZjQ@mail.gmail.com>
Date: Mon, 2 Nov 2020 11:16:51 +0100
From: Bartosz Golaszewski <brgl@...ev.pl>
To: Andy Shevchenko <andy.shevchenko@...il.com>
Cc: Sudip Mukherjee <sudipm.mukherjee@...il.com>,
Linus Walleij <linus.walleij@...aro.org>,
"open list:GPIO SUBSYSTEM" <linux-gpio@...r.kernel.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Bartosz Golaszewski <bgolaszewski@...libre.com>
Subject: Re: [RFT PATCH 5/7] gpio: exar: unduplicate address and offset computation
On Mon, Oct 26, 2020 at 3:51 PM Andy Shevchenko
<andy.shevchenko@...il.com> wrote:
>
> On Mon, Oct 26, 2020 at 4:23 PM Bartosz Golaszewski <brgl@...ev.pl> wrote:
> >
> > From: Bartosz Golaszewski <bgolaszewski@...libre.com>
> >
> > Provide and use helpers for calculating the register address and bit
> > offset instead of hand coding it in every function.
>
> Can you check code generation on x86, for example?
>
> Sometimes compilers are eager to use idiv assembly instruction which
> does simultaneously / and %.
> I dunno if a) it's used for / 8 and % 8 since 8 is 2^3, b) splitting
> to functions makes the above optimisation impossible.
>
Is this optimization really needed though? It's not like it's a hot
path if it's protected by a mutex anyway. I prefer cleaner code here.
Bartosz
Powered by blists - more mailing lists