[libc-commits] [libc] [llvm] [llvm] Add KnownBits implementations for avgFloor and avgCeil (PR #86445)

Jay Foad via libc-commits libc-commits at lists.llvm.org
Fri May 17 09:18:54 PDT 2024


jayfoad wrote:

> > looks like the BinaryExhaustive test fails when I remove the bool flag to enable Optimal check?
> 
> Oh, I thought this implementation was supposed to be optimal, but maybe I got that wrong.

Having looked into it, the unsigned functions are optimal. The signed ones are not because LHS/RHS.sext(BitWidth + 1) does not preserve the knowledge that the top two bits are the same.

We can look into improving that later. For now, it's fine to commit the patch with optimality checking removed.

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


More information about the libc-commits mailing list