diff options
author | Nate Begeman <natebegeman@mac.com> | 2005-11-22 01:29:36 +0000 |
---|---|---|
committer | Nate Begeman <natebegeman@mac.com> | 2005-11-22 01:29:36 +0000 |
commit | 4ef3b817fee7ea5be7219e00ab8e15976bfe279f (patch) | |
tree | 37dfe08135d61e46741caaf2a29f305f2fc3befa /lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp | |
parent | ac2902bcb5568c9a4ff8fe1bbe794f656498ff89 (diff) |
Rather than attempting to legalize 1 x float, make sure the SD ISel never
generates it. Make MVT::Vector expand-only, and remove the code in
Legalize that attempts to legalize it.
The plan for supporting N x Type is to continually epxand it in ExpandOp
until it gets down to 2 x Type, where it will be scalarized into a pair of
scalars.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@24482 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp')
-rw-r--r-- | lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp | 30 |
1 files changed, 24 insertions, 6 deletions
diff --git a/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp b/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp index c025c2d478..079b16b1f8 100644 --- a/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp +++ b/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp @@ -517,9 +517,19 @@ void SelectionDAGLowering::visitBinary(User &I, unsigned IntOp, unsigned FPOp, setValue(&I, DAG.getNode(FPOp, Op1.getValueType(), Op1, Op2)); } else { const PackedType *PTy = cast<PackedType>(Ty); - SDOperand Num = DAG.getConstant(PTy->getNumElements(), MVT::i32); - SDOperand Typ = DAG.getValueType(TLI.getValueType(PTy->getElementType())); - setValue(&I, DAG.getNode(VecOp, Op1.getValueType(), Num, Typ, Op1, Op2)); + unsigned NumElements = PTy->getNumElements(); + MVT::ValueType PVT = TLI.getValueType(PTy->getElementType()); + + // Immediately scalarize packed types containing only one element, so that + // the Legalize pass does not have to deal with them. + if (NumElements == 1) { + unsigned Opc = MVT::isFloatingPoint(PVT) ? FPOp : IntOp; + setValue(&I, DAG.getNode(Opc, PVT, Op1, Op2)); + } else { + SDOperand Num = DAG.getConstant(NumElements, MVT::i32); + SDOperand Typ = DAG.getValueType(PVT); + setValue(&I, DAG.getNode(VecOp, Op1.getValueType(), Num, Typ, Op1, Op2)); + } } } @@ -726,9 +736,17 @@ void SelectionDAGLowering::visitLoad(LoadInst &I) { if (Type::PackedTyID == Ty->getTypeID()) { const PackedType *PTy = cast<PackedType>(Ty); - L = DAG.getVecLoad(PTy->getNumElements(), - TLI.getValueType(PTy->getElementType()), Root, Ptr, - DAG.getSrcValue(I.getOperand(0))); + unsigned NumElements = PTy->getNumElements(); + MVT::ValueType PVT = TLI.getValueType(PTy->getElementType()); + + // Immediately scalarize packed types containing only one element, so that + // the Legalize pass does not have to deal with them. + if (NumElements == 1) { + L = DAG.getLoad(PVT, Root, Ptr, DAG.getSrcValue(I.getOperand(0))); + } else { + L = DAG.getVecLoad(NumElements, PVT, Root, Ptr, + DAG.getSrcValue(I.getOperand(0))); + } } else { L = DAG.getLoad(TLI.getValueType(Ty), Root, Ptr, DAG.getSrcValue(I.getOperand(0))); |