[Bug tree-optimization/95527] Failure to optimize __builtin_ffs == 0
jakub at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Mon Jun 8 16:47:42 GMT 2020
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.
More information about the Gcc-bugs
mailing list