[llvm] [InstCombine][X86] Fold blendv(x, y, shuffle(bitcast(sext(m)))) -> select(shuffle(m),x,y) (PR #96882)
via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 3 00:17:11 PDT 2024
================
@@ -2800,6 +2800,23 @@ X86TTIImpl::instCombineIntrinsic(InstCombiner &IC, IntrinsicInst &II) const {
return SelectInst::Create(NewSelector, Op1, Op0, "blendv");
}
+ // Peek through a one-use shuffle - VectorCombine should have simplified
+ // this for cases where we're splitting wider vectors to use blendv
+ // intrinsics.
+ Value *MaskSrc = nullptr;
+ ArrayRef<int> ShuffleMask;
+ if (match(Mask, PatternMatch::m_OneUse(PatternMatch::m_Shuffle(
+ PatternMatch::m_Value(MaskSrc), PatternMatch::m_Undef(),
+ PatternMatch::m_Mask(ShuffleMask))))) {
----------------
goldsteinn wrote:
nit: We should probably just start using `PatternMatch` namespace at the top of the function. That can be a later NFC though.
https://github.com/llvm/llvm-project/pull/96882
More information about the llvm-commits
mailing list