X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=lib%2FCodeGen%2FSelectionDAG%2FLegalizeTypesGeneric.cpp;h=783cc9d213bca4ea4df50330dec116dee8aadce2;hb=edfba7e707a4f2f2e800843a7ef980c27d7f4eff;hp=ed90813fbc166832d250a0622f8980f3a86beec1;hpb=ab09b7e8f34075c1759127a113f41bdf921f4034;p=oota-llvm.git diff --git a/lib/CodeGen/SelectionDAG/LegalizeTypesGeneric.cpp b/lib/CodeGen/SelectionDAG/LegalizeTypesGeneric.cpp index ed90813fbc1..783cc9d213b 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(); @@ -54,7 +54,7 @@ void DAGTypeLegalizer::ExpandRes_BIT_CONVERT(SDNode *N, Lo = DAG.getNode(ISD::BIT_CONVERT, NVT, Lo); Hi = DAG.getNode(ISD::BIT_CONVERT, NVT, Hi); return; - case Split: + case SplitVector: // Convert the split parts of the input if it was split in two. GetSplitVector(InOp, Lo, Hi); if (Lo.getValueType() == Hi.getValueType()) { @@ -65,7 +65,7 @@ void DAGTypeLegalizer::ExpandRes_BIT_CONVERT(SDNode *N, return; } break; - case Scalarize: + case ScalarizeVector: // Convert the element instead. SplitInteger(BitConvertToInteger(GetScalarizedVector(InOp)), Lo, Hi); Lo = DAG.getNode(ISD::BIT_CONVERT, NVT, Lo); @@ -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(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(); @@ -156,6 +170,7 @@ void DAGTypeLegalizer::ExpandRes_NormalLoad(SDNode *N, SDOperand &Lo, ReplaceValueWith(SDOperand(N, 1), Chain); } + //===--------------------------------------------------------------------===// // Generic Operand Expansion. //===--------------------------------------------------------------------===//