[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CA+55aFzJ9iv6S2hczHjPS3kckWOrhfWvjNADdjivO6N7u5YNhQ@mail.gmail.com>
Date: Thu, 5 Apr 2018 09:43:40 -0700
From: Linus Torvalds <torvalds@...ux-foundation.org>
To: Peter Zijlstra <peterz@...radead.org>
Cc: Matthias Kaehlcke <mka@...omium.org>,
Arnd Bergmann <arnd@...db.de>, Ingo Molnar <mingo@...nel.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Thomas Gleixner <tglx@...utronix.de>,
Andrew Morton <akpm@...ux-foundation.org>,
James Y Knight <jyknight@...gle.com>,
Chandler Carruth <chandlerc@...gle.com>,
Stephen Hines <srhines@...gle.com>,
Nick Desaulniers <ndesaulniers@...gle.com>,
Kees Cook <keescook@...gle.com>,
Guenter Roeck <groeck@...omium.org>,
Greg Hackmann <ghackmann@...gle.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Subject: Re: [GIT PULL] x86/build changes for v4.17
On Thu, Apr 5, 2018 at 12:24 AM, Peter Zijlstra <peterz@...radead.org> wrote:
>
> I always assumed BT was a more expensive instruction than AND with
> immediate.
Oh, absolutely. That's why we do all those "depending on immediate or not".
The reason I brought that case up is that "test_bit()" and "set_bit()"
do this "is it constant" test COMPLETELY DIFFERENTLY.
The test_bit() one is arguably much more legible, and easier to
understand. And it so happens that clang will see that it's constant
because it's a macro (well, unless that macro is then used in an
inline function).
The set_bit() pattern looks completely different, and doesn't have
that abstraction of "constant_set_bit()" vs "variable_set_bit()", like
test_bit() does.
THAT was why I pointed it out - we do different things otherwise
similar operations.
Not because it would be odd that we do different things for the
"constant bit number" vs "variable bit number".
Linus
Powered by blists - more mailing lists