summaryrefslogtreecommitdiff
path: root/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
commitad16ddeb8e07a259d17ef203c9f443f816f6ae7b (patch)
tree90a4f3fbeb4cd4f8249f531355530161cfa54b27 /lib/Target/Mips/MipsSEISelLowering.cpp
parent421dcc59212a73b82141caa2c94ea340a7b34deb (diff)
downloadllvm-ad16ddeb8e07a259d17ef203c9f443f816f6ae7b.tar.gz
llvm-ad16ddeb8e07a259d17ef203c9f443f816f6ae7b.tar.bz2
llvm-ad16ddeb8e07a259d17ef203c9f443f816f6ae7b.tar.xz
[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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@191297 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/Mips/MipsSEISelLowering.cpp')
-rw-r--r--lib/Target/Mips/MipsSEISelLowering.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/Target/Mips/MipsSEISelLowering.cpp b/lib/Target/Mips/MipsSEISelLowering.cpp
index 30774540ee..1575cdef2d 100644
--- a/lib/Target/Mips/MipsSEISelLowering.cpp
+++ b/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();
}