Changes in directory llvm/lib/CodeGen/SelectionDAG:
LegalizeDAG.cpp updated: 1.342 -> 1.343 --- Log message: Expand INSERT_VECTOR_ELT to store vec, sp; store elt, sp+k; vec = load sp; --- Diffs of the changes: (+24 -1) LegalizeDAG.cpp | 25 ++++++++++++++++++++++++- 1 files changed, 24 insertions(+), 1 deletion(-) Index: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.342 llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.343 --- llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.342 Tue Mar 28 14:24:43 2006 +++ llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Thu Mar 30 19:27:51 2006 @@ -798,7 +798,30 @@ // with a "move to register" or "extload into register" instruction, then // permute it into place, if the idx is a constant and if the idx is // supported by the target. - assert(0 && "INSERT_VECTOR_ELT expand not supported yet!"); + SDOperand StackPtr = CreateStackTemporary(Tmp1.getValueType()); + // Store the vector. + SDOperand Ch = DAG.getNode(ISD::STORE, MVT::Other, DAG.getEntryNode(), + Tmp1, StackPtr, DAG.getSrcValue(NULL)); + + // Truncate or zero extend offset to target pointer type. + MVT::ValueType IntPtr = TLI.getPointerTy(); + if (Tmp3.getValueType() > IntPtr) + Tmp3 = DAG.getNode(ISD::TRUNCATE, IntPtr, Tmp3); + else + Tmp3 = DAG.getNode(ISD::ZERO_EXTEND, IntPtr, Tmp3); + + // Add the offset to the index. + unsigned EltSize = MVT::getSizeInBits(Result.getValueType())/8; + Tmp3 = DAG.getNode(ISD::MUL, Tmp3.getValueType(), Tmp3, + DAG.getConstant(EltSize, Tmp3.getValueType())); + SDOperand StackPtr2 = + DAG.getNode(ISD::ADD, Tmp3.getValueType(), Tmp3, StackPtr); + // Store the scalar value. + Ch = DAG.getNode(ISD::STORE, MVT::Other, Ch, + Tmp2, StackPtr2, DAG.getSrcValue(NULL)); + // Load the updated vector. + Result = DAG.getLoad(Result.getValueType(), Ch, StackPtr, + DAG.getSrcValue(NULL)); break; } } _______________________________________________ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits