On Sun, Jan 4, 2026 at 11:32 AM Jeffrey Law
<[email protected]> wrote:
>
>
>
> On 12/30/2025 2:34 PM, Daniel Barboza wrote:
> >          PR 102486
> >
> > gcc/ChangeLog:
> >
> >           * match.pd (`popcount (X & -X) -> (X & -X) != 0`): New pattern.
> >
> > gcc/testsuite/ChangeLog:
> >
> >       * gcc.dg/tree-ssa/pr102486.c: New test.
> So isn't it transformed into "X != 0" rather than "(X & -X) != 0)"?
> Which means the subject line and ChangeLog entry need minor updates.
> I'm not sure why Andrew suggested optimizing to (X & -X) != 0 since the
> X & -X is zero when X == 0 and nonzero when X != 0.

I don't remember why I suggested optimizing it to `(X & -X) != 0`
instead of just `X != 0`. The bug report was filed 4 years ago and I
can't find my notes for what I was looking at that time or why 2 years
later mentioned `(X&-X) != 0` either. But yes it should be to `X !=
0`.

Thanks,
Andrew

>
> I think Andrew also noted some additional type fixes that were needed in
> the new gimple you're generating.   So we probably need a V3 for that.
>
> Jeff

Reply via email to