summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorDuncan Sands <baldrick@free.fr>2008-07-14 17:32:02 +0000
committerDuncan Sands <baldrick@free.fr>2008-07-14 17:32:02 +0000
commita30cbd9797855fc2bef7b69c05a460871e024ebf (patch)
treeb9ca1fe638cb231c2a3c356f4f7d5d542352a779 /llvm/lib
parent693185bcee668afe6655aedd6865292ce724e2ed (diff)
downloadbcm5719-llvm-a30cbd9797855fc2bef7b69c05a460871e024ebf.tar.gz
bcm5719-llvm-a30cbd9797855fc2bef7b69c05a460871e024ebf.zip
An INSERT_VECTOR_ELT can insert a larger value
than the vector element type. Don't forget to handle this when the insertion index is not a constant. llvm-svn: 53556
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp b/llvm/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp
index 71fa7925c02..ea1c0a8c13e 100644
--- a/llvm/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp
@@ -360,13 +360,14 @@ void DAGTypeLegalizer::SplitVecRes_INSERT_VECTOR_ELT(SDNode *N, SDOperand &Lo,
// Spill the vector to the stack.
MVT VecVT = Vec.getValueType();
+ MVT EltVT = VecVT.getVectorElementType();
SDOperand StackPtr = DAG.CreateStackTemporary(VecVT);
SDOperand Store = DAG.getStore(DAG.getEntryNode(), Vec, StackPtr, NULL, 0);
- // Store the new element.
- SDOperand EltPtr = GetVectorElementPointer(StackPtr,
- VecVT.getVectorElementType(), Idx);
- Store = DAG.getStore(Store, Elt, EltPtr, NULL, 0);
+ // Store the new element. This may be larger than the vector element type,
+ // so use a truncating store.
+ SDOperand EltPtr = GetVectorElementPointer(StackPtr, EltVT, Idx);
+ Store = DAG.getTruncStore(Store, Elt, EltPtr, NULL, 0, EltVT);
// Reload the vector from the stack.
SDOperand Load = DAG.getLoad(VecVT, Store, StackPtr, NULL, 0);
OpenPOWER on IntegriCloud