[Bug c/97445] Some fonctions marked static inline in Linux kernel are not inlined
segher at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Tue Oct 20 21:19:40 GMT 2020
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97445
--- Comment #46 from Segher Boessenkool <segher at gcc dot gnu.org> ---
(In reply to Christophe Leroy from comment #43)
> int g(int x)
> {
> return __builtin_clz(0);
> }
>
> Gives
>
> 00000018 <g>:
> 18: 38 60 00 20 li r3,32
> 1c: 4e 80 00 20 blr
That is because rs6000 has
/* The cntlzw and cntlzd instructions return 32 and 64 for input of zero. */
#define CLZ_DEFINED_VALUE_AT_ZERO(MODE, VALUE) \
((VALUE) = GET_MODE_BITSIZE (MODE), 2)
This says that at RTL level and in the optabs, clz of 0 *is* defined,
for rs6000. But the builtin is not valid with an arg of 0!
More information about the Gcc-bugs
mailing list