[llvm] [APInt] Introduce carry-less multiply operation (PR #168527)

Yingwei Zheng via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 18 05:30:37 PST 2025


================
@@ -3187,3 +3187,11 @@ APInt llvm::APIntOps::fshr(const APInt &Hi, const APInt &Lo,
     return Lo;
   return Hi.shl(Hi.getBitWidth() - ShiftAmt) | Lo.lshr(ShiftAmt);
 }
+
+APInt llvm::APIntOps::clmul(const APInt &LHS, const APInt &RHS) {
+  assert(LHS.getBitWidth() == RHS.getBitWidth());
+  APInt Result(LHS.getBitWidth(), 0);
----------------
dtcxzyw wrote:

The high part is truncated. Do you plan to implement another helper to calculate the high part bits (See also RISC-V's clmulh)?

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


More information about the llvm-commits mailing list