On 7/12/23 15:15, Aldy Hernandez via Gcc-patches wrote:
This patch teaches popcount about known set bits which are now
available in the irange.

        PR tree-optimization/107053

gcc/ChangeLog:

        * gimple-range-op.cc (cfn_popcount): Use known set bits.

gcc/testsuite/ChangeLog:

        * gcc.dg/tree-ssa/pr107053.c: New test.
You could probably play similar games with ctz/clz, though it's hard to know if it's worth the effort.

One way to find out might be to build jemalloc which uses those idioms heavily. Similarly for deepsjeng from spec2017.

Jeff

Reply via email to