[llvm] [ADT] Add fshl/fshr operations to APInt (PR #153790)
Jakub Kuderski via llvm-commits
llvm-commits at lists.llvm.org
Sat Aug 16 07:06:38 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)
----------------
kuhar wrote:
What happens when the shift amount is larger than the bitwidth?
For example: `fshl(255, 255, 17)`?
https://github.com/llvm/llvm-project/pull/153790
More information about the llvm-commits
mailing list