diff options
author | Chris Lattner <sabre@nondot.org> | 2005-12-21 02:43:26 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2005-12-21 02:43:26 +0000 |
commit | 803a575616d1d95f9ae6116b3b4c39becb93b9dd (patch) | |
tree | bf4272f160fad4356d734e4a368d7e4cf58ccbcb /llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp | |
parent | a2f308fc3ed449134300da5a32bc3919d12d1f2b (diff) | |
download | bcm5719-llvm-803a575616d1d95f9ae6116b3b4c39becb93b9dd.tar.gz bcm5719-llvm-803a575616d1d95f9ae6116b3b4c39becb93b9dd.zip |
Lower ConstantAggregateZero into zeros
llvm-svn: 24890
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp')
-rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp | 27 |
1 files changed, 20 insertions, 7 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp index e6a0913a9b5..d75e5013d55 100644 --- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp @@ -306,16 +306,29 @@ public: // Constant or ConstantFP node onto the ops list for each element of // the packed constant. std::vector<SDOperand> Ops; - for (unsigned i = 0; i < NumElements; ++i) { - const Constant *CEl = C->getOperand(i); + if (ConstantPacked *CP = dyn_cast<ConstantPacked>(C)) { + if (MVT::isFloatingPoint(PVT)) { + for (unsigned i = 0; i != NumElements; ++i) { + const ConstantFP *El = cast<ConstantFP>(CP->getOperand(i)); + Ops.push_back(DAG.getConstantFP(El->getValue(), PVT)); + } + } else { + for (unsigned i = 0; i != NumElements; ++i) { + const ConstantIntegral *El = + cast<ConstantIntegral>(CP->getOperand(i)); + Ops.push_back(DAG.getConstant(El->getRawValue(), PVT)); + } + } + } else { + assert(isa<ConstantAggregateZero>(C) && "Unknown packed constant!"); + SDOperand Op; if (MVT::isFloatingPoint(PVT)) - Ops.push_back(DAG.getConstantFP(cast<ConstantFP>(CEl)->getValue(), - PVT)); + Op = DAG.getConstantFP(0, PVT); else - Ops.push_back( - DAG.getConstant(cast<ConstantIntegral>(CEl)->getRawValue(), - PVT)); + Op = DAG.getConstant(0, PVT); + Ops.assign(NumElements, Op); } + // Handle the case where we have a 1-element vector, in which // case we want to immediately turn it into a scalar constant. if (Ops.size() == 1) { |