https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120032
--- Comment #5 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Richard Biener <rgue...@gcc.gnu.org>: https://gcc.gnu.org/g:c6eb92973ea308e248ce23927a9ac58ef81ee7a2 commit r16-1201-gc6eb92973ea308e248ce23927a9ac58ef81ee7a2 Author: Richard Biener <rguent...@suse.de> Date: Wed May 28 15:09:19 2025 +0200 tree-optimization/120032 - matching of table based CLZ The following adds the ability to match a table based CLZ implementation similar as to how we can do for CTZ. I'm re-using the workers for matching up array and string tables by using a lambda and templates and kept the transform step for CLZ/CTZ inter-mangled. PR tree-optimization/120032 * match.pd (clz_table_index): New match. * tree-ssa-forwprop.cc (check_table_array): Rename from check_ctz_array. Split out actual verification to a functor. (check_table_string): Rename from check_ctz_string and likewise. (check_table): Rename from check_ctz_table and adjust. (gimple_clz_table_index): Declare. (simplify_count_zeroes): Rename from simplify_count_trailing_zeroes. Extend to cover CLZ. (pass_forwprop::execute): Adjust. * gcc.target/i386/pr120032-1.c: New testcase. * gcc.target/i386/pr120032-2.c: Likewise.