[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp

Chris Lattner lattner at cs.uiuc.edu
Tue Dec 20 18:43:38 PST 2005



Changes in directory llvm/lib/CodeGen/SelectionDAG:

SelectionDAGISel.cpp updated: 1.117 -> 1.118
---
Log message:

Lower ConstantAggregateZero into zeros


---
Diffs of the changes:  (+20 -7)

 SelectionDAGISel.cpp |   27 ++++++++++++++++++++-------
 1 files changed, 20 insertions(+), 7 deletions(-)


Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.117 llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.118
--- llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.117	Fri Dec 16 16:45:28 2005
+++ llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp	Tue Dec 20 20:43:26 2005
@@ -306,16 +306,29 @@
         // 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) {






More information about the llvm-commits mailing list