[llvm] [GlobalISel] Add G_ROTL/G_ROTR to computeNumSignBits (PR #213364)
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 4 01:19:50 PDT 2026
================
@@ -485,6 +485,12 @@ struct KnownBits {
/// Compute known bits for pdep(Val, Mask).
LLVM_ABI static KnownBits pdep(const KnownBits &Val, const KnownBits &Mask);
+ /// Compute the number of sign bits after rotating a value.
+ LLVM_ABI static unsigned rotateNumSignBits(unsigned SrcSignBits,
+ unsigned BitWidth,
+ std::optional<uint64_t> RotAmt,
+ bool IsRotateRight);
----------------
RKSimon wrote:
Do we have enough likely helpers (sharable SignBits code from ValueTracking/SelectionDAG/GISel) for it to be worth creating a llvm/Support/SignBits.h? I'm not convinced we need a SignBits struct, but a llvm::SignBitsOps namespace (similar to llvm::APIntOps) might be worth it if we have enough cases which aren't just the minimum signbits of the operands.....
@arsenm @nikic wdyt?
https://github.com/llvm/llvm-project/pull/213364
More information about the llvm-commits
mailing list