[llvm] [IA][RISCV] Recognizing gap masks assembled from bitwise AND (PR #153324)
Min-Yih Hsu via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 13 13:37:06 PDT 2025
================
@@ -601,6 +602,18 @@ static std::pair<Value *, APInt> getMask(Value *WideMask, unsigned Factor,
}
}
+ // Try to match `and <interleaved mask>, <gap mask>`. The WideMask here is
+ // expected to be a fixed vector and gap mask should be a constant mask.
+ Value *AndMaskLHS;
+ Constant *AndMaskRHS;
+ if (LeafValueEC.isFixed() &&
+ match(WideMask, m_c_And(m_Value(AndMaskLHS), m_Constant(AndMaskRHS)))) {
+ assert(!isa<Constant>(AndMaskLHS) &&
+ "expect constants to be folded already");
+ getGapMask(*AndMaskRHS, Factor, LeafValueEC.getFixedValue(), GapMask);
+ return {getMask(AndMaskLHS, Factor, LeafValueEC).first, GapMask};
----------------
mshockwave wrote:
> Constant folded by InstCombine or something in this pass?
InstCombine
https://github.com/llvm/llvm-project/pull/153324
More information about the llvm-commits
mailing list