https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94801
--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> --- In the source yes, but by the time the optimizer sees it on some targets x == 0 ? 32 : __builtin_clz (x) could have been already optimized into just __builtin_clz (x) depending on what the target macros say. /* __builtin_c[lt]z* return [0, prec-1], except for when the argument is 0, but that is undefined behavior. On many targets where the CLZ RTL or optab value is defined for 0 the value is prec, so include that in the range by default. */