[PATCH] D105879: Refine logic of MaskedElementsAreZero
Simon Pilgrim via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 14 02:15:05 PDT 2021
RKSimon added inline comments.
================
Comment at: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:2450
- APInt DemandedBits = APInt::getAllOnesValue(BitWidth);
- return MaskedValueIsZero(Op, DemandedBits, DemandedElts, Depth);
}
----------------
xiangzhangllvm wrote:
> > it just analyses the common bits of all the vector elements specified in the DemandedElts mask
> Thanks for your explain, in fact, I read the computeKnownBits code yesterday, it makes me a lot of puzzle. I thought here the DemandedBits should have the same BitWidth with Op (e.g. 128 for V16xi8)
>
>
> Let me take a example:
> So, if the Op is type V16xi8, and the DemandedElts is 0x2222 (16 bits, demanded index is 1, 5, 9, 13), you mean computeKnownBits will return the common zeros/ones of Op's elements with index 1, 5, 9, 13 ? ( zeros/ones = element1 & element5 & element9 & element13).
Yes the KnownBits result is the common bits in those demanded elements - if any are set differently or unknown in any element then the KnownBits result doesn't 'know' that bit.
If you have a usecase for a 'computeAllKnownBits' style wrapper that returns the known bits for each element (either as an array of KnownBits or a concatenated KnownBits struct) then it'd be definitely worth a patch along with suitable test coverage.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D105879/new/
https://reviews.llvm.org/D105879
More information about the llvm-commits
mailing list