https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111280
Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jakub at gcc dot gnu.org --- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> --- Note, in PR111309 we briefly discussed adding __builtin_{clz,ctz,popcount,ffs,clrsb} builtin type-generic variants which would be well defined for clz/ctz cases. I think the best representation of that would be to lower those builtins (dunno what suffix to use for them yet) to .CLZ/.CTZ ifns with 2 arguments where the second argument would be the value to be returned if the first argument is zero. Then at expansion time we could compare that value against C?Z_VALUE_DEFINED_AT_ZERO, if it is the same, don't do anything special, otherwise add a test against 0.