[PATCH v2] string: Use builtins for ffs and ffsll
Wilco Dijkstra
Wilco.Dijkstra@arm.com
Sat Aug 26 12:31:51 GMT 2023
Hi Adhemerval,
> I did analyze it and for 32 bits targets that do define USE_FFSLL_BUILTIN
> to 1 (armv6t2, arc, i386, m68k/mc68020, and powerpc) gcc will lower ffs to
> __builin_ffs. For instance:
But there is no point in ever defining USE_FFSLL_BUILTIN 0 - if a target can
inline a 32-bit ffs, it will also inline 64-bit ffs. And if it doesn't have 32-bit ffs,
one call to __ffsdi2 is better than 2 calls to __ffssi2. So this is wrong:
> +++ b/sysdeps/arm/math-use-builtins-ffs.h
> @@ -0,0 +1,2 @@
> +#define USE_FFS_BUILTIN 1
> +#define USE_FFSLL_BUILTIN 0
I think it's simpler to always "define USE_FFS(LL)_BUILTIN 1" in generic code
and only add exceptions for targets that don't support the builtin correctly.
Cheers,
Wilco
More information about the Libc-alpha
mailing list