https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107090
--- Comment #9 from Andrew Pinski <pinskia at gcc dot gnu.org> --- Look at how ctz_table_index is done and used. The matching is done in match.pd language and then inside simplify_count_trailing_zeroes (tree-ssa-forwprop.cc) it is used nop_atomic_bit_test_and_p is another example but that is more complex and is used inside tree-ssa-ccp.cc .