[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAMZ6RqLyRxvUiLKZLkQF1cYFkdOqX73V2K=dGbNROMDj61OKLw@mail.gmail.com>
Date: Sun, 4 Feb 2024 22:56:28 +0900
From: Vincent MAILHOL <mailhol.vincent@...adoo.fr>
To: Finn Thain <fthain@...ux-m68k.org>
Cc: David Laight <David.Laight@...lab.com>, Andrew Morton <akpm@...ux-foundation.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>, Yury Norov <yury.norov@...il.com>,
Nick Desaulniers <ndesaulniers@...gle.com>, Douglas Anderson <dianders@...omium.org>,
Kees Cook <keescook@...omium.org>, Petr Mladek <pmladek@...e.com>,
Randy Dunlap <rdunlap@...radead.org>, Zhaoyang Huang <zhaoyang.huang@...soc.com>,
Geert Uytterhoeven <geert+renesas@...der.be>, Marco Elver <elver@...gle.com>,
Brian Cain <bcain@...cinc.com>, Geert Uytterhoeven <geert@...ux-m68k.org>,
Matthew Wilcox <willy@...radead.org>, "Paul E . McKenney" <paulmck@...nel.org>,
"linux-m68k@...ts.linux-m68k.org" <linux-m68k@...ts.linux-m68k.org>
Subject: Re: [PATCH v4 2/5] m68k/bitops: use __builtin_{clz,ctzl,ffs} to
evaluate constant expressions
Hi Finn and David,
Sorry for the late feedback, I did not have much time during weekdays.
On Monday. 29 Jan. 2024 at 07:34, Finn Thain <fthain@...ux-m68k.org> wrote:
> On Sun, 28 Jan 2024, Vincent MAILHOL wrote:
> > > > The asm is meant to produce better results when the argument is not
> > > > a constant expression.
>
> Is that because gcc's implementation has to satisfy requirements that are
> excessively stringent for the kernel's purposes? Or is it a compiler
> deficiency only affecting certain architectures?
I just guess that GCC guys followed the Intel datasheet while the
kernel guys like to live a bit more dangerously and rely on some not
so well defined behaviours... But I am really not the person to whom
you should ask.
I just want to optimize the constant folding and this is the only
purpose of this series. I am absolutely not an asm. That's also why I
am reluctant to compare the asm outputs.
> > ... The only thing I am not ready to do is to compare the produced
> > assembly code and confirm whether or not it is better to remove asm
> > code.
> >
>
> If you do the comparison and find no change, you get to say so in the
> commit log, and everyone is happy.
Without getting into details, here is a quick comparaisons of gcc and
clang generated asm for all the bitops builtin:
https://godbolt.org/z/Yb8nMKnYf
To the extent of my limited knowledge, it looks rather OK for gcc, but
for clang... seems that this is the default software implementation.
So are we fine with the current patch? Or maybe clang support is not
important for m68k? I do not know so tell me :)
Yours sincerely,
Vincent Mailhol
Powered by blists - more mailing lists