diff options
author | Chris Lattner <sabre@nondot.org> | 2006-03-19 01:17:20 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2006-03-19 01:17:20 +0000 |
commit | 2332b9f16fe17d1886566729b2241b8cd90f9916 (patch) | |
tree | 3413206ffae4a306b7dd7fa32942d5a8c75b1fa2 /lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp | |
parent | a064d28843b425905ed981e693b7730a183ee31b (diff) |
implement basic support for INSERT_VECTOR_ELT.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@26849 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp')
-rw-r--r-- | lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp | 26 |
1 files changed, 4 insertions, 22 deletions
diff --git a/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp b/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp index 960247298b..4107479bb5 100644 --- a/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp +++ b/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp @@ -842,33 +842,15 @@ void SelectionDAGLowering::visitCast(User &I) { } void SelectionDAGLowering::visitInsertElement(InsertElementInst &I) { - const PackedType *Ty = cast<PackedType>(I.getType()); - unsigned NumElements = Ty->getNumElements(); - MVT::ValueType PVT = TLI.getValueType(Ty->getElementType()); - MVT::ValueType TVT = MVT::getVectorType(PVT, NumElements); - SDOperand InVec = getValue(I.getOperand(0)); SDOperand InVal = getValue(I.getOperand(1)); SDOperand InIdx = DAG.getNode(ISD::ZERO_EXTEND, TLI.getPointerTy(), getValue(I.getOperand(2))); - // Immediately scalarize packed types containing only one element, so that - // the Legalize pass does not have to deal with them. Similarly, if the - // abstract vector is going to turn into one that the target natively - // supports, generate that type now so that Legalize doesn't have to deal - // with that either. These steps ensure that Legalize only has to handle - // vector types in its Expand case. - if (NumElements == 1) { - setValue(&I, InVal); // Must be insertelt(Vec, InVal, 0) -> InVal - } else if (TVT != MVT::Other && TLI.isTypeLegal(TVT) && - TLI.isOperationLegal(ISD::INSERT_VECTOR_ELT, TVT)) { - setValue(&I, DAG.getNode(ISD::INSERT_VECTOR_ELT, TVT, InVec, InVal, InIdx)); - } else { - SDOperand Num = DAG.getConstant(NumElements, MVT::i32); - SDOperand Typ = DAG.getValueType(PVT); - setValue(&I, DAG.getNode(ISD::VINSERT_VECTOR_ELT, MVT::Vector, - InVec, InVal, InIdx, Num, Typ)); - } + SDOperand Num = *(InVec.Val->op_end()-2); + SDOperand Typ = *(InVec.Val->op_end()-1); + setValue(&I, DAG.getNode(ISD::VINSERT_VECTOR_ELT, MVT::Vector, + InVec, InVal, InIdx, Num, Typ)); } |