[llvm] [ADT] Add fshl/fshr operations to APInt (PR #153790)
Jakub Kuderski via llvm-commits
llvm-commits at lists.llvm.org
Fri Aug 15 08:25:51 PDT 2025
================
@@ -2410,6 +2410,17 @@ 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.
+///
+/// fshl(X,Y,Z): (X << (Z % BW)) | (Y >> (BW - (Z % BW)))
+LLVM_ABI APInt fshl(const APInt &Hi, const APInt &Lo, const APInt &Shift);
+
+/// Perform a funnel shift right.
----------------
kuhar wrote:
Can you add some prose and examples to describe what these shifts do? The intention behind the math is difficult to parse without already knowing the semantics
https://github.com/llvm/llvm-project/pull/153790
More information about the llvm-commits
mailing list