Add support for promoting stores from one legal type to another, allowing us
authorChris Lattner <sabre@nondot.org>
Sun, 16 Apr 2006 01:36:45 +0000 (01:36 +0000)
committerChris Lattner <sabre@nondot.org>
Sun, 16 Apr 2006 01:36:45 +0000 (01:36 +0000)
to write one pattern for vector stores instead of 4.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@27730 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/SelectionDAG/LegalizeDAG.cpp

index 9b2d5508b71f316f6f849b1595ae7f905abc0906..7cf71418fa77446f144573dc34ee913ee39474d4 100644 (file)
@@ -1544,6 +1544,13 @@ SDOperand SelectionDAGLegalize::LegalizeOp(SDOperand Op) {
         Tmp1 = TLI.LowerOperation(Result, DAG);
         if (Tmp1.Val) Result = Tmp1;
         break;
+      case TargetLowering::Promote:
+        assert(MVT::isVector(VT) && "Unknown legal promote case!");
+        Tmp3 = DAG.getNode(ISD::BIT_CONVERT, 
+                           TLI.getTypeToPromoteTo(ISD::STORE, VT), Tmp3);
+        Result = DAG.UpdateNodeOperands(Result, Tmp1, Tmp3, Tmp2, 
+                                        Node->getOperand(3));
+        break;
       }
       break;
     }
@@ -1576,6 +1583,7 @@ SDOperand SelectionDAGLegalize::LegalizeOp(SDOperand Op) {
           Tmp3 = PackVectorOp(Node->getOperand(1), TVT);
           Result = DAG.UpdateNodeOperands(Result, Tmp1, Tmp3, Tmp2, 
                                           Node->getOperand(3));
+          Result = LegalizeOp(Result);
           break;
         } else if (NumElems == 1) {
           // Turn this into a normal store of the scalar type.