[Bug tree-optimization/123311] Min(clz(a), clz(b))->clz(a|b) likewise for ctz
cvs-commit at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Thu Jul 30 08:06:51 GMT 2026
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=123311
--- Comment #1 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Eikansh Gupta <eikansh@gcc.gnu.org>:
https://gcc.gnu.org/g:1743c12e3512bff3c9688dff7bba5b2ac43cd9d5
commit r17-2815-g1743c12e3512bff3c9688dff7bba5b2ac43cd9d5
Author: Eikansh Gupta <eikansh.gupta@oss.qualcomm.com>
Date: Tue May 19 12:20:54 2026 +0530
MATCH: Simplify min of clz/ctz to clz/ctz of bitwise or [PR123311]
This adds match.pd simplifications for min(clz(x), clz(y)) and
min(ctz(x), ctz(y)) to clz(x | y) and ctz(x | y).
Bootstrapped and tested on aarch64-linux-gnu and x86_64-linux-gnu.
PR tree-optimization/123311
gcc/ChangeLog:
* match.pd (min(clz(x), clz(y)) -> clz(x | y)): New pattern.
(min(ctz(x), ctz(y)) -> ctz(x | y)): Likewise.
gcc/testsuite/ChangeLog:
* gcc.dg/tree-ssa/pr123311-1.c: New test.
* gcc.dg/tree-ssa/pr123311-2.c: New test.
Signed-off-by: Eikansh Gupta <eikansh.gupta@oss.qualcomm.com>
More information about the Gcc-bugs
mailing list