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

Chaitanya Koparkar via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 20 01:15:25 PDT 2025


================
@@ -2410,6 +2410,33 @@ LLVM_ABI std::optional<unsigned> GetMostSignificantDifferentBit(const APInt &A,
 /// A.getBitwidth() or NewBitWidth must be a whole multiples of the other.
 LLVM_ABI APInt ScaleBitMask(const APInt &A, unsigned NewBitWidth,
                             bool MatchAllBits = false);
+
+/// Perform a funnel shift left.
+///
+/// Concatenate Hi and Lo (Hi is the most significant bits of the wide value),
+/// the combined value is shifted left by Shift, and the most significant bits
+/// are extracted to produce a result that is the same size as the original
+/// arguments.
+///
+/// Examples:
+/// (1) fshl(i8 255, i8 0, i8 15) = 128 (0b10000000)
----------------
ckoparkar wrote:

I've adjusted the wording.

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


More information about the llvm-commits mailing list