https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120032
--- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> --- I'll also note that as written the table-based lookup has a value of 31 for zero input but lzcnt will get you 32. So unless you make the input of zero undefined by guarding the code (thus provide a value-range for 'val'), we can't match those up unless emitting val == 0 ? 31 : clz(val). BMI has the value at zero undefined and thus would also require such a conditional.