From: Xi Ruoyao Date: Sun, 4 Feb 2024 00:27:50 +0000 (+0800) Subject: LoongArch: Use builtins for ffs and ffsll X-Git-Tag: glibc-2.40~422 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=2e80f139376450acdb7d879d799439578a41810e;p=thirdparty%2Fglibc.git LoongArch: Use builtins for ffs and ffsll On LoongArch GCC compiles __builtin_ffs{,ll} to basically `(x ? __builtin_ctz (x) : -1) + 1`. Since a hardware ctz instruction is available, this is much better than the table-driven generic implementation. Tested on loongarch64. Signed-off-by: Xi Ruoyao Reviewed-by: Adhemerval Zanella --- diff --git a/sysdeps/loongarch/math-use-builtins-ffs.h b/sysdeps/loongarch/math-use-builtins-ffs.h new file mode 100644 index 00000000000..a83bb154143 --- /dev/null +++ b/sysdeps/loongarch/math-use-builtins-ffs.h @@ -0,0 +1,2 @@ +#define USE_FFS_BUILTIN 1 +#define USE_FFSLL_BUILTIN 1