https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90838
--- Comment #13 from Andrew Pinski <pinskia at gcc dot gnu.org> --- (In reply to Gabriel Ravier from comment #12) > It appears this new optimization is non-functional on trunk with x86-64... > specifically on x86-64, too, on AArch64 it works just fine. So does that > mean this bug should be re-opened or should a new bug be opened for that ? It does work with -mbmi where the instruction which is used has a defined value at 0. You can open a new issue for improvement of the case for not supplying -mbmi . That is CTZ_DEFINED_VALUE_AT_ZERO is non-2.