diff options
author | Chris Lattner <sabre@nondot.org> | 2006-04-06 20:36:51 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2006-04-06 20:36:51 +0000 |
commit | 91ded082246312ede09d25ac4e055803f7983d77 (patch) | |
tree | 43043ea40e381ccacaa8f3cb52ef29755f9b41fe /utils | |
parent | 52793e2c41b2c073e1175b9292aba48d0c23019e (diff) |
Infer element types for shuffle masks
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@27456 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils')
-rw-r--r-- | utils/TableGen/DAGISelEmitter.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/utils/TableGen/DAGISelEmitter.cpp b/utils/TableGen/DAGISelEmitter.cpp index 37fc53c0d3..7a6097fa37 100644 --- a/utils/TableGen/DAGISelEmitter.cpp +++ b/utils/TableGen/DAGISelEmitter.cpp @@ -672,6 +672,26 @@ bool TreePatternNode::ApplyTypeConstraints(TreePattern &TP, bool NotRegisters) { // must have void types. if (NI.getNumResults() == 0) MadeChange |= UpdateNodeType(MVT::isVoid, TP); + + // If this is a vector_shuffle operation, apply types to the build_vector + // operation. The types of the integers don't matter, but this ensures they + // won't get checked. + if (getOperator()->getName() == "vector_shuffle" && + getChild(2)->getOperator()->getName() == "build_vector") { + TreePatternNode *BV = getChild(2); + const std::vector<MVT::ValueType> &LegalVTs + = ISE.getTargetInfo().getLegalValueTypes(); + MVT::ValueType LegalIntVT = MVT::Other; + for (unsigned i = 0, e = LegalVTs.size(); i != e; ++i) + if (MVT::isInteger(LegalVTs[i]) && !MVT::isVector(LegalVTs[i])) { + LegalIntVT = LegalVTs[i]; + break; + } + assert(LegalIntVT != MVT::Other && "No legal integer VT?"); + + for (unsigned i = 0, e = BV->getNumChildren(); i != e; ++i) + MadeChange |= BV->getChild(i)->UpdateNodeType(LegalIntVT, TP); + } return MadeChange; } else if (getOperator()->isSubClassOf("Instruction")) { const DAGInstruction &Inst = ISE.getInstruction(getOperator()); |