LoongArch: Use builtins for ffs and ffsll
commit2e80f139376450acdb7d879d799439578a41810e
authorXi Ruoyao <xry111@xry111.site>
Sun, 4 Feb 2024 00:27:50 +0000 (4 08:27 +0800)
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>
Mon, 5 Feb 2024 18:19:41 +0000 (5 15:19 -0300)
tree9888c8627c488da707f338232ab4c480c618eba9
parent814ed22eab4f3f43bb02229edab5d50004310258
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 <xry111@xry111.site>
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
sysdeps/loongarch/math-use-builtins-ffs.h [new file with mode: 0644]