https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104376
--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> --- The second issue can be seen with: #include <stdint.h> uint32_t countLeadingZeros32(uint32_t x) { if (x == 0) return 32; return (__builtin_clz(x)) ; } This gets optimized for aarch64 at the rtl level but not for x86_64 with -mlzcnt.