summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/Mips/MipsSEISelLowering.cpp
diff options
context:
space:
mode:
authorDaniel Sanders <daniel.sanders@imgtec.com>2013-09-24 13:16:15 +0000
committerDaniel Sanders <daniel.sanders@imgtec.com>2013-09-24 13:16:15 +0000
commitf86622ba13088f7de65000a1884269822b1de3d3 (patch)
tree50518ee909ab499a62374171874c6a900433f145 /llvm/lib/Target/Mips/MipsSEISelLowering.cpp
parent4f3ff1b9e8c1e48f134de8dea355f4b89af0a39d (diff)
downloadbcm5719-llvm-f86622ba13088f7de65000a1884269822b1de3d3.tar.gz
bcm5719-llvm-f86622ba13088f7de65000a1884269822b1de3d3.zip
[mips][msa] Non-constant BUILD_VECTOR's should be expanded to INSERT_VECTOR_ELT instead of memory operations.
The resulting code is the same length, but doesnt cause memory traffic or latency. llvm-svn: 191297
Diffstat (limited to 'llvm/lib/Target/Mips/MipsSEISelLowering.cpp')
-rw-r--r--llvm/lib/Target/Mips/MipsSEISelLowering.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/llvm/lib/Target/Mips/MipsSEISelLowering.cpp b/llvm/lib/Target/Mips/MipsSEISelLowering.cpp
index 30774540eeb..1575cdef2d6 100644
--- a/llvm/lib/Target/Mips/MipsSEISelLowering.cpp
+++ b/llvm/lib/Target/Mips/MipsSEISelLowering.cpp
@@ -1668,6 +1668,23 @@ SDValue MipsSETargetLowering::lowerBUILD_VECTOR(SDValue Op,
}
else if (isSplatVector(Node))
return DAG.getNode(MipsISD::VSPLAT, DL, ResTy, Op->getOperand(0));
+ else {
+ // Use INSERT_VECTOR_ELT operations rather than expand to stores.
+ // The resulting code is the same length as the expansion, but it doesn't
+ // use memory operations
+ EVT ResTy = Node->getValueType(0);
+
+ assert(ResTy.isVector());
+
+ unsigned NumElts = ResTy.getVectorNumElements();
+ SDValue Vector = DAG.getUNDEF(ResTy);
+ for (unsigned i = 0; i < NumElts; ++i) {
+ Vector = DAG.getNode(ISD::INSERT_VECTOR_ELT, DL, ResTy, Vector,
+ Node->getOperand(i),
+ DAG.getConstant(i, MVT::i32));
+ }
+ return Vector;
+ }
return SDValue();
}
OpenPOWER on IntegriCloud