diff options
author | Chris Lattner <sabre@nondot.org> | 2006-03-28 20:24:43 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2006-03-28 20:24:43 +0000 |
commit | f6f94d3bce7bbcdc609549b7d698f6f85f72a712 (patch) | |
tree | 4e6023c764e67add96dd0745c55a899a53d7692b /llvm/lib/CodeGen | |
parent | 8d57da2ffc60a71df20f6da565e52a957b396aa7 (diff) | |
download | bcm5719-llvm-f6f94d3bce7bbcdc609549b7d698f6f85f72a712.tar.gz bcm5719-llvm-f6f94d3bce7bbcdc609549b7d698f6f85f72a712.zip |
Teach Legalize how to pack VVECTOR_SHUFFLE nodes into VECTOR_SHUFFLE nodes.
llvm-svn: 27232
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp b/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp index 8bcb37ece99..d6c3fe0920f 100644 --- a/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp @@ -4532,6 +4532,27 @@ SDOperand SelectionDAGLegalize::PackVectorOp(SDOperand Op, Node->getOperand(1), Node->getOperand(2)); } break; + case ISD::VVECTOR_SHUFFLE: + if (!MVT::isVector(NewVT)) { + // Returning a scalar? Figure out if it is the LHS or RHS and return it. + SDOperand EltNum = Node->getOperand(2).getOperand(0); + if (cast<ConstantSDNode>(EltNum)->getValue()) + Result = PackVectorOp(Node->getOperand(1), NewVT); + else + Result = PackVectorOp(Node->getOperand(0), NewVT); + } else { + // Otherwise, return a VECTOR_SHUFFLE node. First convert the index + // vector from a VBUILD_VECTOR to a BUILD_VECTOR. + std::vector<SDOperand> BuildVecIdx(Node->getOperand(2).Val->op_begin(), + Node->getOperand(2).Val->op_end()-2); + MVT::ValueType BVT = MVT::getIntVectorWithNumElements(BuildVecIdx.size()); + SDOperand BV = DAG.getNode(ISD::BUILD_VECTOR, BVT, BuildVecIdx); + + Result = DAG.getNode(ISD::VECTOR_SHUFFLE, NewVT, + PackVectorOp(Node->getOperand(0), NewVT), + PackVectorOp(Node->getOperand(1), NewVT), BV); + } + break; case ISD::VBIT_CONVERT: if (Op.getOperand(0).getValueType() != MVT::Vector) Result = DAG.getNode(ISD::BIT_CONVERT, NewVT, Op.getOperand(0)); |