diff options
author | Duncan Sands <baldrick@free.fr> | 2008-06-23 15:08:15 +0000 |
---|---|---|
committer | Duncan Sands <baldrick@free.fr> | 2008-06-23 15:08:15 +0000 |
commit | 4a307ecce68f90e0eebf1ded52b947816cdc2304 (patch) | |
tree | 41af3bc2275420f9be1ed60066bca4e785b3fa3e /lib/CodeGen/SelectionDAG/LegalizeTypesGeneric.cpp | |
parent | ab09b7e8f34075c1759127a113f41bdf921f4034 (diff) | |
download | external_llvm-4a307ecce68f90e0eebf1ded52b947816cdc2304.zip external_llvm-4a307ecce68f90e0eebf1ded52b947816cdc2304.tar.gz external_llvm-4a307ecce68f90e0eebf1ded52b947816cdc2304.tar.bz2 |
Support for expanding the result of EXTRACT_ELEMENT.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52621 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/SelectionDAG/LegalizeTypesGeneric.cpp')
-rw-r--r-- | lib/CodeGen/SelectionDAG/LegalizeTypesGeneric.cpp | 26 |
1 files changed, 20 insertions, 6 deletions
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(); |