Skip to content

Commit ea9df09

Browse files
committed
[X86] concat(permv3(x0,m0,y0),permv3(x0,m1,y0)) -> permv3(concat(x0,u),m3,concat(y0,u))
Reference the lowest subvector if higher subvectors match - this often occurs in length changing shuffles. Fixes #103564
1 parent 85c79d6 commit ea9df09

File tree

6 files changed

+534
-644
lines changed

6 files changed

+534
-644
lines changed

llvm/lib/Target/X86/X86ISelLowering.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56382,8 +56382,12 @@ static SDValue combineConcatVectorOps(const SDLoc &DL, MVT VT,
5638256382
break;
5638356383
for (int M : SubMask) {
5638456384
if (0 <= M) {
56385+
int Src = M < NumSrcElts ? 0 : 2;
5638556386
M += M < NumSrcElts ? 0 : NumSrcElts;
56386-
M += i * NumSrcElts;
56387+
56388+
// Reference the lowest sub if they upper sub is the same.
56389+
if (Ops[0].getOperand(Src) != Ops[i].getOperand(Src))
56390+
M += i * NumSrcElts;
5638756391
}
5638856392
ConcatMask.push_back(M);
5638956393
}

0 commit comments

Comments
 (0)