aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2006-03-24 02:26:29 +0000
committerChris Lattner <sabre@nondot.org>2006-03-24 02:26:29 +0000
commitd1f04d40a078d6ca7c876b16a178992a109af774 (patch)
treec06d9cf0661b28610c0a98f1632de03a1be7f2ff /lib
parent0eade319cdb72e24c11d068728a98083737c6435 (diff)
downloadexternal_llvm-d1f04d40a078d6ca7c876b16a178992a109af774.zip
external_llvm-d1f04d40a078d6ca7c876b16a178992a109af774.tar.gz
external_llvm-d1f04d40a078d6ca7c876b16a178992a109af774.tar.bz2
legalize vbit_convert nodes whose result is a legal type.
Legalize intrinsic nodes. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@27036 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/CodeGen/SelectionDAG/LegalizeDAG.cpp38
1 files changed, 38 insertions, 0 deletions
diff --git a/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp b/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
index dc68d7b..b8a20fc 100644
--- a/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
+++ b/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
@@ -552,6 +552,14 @@ SDOperand SelectionDAGLegalize::LegalizeOp(SDOperand Op) {
}
break;
}
+
+ case ISD::INTRINSIC: {
+ std::vector<SDOperand> Ops;
+ for (unsigned i = 0, e = Node->getNumOperands(); i != e; ++i)
+ Ops.push_back(LegalizeOp(Node->getOperand(i)));
+ Result = DAG.UpdateNodeOperands(Result, Ops);
+ break;
+ }
case ISD::LOCATION:
assert(Node->getNumOperands() == 5 && "Invalid LOCATION node!");
@@ -2312,6 +2320,36 @@ SDOperand SelectionDAGLegalize::LegalizeOp(SDOperand Op) {
}
}
break;
+ case ISD::VBIT_CONVERT: {
+ assert(Op.getOperand(0).getValueType() == MVT::Vector &&
+ "Can only have VBIT_CONVERT where input or output is MVT::Vector!");
+
+ // The input has to be a vector type, we have to either scalarize it, pack
+ // it, or convert it based on whether the input vector type is legal.
+ SDNode *InVal = Node->getOperand(0).Val;
+ unsigned NumElems =
+ cast<ConstantSDNode>(*(InVal->op_end()-2))->getValue();
+ MVT::ValueType EVT = cast<VTSDNode>(*(InVal->op_end()-1))->getVT();
+
+ // Figure out if there is a Packed type corresponding to this Vector
+ // type. If so, convert to the packed type.
+ MVT::ValueType TVT = MVT::getVectorType(EVT, NumElems);
+ if (TVT != MVT::Other && TLI.isTypeLegal(TVT)) {
+ // Turn this into a bit convert of the packed input.
+ Result = DAG.getNode(ISD::BIT_CONVERT, Node->getValueType(0),
+ PackVectorOp(Node->getOperand(0), TVT));
+ break;
+ } else if (NumElems == 1) {
+ // Turn this into a bit convert of the scalar input.
+ Result = DAG.getNode(ISD::BIT_CONVERT, Node->getValueType(0),
+ PackVectorOp(Node->getOperand(0), EVT));
+ break;
+ } else {
+ // FIXME: UNIMP! Store then reload
+ assert(0 && "Cast from unsupported vector type not implemented yet!");
+ }
+ }
+
// Conversion operators. The source and destination have different types.
case ISD::SINT_TO_FP:
case ISD::UINT_TO_FP: {