[llvm] [DAG] foldShiftToAvg - recognize sub(x, xor(y, -1)) >> 1 as avgceil[su] (PR #182616)

via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 9 11:46:35 PDT 2026


laurenmchin wrote:

> > Extends foldShiftToAvg to match:
> > 
> > * (sra (sub x, (xor y, -1)), 1) -> avgceils(y, x)
> > * (srl (sub x, (xor y, -1)), 1) -> avgceilu(y, x)
> 
> Can you show Alive2 proofs for these?

Yes, I’ll provide Alive2 proofs for these transforms after my exam this week. Thanks for taking a look.

https://github.com/llvm/llvm-project/pull/182616


More information about the llvm-commits mailing list