mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2026-04-26 12:20:42 +00:00
Teach the DAGCombiner how to fold concat_vector nodes when the input is two
BUILD_VECTOR nodes, e.g.: (concat_vectors (BUILD_VECTOR a1, a2, a3, a4), (BUILD_VECTOR b1, b2, b3, b4)) -> (BUILD_VECTOR a1, a2, a3, a4, b1, b2, b3, b4) This fixes an issue with AVX, where a sequence was not recognized as a 256-bit vbroadcast due to the concat_vectors. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@201158 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -10136,6 +10136,26 @@ SDValue DAGCombiner::visitCONCAT_VECTORS(SDNode *N) {
|
||||
}
|
||||
}
|
||||
|
||||
// fold (concat_vectors (BUILD_VECTOR A, B, ...), (BUILD_VECTOR C, D, ...))
|
||||
// -> (BUILD_VECTOR A, B, ..., C, D, ...)
|
||||
if (N->getNumOperands() == 2 &&
|
||||
N->getOperand(0).getOpcode() == ISD::BUILD_VECTOR &&
|
||||
N->getOperand(1).getOpcode() == ISD::BUILD_VECTOR) {
|
||||
EVT VT = N->getValueType(0);
|
||||
SDValue N0 = N->getOperand(0);
|
||||
SDValue N1 = N->getOperand(1);
|
||||
SmallVector<SDValue, 8> Opnds;
|
||||
unsigned BuildVecNumElts = N0.getNumOperands();
|
||||
|
||||
for (unsigned i = 0; i != BuildVecNumElts; ++i)
|
||||
Opnds.push_back(N0.getOperand(i));
|
||||
for (unsigned i = 0; i != BuildVecNumElts; ++i)
|
||||
Opnds.push_back(N1.getOperand(i));
|
||||
|
||||
return DAG.getNode(ISD::BUILD_VECTOR, SDLoc(N), VT, &Opnds[0],
|
||||
Opnds.size());
|
||||
}
|
||||
|
||||
// Type legalization of vectors and DAG canonicalization of SHUFFLE_VECTOR
|
||||
// nodes often generate nop CONCAT_VECTOR nodes.
|
||||
// Scan the CONCAT_VECTOR operands and look for a CONCAT operations that
|
||||
|
||||
Reference in New Issue
Block a user