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

Jay Foad via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 9 03:48:34 PDT 2026


jayfoad 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?

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


More information about the llvm-commits mailing list