https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122615

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Harald van Dijk from comment #1)
> f0 would only be valid to optimise if a is somehow known to only contain a
> single bit: consider e.g. f0(1, 3) where it would produce incorrect results.

Oh right. 

I noticed that LLVM does not handle this then:
```
int f(int x, int a)
{
  a = a&-a;
  return x&a ? (x&~a): (x|a);
}
```
where a here is definitely have a pop count of 1 at the conditional.

Reply via email to