https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94787
--- Comment #6 from Andrew Pinski <pinskia at gcc dot gnu.org> --- (In reply to Andrew Pinski from comment #5) > Note the expansion part is handled by r14-5612, r14-5613, and r14-6940 . > > So now we just need the match part which I will handle for 15. Actually the expansion part is not fully complete. ``` int f(int a) { return __builtin_popcount(a) <= 1; } int f1(int a) { return __builtin_popcount(a) == 1; } ``` f1 is handled but f is not. f should expand to `!(v & (v - 1))`. The other match patterns needed: ``` int g(int a) { if (a == 0) return 0; return __builtin_popcount(a) <= 1; } int g1(int a) { if (a == 0) return 1; return __builtin_popcount(a) <= 1; } ``` g should be transformed into just `__builtin_popcount(a) == 1` and g1 should be transformed into just `__builtin_popcount(a) <= 1`. Both during phi-opt.