[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20221125023330.195581-1-mailhol.vincent@wanadoo.fr>
Date: Fri, 25 Nov 2022 11:33:28 +0900
From: Vincent Mailhol <mailhol.vincent@...adoo.fr>
To: x86@...nel.org, Ingo Molnar <mingo@...hat.com>,
Borislav Petkov <bp@...en8.de>
Cc: Nick Desaulniers <ndesaulniers@...gle.com>,
Thomas Gleixner <tglx@...utronix.de>,
linux-kernel@...r.kernel.org, Yury Norov <yury.norov@...il.com>,
llvm@...ts.linux.dev, Peter Zijlstra <peterz@...radead.org>,
Vincent Mailhol <mailhol.vincent@...adoo.fr>
Subject: [PATCH v2 0/2] x86/asm/bitops: optimize fls functions for constant expressions
The compilers provide some builtin expression equivalent to the fls(),
__fls() and fls64() functions of the kernel.
The kernel's x86 implementation relies on assembly code. This assembly
code can not be folded when used with constant expressions.
This series replaces the kernel assembly by a builtin equivalent when
appropriate. It is a follow-up on this previous series:
https://lore.kernel.org/all/20220907090935.919-1-mailhol.vincent@wanadoo.fr/
in which I promised to also modify the fls() functions.
* Changelog *
v1 -> v2:
* [patch 1/2] add Reviewed-by: Nick Desaulniers tag.
* [patch 2/2] replace:
BUILD_BUG_ON(sizeof(unsigned long long) != sizeof(x));
by:
BUILD_BUG_ON(!__same_type(x, unsigned long long));
and slightly modify the commit description.
Vincent Mailhol (2):
x86/asm/bitops: Replace __fls() by its generic builtin implementation
x86/asm/bitops: Use __builtin_clz*() to evaluate constant expressions
arch/x86/include/asm/bitops.h | 70 ++++++++++++++++++++---------------
1 file changed, 40 insertions(+), 30 deletions(-)
--
2.37.4
Powered by blists - more mailing lists