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 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