[llvm] [ADT] Add fshl/fshr operations to APInt (PR #153790)

Chaitanya Koparkar via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 15 09:12:48 PDT 2025


================
@@ -3169,3 +3169,19 @@ APInt APIntOps::pow(const APInt &X, int64_t N) {
   }
   return Acc;
 }
+
+APInt llvm::APIntOps::fshl(const APInt &Hi, const APInt &Lo,
+                           const APInt &Shift) {
+  APInt BitWidth(
----------------
ckoparkar wrote:

@topperc I wrote it like this so that `BitWidth - Shift.urem(BitWidth)` remains an `APInt`, rather than `uint64_t`. In `rotateModulo`, bitwidth is only compared to another `unsigned`, which is why it doesn't need it perhaps? 

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


More information about the llvm-commits mailing list