From 4a307ecce68f90e0eebf1ded52b947816cdc2304 Mon Sep 17 00:00:00 2001 From: Duncan Sands Date: Mon, 23 Jun 2008 15:08:15 +0000 Subject: 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 --- lib/CodeGen/SelectionDAG/LegalizeTypesGeneric.cpp | 26 +++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) (limited to 'lib/CodeGen/SelectionDAG/LegalizeTypesGeneric.cpp') 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(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(); -- cgit v1.1