https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95527
--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> --- Created attachment 48705 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=48705&action=edit gcc11-pr95527.patch Untested fix for ffs. Haven't touched others. I think parity can't be optimized that way, for ctz/clz we'd need to decide how do we deal with the undefined at zero fact (vs. e.g. the aarch64 clz/ctz defined already at GIMPLE to a particular value through *_DEFINED_VALUE_AT_ZERO giving 2). __builtin_popcount (x) == 0 (and != 0) should be easy, but for that one not sure if we can optimize much more than that.