[llvm] [KnownBits][SelectionDAG] Add KnownBits::clmul. Support trailing bits. NFC (PR #177517)
Jay Foad via llvm-commits
llvm-commits at lists.llvm.org
Fri Jan 23 00:55:38 PST 2026
================
@@ -602,6 +602,41 @@ KnownBits KnownBits::ashr(const KnownBits &LHS, const KnownBits &RHS,
return Known;
}
+KnownBits KnownBits::clmul(const KnownBits &LHS, const KnownBits &RHS) {
+ unsigned BitWidth = LHS.getBitWidth();
+
+ // An m*n result will always fit in m+n-1 bits since there are no carries.
+ unsigned ActiveBits = std::min(
+ BitWidth, LHS.countMaxActiveBits() + RHS.countMaxActiveBits() - 1);
----------------
jayfoad wrote:
Should handle the special case where m or n is 0, the result also fits in 0 bits. Otherwise if they are both 0 you will get underflow here and end up with ActiveBits = -1u.
https://github.com/llvm/llvm-project/pull/177517
More information about the llvm-commits
mailing list