[llvm-commits] [llvm] r133382 - /llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
Nadav Rotem
nadav.rotem at intel.com
Sun Jun 19 01:49:38 PDT 2011
Author: nadav
Date: Sun Jun 19 03:49:38 2011
New Revision: 133382
URL: http://llvm.org/viewvc/llvm-project?rev=133382&view=rev
Log:
When promoting the vector elements in CopyToParts, use vector trunc
instead of scalarizing, and doing an element-by-element truncat.
Modified:
llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp?rev=133382&r1=133381&r2=133382&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp Sun Jun 19 03:49:38 2011
@@ -475,17 +475,9 @@
PartVT.getVectorNumElements() == ValueVT.getVectorNumElements()) {
// Promoted vector extract
- unsigned NumElts = ValueVT.getVectorNumElements();
- SmallVector<SDValue, 8> NewOps;
- for (unsigned i = 0; i < NumElts; ++i) {
- SDValue Ext = DAG.getNode(ISD::EXTRACT_VECTOR_ELT, DL,
- ValueVT.getScalarType(), Val ,DAG.getIntPtrConstant(i));
- SDValue Cast = DAG.getNode(ISD::ANY_EXTEND,
- DL, PartVT.getScalarType(), Ext);
- NewOps.push_back(Cast);
- }
- Val = DAG.getNode(ISD::BUILD_VECTOR, DL, PartVT,
- &NewOps[0], NewOps.size());
+ bool Smaller = PartVT.bitsLE(ValueVT);
+ Val = DAG.getNode((Smaller ? ISD::TRUNCATE : ISD::ANY_EXTEND),
+ DL, PartVT, Val);
} else{
// Vector -> scalar conversion.
assert(ValueVT.getVectorNumElements() == 1 &&
More information about the llvm-commits
mailing list