diff options
author | Xiao Wang <[email protected]> | 2023-10-31 14:45:53 +0800 |
---|---|---|
committer | Palmer Dabbelt <[email protected]> | 2023-11-09 10:15:52 -0800 |
commit | 457926b253200bd9bdfae9a016a3b1d1dc661d55 (patch) | |
tree | 28d569b7577836d8163a8ebc37f67bbf5524749e /net/unix/sysctl_net_unix.c | |
parent | e72c4333d2f2e7f2200f71a88c0480fd2a769a64 (diff) |
riscv: Optimize bitops with Zbb extension
This patch leverages the alternative mechanism to dynamically optimize
bitops (including __ffs, __fls, ffs, fls) with Zbb instructions. When
Zbb ext is not supported by the runtime CPU, legacy implementation is
used. If Zbb is supported, then the optimized variants will be selected
via alternative patching.
The legacy bitops support is taken from the generic C implementation as
fallback.
If the parameter is a build-time constant, we leverage compiler builtin to
calculate the result directly, this approach is inspired by x86 bitops
implementation.
EFI stub runs before the kernel, so alternative mechanism should not be
used there, this patch introduces a macro NO_ALTERNATIVE for this purpose.
Signed-off-by: Xiao Wang <[email protected]>
Reviewed-by: Charlie Jenkins <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Palmer Dabbelt <[email protected]>
Diffstat (limited to 'net/unix/sysctl_net_unix.c')
0 files changed, 0 insertions, 0 deletions