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 | 07890bbec4a8949be67e487bab91dda3e9e712e6 (patch) | |
tree | 83afb4bf8fd1f0e81f675174f52b70fa2168bb5e /llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp | |
parent | ac6cb46429075215285a23654b4e29801139774e (diff) | |
download | bcm5719-llvm-07890bbec4a8949be67e487bab91dda3e9e712e6.tar.gz bcm5719-llvm-07890bbec4a8949be67e487bab91dda3e9e712e6.zip |
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.
llvm-svn: 24482
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp')
-rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp | 30 |
1 files changed, 24 insertions, 6 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp index c025c2d4780..079b16b1f82 100644 --- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp +++ b/llvm/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))); |