[llvm] [ADT] Add fshl/fshr operations to APInt (PR #153790)
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 20 21:54:52 PDT 2025
================
@@ -3169,3 +3169,21 @@ APInt APIntOps::pow(const APInt &X, int64_t N) {
}
return Acc;
}
+
+APInt llvm::APIntOps::fshl(const APInt &Hi, const APInt &Lo,
+ const APInt &Shift) {
+ assert(Hi.getBitWidth() == Lo.getBitWidth());
+ unsigned ShiftAmt = rotateModulo(Hi.getBitWidth(), Shift);
+ if (ShiftAmt == 0)
+ return Hi;
+ return APInt(Hi.shl(ShiftAmt) | Lo.lshr(Hi.getBitWidth() - ShiftAmt));
----------------
topperc wrote:
Why do we need the outer `APInt` constructor call?
https://github.com/llvm/llvm-project/pull/153790
More information about the llvm-commits
mailing list