Allow CONCAT_VECTORS nodes to be legal or have custom lowering for some targets.

Changes to take advantage of this will come later.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70560 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Bob Wilson 2009-05-01 17:55:32 +00:00
parent cf5ab82022
commit 5ee24e54d7
2 changed files with 38 additions and 14 deletions

View File

@ -1750,6 +1750,25 @@ SDValue SelectionDAGLegalize::LegalizeOp(SDValue Op) {
break; break;
case ISD::CONCAT_VECTORS: { case ISD::CONCAT_VECTORS: {
// Legalize the operands.
SmallVector<SDValue, 8> Ops;
for (unsigned i = 0, e = Node->getNumOperands(); i != e; ++i)
Ops.push_back(LegalizeOp(Node->getOperand(i)));
Result = DAG.UpdateNodeOperands(Result, &Ops[0], Ops.size());
switch (TLI.getOperationAction(ISD::CONCAT_VECTORS,
Node->getValueType(0))) {
default: assert(0 && "Unknown operation action!");
case TargetLowering::Legal:
break;
case TargetLowering::Custom:
Tmp3 = TLI.LowerOperation(Result, DAG);
if (Tmp3.getNode()) {
Result = Tmp3;
break;
}
// FALLTHROUGH
case TargetLowering::Expand: {
// Use extract/insert/build vector for now. We might try to be // Use extract/insert/build vector for now. We might try to be
// more clever later. // more clever later.
MVT PtrVT = TLI.getPointerTy(); MVT PtrVT = TLI.getPointerTy();
@ -1765,9 +1784,13 @@ SDValue SelectionDAGLegalize::LegalizeOp(SDValue Op) {
DAG.getConstant(j, PtrVT))); DAG.getConstant(j, PtrVT)));
} }
} }
return LegalizeOp(DAG.getNode(ISD::BUILD_VECTOR, dl, Node->getValueType(0), return LegalizeOp(DAG.getNode(ISD::BUILD_VECTOR, dl,
Node->getValueType(0),
&Ops[0], Ops.size())); &Ops[0], Ops.size()));
} }
}
break;
}
case ISD::CALLSEQ_START: { case ISD::CALLSEQ_START: {
SDNode *CallEnd = FindCallEndFromCallStart(Node); SDNode *CallEnd = FindCallEndFromCallStart(Node);

View File

@ -443,6 +443,7 @@ TargetLowering::TargetLowering(TargetMachine &tm)
// These operations default to expand. // These operations default to expand.
setOperationAction(ISD::FGETSIGN, (MVT::SimpleValueType)VT, Expand); setOperationAction(ISD::FGETSIGN, (MVT::SimpleValueType)VT, Expand);
setOperationAction(ISD::CONCAT_VECTORS, (MVT::SimpleValueType)VT, Expand);
} }
// Most targets ignore the @llvm.prefetch intrinsic. // Most targets ignore the @llvm.prefetch intrinsic.