diff options
-rw-r--r-- | lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp | 1 | ||||
-rw-r--r-- | lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp | 1 | ||||
-rw-r--r-- | lib/CodeGen/SelectionDAG/LegalizeTypes.h | 3 | ||||
-rw-r--r-- | lib/CodeGen/SelectionDAG/LegalizeTypesGeneric.cpp | 26 |
4 files changed, 24 insertions, 7 deletions
diff --git a/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp b/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp index 4896b51..a19bc1f 100644 --- a/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp +++ b/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp @@ -403,6 +403,7 @@ void DAGTypeLegalizer::ExpandFloatResult(SDNode *N, unsigned ResNo) { case ISD::BIT_CONVERT: ExpandRes_BIT_CONVERT(N, Lo, Hi); break; case ISD::BUILD_PAIR: ExpandRes_BUILD_PAIR(N, Lo, Hi); break; + case ISD::EXTRACT_ELEMENT: ExpandRes_EXTRACT_ELEMENT(N, Lo, Hi); break; case ISD::EXTRACT_VECTOR_ELT: ExpandRes_EXTRACT_VECTOR_ELT(N, Lo, Hi); break; case ISD::LOAD: ExpandFloatRes_LOAD(N, Lo, Hi); break; diff --git a/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp b/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp index 33ec2fa..4412506 100644 --- a/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp +++ b/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp @@ -763,6 +763,7 @@ void DAGTypeLegalizer::ExpandIntegerResult(SDNode *N, unsigned ResNo) { case ISD::BIT_CONVERT: ExpandRes_BIT_CONVERT(N, Lo, Hi); break; case ISD::BUILD_PAIR: ExpandRes_BUILD_PAIR(N, Lo, Hi); break; + case ISD::EXTRACT_ELEMENT: ExpandRes_EXTRACT_ELEMENT(N, Lo, Hi); break; case ISD::EXTRACT_VECTOR_ELT: ExpandRes_EXTRACT_VECTOR_ELT(N, Lo, Hi); break; case ISD::Constant: ExpandIntRes_Constant(N, Lo, Hi); break; diff --git a/lib/CodeGen/SelectionDAG/LegalizeTypes.h b/lib/CodeGen/SelectionDAG/LegalizeTypes.h index 678f979..4341cce 100644 --- a/lib/CodeGen/SelectionDAG/LegalizeTypes.h +++ b/lib/CodeGen/SelectionDAG/LegalizeTypes.h @@ -280,10 +280,10 @@ private: void ExpandIntRes_FP_TO_UINT (SDNode *N, SDOperand &Lo, SDOperand &Hi); void ExpandIntRes_Logical (SDNode *N, SDOperand &Lo, SDOperand &Hi); - void ExpandIntRes_BSWAP (SDNode *N, SDOperand &Lo, SDOperand &Hi); void ExpandIntRes_ADDSUB (SDNode *N, SDOperand &Lo, SDOperand &Hi); void ExpandIntRes_ADDSUBC (SDNode *N, SDOperand &Lo, SDOperand &Hi); void ExpandIntRes_ADDSUBE (SDNode *N, SDOperand &Lo, SDOperand &Hi); + void ExpandIntRes_BSWAP (SDNode *N, SDOperand &Lo, SDOperand &Hi); void ExpandIntRes_MUL (SDNode *N, SDOperand &Lo, SDOperand &Hi); void ExpandIntRes_SDIV (SDNode *N, SDOperand &Lo, SDOperand &Hi); void ExpandIntRes_SREM (SDNode *N, SDOperand &Lo, SDOperand &Hi); @@ -464,6 +464,7 @@ private: // Generic Result Expansion. void ExpandRes_BIT_CONVERT (SDNode *N, SDOperand &Lo, SDOperand &Hi); void ExpandRes_BUILD_PAIR (SDNode *N, SDOperand &Lo, SDOperand &Hi); + void ExpandRes_EXTRACT_ELEMENT (SDNode *N, SDOperand &Lo, SDOperand &Hi); void ExpandRes_EXTRACT_VECTOR_ELT(SDNode *N, SDOperand &Lo, SDOperand &Hi); void ExpandRes_NormalLoad (SDNode *N, SDOperand &Lo, SDOperand &Hi); diff --git a/lib/CodeGen/SelectionDAG/LegalizeTypesGeneric.cpp b/lib/CodeGen/SelectionDAG/LegalizeTypesGeneric.cpp index ed90813..d12711a 100644 --- a/lib/CodeGen/SelectionDAG/LegalizeTypesGeneric.cpp +++ b/lib/CodeGen/SelectionDAG/LegalizeTypesGeneric.cpp @@ -28,8 +28,8 @@ using namespace llvm; // little/big-endian machines, followed by the Hi/Lo part. This means that // they cannot be used as is on vectors, for which Lo is always stored first. -void DAGTypeLegalizer::ExpandRes_BIT_CONVERT(SDNode *N, - SDOperand &Lo, SDOperand &Hi) { +void DAGTypeLegalizer::ExpandRes_BIT_CONVERT(SDNode *N, SDOperand &Lo, + SDOperand &Hi) { MVT NVT = TLI.getTypeToTransformTo(N->getValueType(0)); SDOperand InOp = N->getOperand(0); MVT InVT = InOp.getValueType(); @@ -78,15 +78,29 @@ void DAGTypeLegalizer::ExpandRes_BIT_CONVERT(SDNode *N, ExpandRes_NormalLoad(Op.Val, Lo, Hi); } -void DAGTypeLegalizer::ExpandRes_BUILD_PAIR(SDNode *N, - SDOperand &Lo, SDOperand &Hi) { +void DAGTypeLegalizer::ExpandRes_BUILD_PAIR(SDNode *N, SDOperand &Lo, + SDOperand &Hi) { // Return the operands. Lo = N->getOperand(0); Hi = N->getOperand(1); } -void DAGTypeLegalizer::ExpandRes_EXTRACT_VECTOR_ELT(SDNode *N, - SDOperand &Lo, +void DAGTypeLegalizer::ExpandRes_EXTRACT_ELEMENT(SDNode *N, SDOperand &Lo, + SDOperand &Hi) { + GetExpandedOp(N->getOperand(0), Lo, Hi); + SDOperand Part = cast<ConstantSDNode>(N->getOperand(1))->getValue() ? Hi : Lo; + + assert(Part.getValueType() == N->getValueType(0) && + "Type twice as big as expanded type not itself expanded!"); + MVT NVT = TLI.getTypeToTransformTo(N->getValueType(0)); + + Lo = DAG.getNode(ISD::EXTRACT_ELEMENT, NVT, Part, + DAG.getConstant(0, TLI.getPointerTy())); + Hi = DAG.getNode(ISD::EXTRACT_ELEMENT, NVT, Part, + DAG.getConstant(1, TLI.getPointerTy())); +} + +void DAGTypeLegalizer::ExpandRes_EXTRACT_VECTOR_ELT(SDNode *N, SDOperand &Lo, SDOperand &Hi) { SDOperand OldVec = N->getOperand(0); unsigned OldElts = OldVec.getValueType().getVectorNumElements(); |