Skip to content

Commit

Permalink
[X86] combineConcatVectorOps - fold 512-bit concat(blendi(x,y,c0),ble…
Browse files Browse the repository at this point in the history
…ndi(z,w,c1)) to AVX512BW mask select

Yet another yak shaving regression fix for #73509
  • Loading branch information
RKSimon committed Jan 3, 2024
1 parent 0408a85 commit 1d27669
Show file tree
Hide file tree
Showing 2 changed files with 281 additions and 125 deletions.
13 changes: 13 additions & 0 deletions llvm/lib/Target/X86/X86ISelLowering.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55015,6 +55015,19 @@ static SDValue combineConcatVectorOps(const SDLoc &DL, MVT VT,
ConcatSubOperand(VT, Ops, 1), Op0.getOperand(2));
}
break;
case X86ISD::BLENDI:
if (NumOps == 2 && VT.is512BitVector() && Subtarget.useBWIRegs()) {
uint64_t Mask0 = Ops[0].getConstantOperandVal(2);
uint64_t Mask1 = Ops[1].getConstantOperandVal(2);
uint64_t Mask = (Mask1 << (VT.getVectorNumElements() / 2)) | Mask0;
MVT MaskSVT = MVT::getIntegerVT(VT.getVectorNumElements());
MVT MaskVT = MVT::getVectorVT(MVT::i1, VT.getVectorNumElements());
SDValue Sel =
DAG.getBitcast(MaskVT, DAG.getConstant(Mask, DL, MaskSVT));
return DAG.getSelect(DL, VT, Sel, ConcatSubOperand(VT, Ops, 1),
ConcatSubOperand(VT, Ops, 0));
}
break;
case ISD::VSELECT:
if (!IsSplat && Subtarget.hasAVX512() &&
(VT.is256BitVector() ||
Expand Down

0 comments on commit 1d27669

Please sign in to comment.