This patch adds support for cttz and ctpop intrinsics in ConstantRange. It calculates the range in O(1) with the LCP-based method.
Diff Detail
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Comment Actions
If it's not possible to have efficient precise implementations for these, please just use simple approximations like this:
ConstantRange ConstantRange::ctpop() const { if (isEmptySet()) return getEmpty(); KnownBits Known = toKnownBits(); return getNonEmpty(APInt(getBitWidth(), Known.countMinPopulation()), APInt(getBitWidth(), Known.countMaxPopulation() + 1)); }
I'm not willing to have linear time ConstantRange methods.
Comment Actions
- Rebase
- Do range minimum/maximum query in O(1) for cttz and ctpop
I will add more detailed comments later if the time complexity is acceptable.