On 7/14/2026 2:50 AM, Eikansh Gupta wrote:
> 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).
>
>       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.c: New test.
>
> Signed-off-by: Eikansh Gupta <[email protected]>
I originally thought the IFN pattern got the wrong answer in the case 
where one argument triggers a fallback to a value like 0.  But you've 
guarded against that class of cases.

Just needs the usual bootstrap & regression test on one of the major 
targets and you can commit it.  If you already did the bootstrap & 
regression test and just forgot to mention it, then no need to do it 
again, you can just push it.

Thanks!
Jeff

Reply via email to