- case ISD::ConstantVec: {
- unsigned NumElements = Node->getNumOperands();
- // If we only have two elements left in the constant vector, just break it
- // apart into the two scalar constants it contains. Otherwise, bisect the
- // ConstantVec, and return each half as a new ConstantVec.
- // FIXME: this is hard coded as big endian, it may have to change to support
- // SSE and Alpha MVI
- if (NumElements == 2) {
- Hi = Node->getOperand(0);
- Lo = Node->getOperand(1);
+ case ISD::VConstant: {
+ unsigned NumElements =
+ cast<ConstantSDNode>(Node->getOperand(0))->getValue() / 2;
+ MVT::ValueType EVT = cast<VTSDNode>(Node->getOperand(1))->getVT();
+ MVT::ValueType TVT = (NumElements > 1)
+ ? getVectorType(EVT, NumElements) : EVT;
+ // If type of bisected vector is legal, turn it into a ConstantVec (which
+ // will be lowered to a ConstantPool or something else). Otherwise, bisect
+ // the VConstant, and return each half as a new VConstant.
+ unsigned Opc = ISD::ConstantVec;
+ std::vector<SDOperand> LoOps, HiOps;
+ if (!(TVT != MVT::Other &&
+ (!MVT::isVector(TVT) || TLI.isTypeLegal(TVT)))) {
+ Opc = ISD::VConstant;
+ TVT = MVT::Vector;
+ SDOperand Num = DAG.getConstant(NumElements, MVT::i32);
+ SDOperand Typ = DAG.getValueType(EVT);
+ HiOps.push_back(Num);
+ HiOps.push_back(Typ);
+ LoOps.push_back(Num);
+ LoOps.push_back(Typ);
+ }
+
+ if (NumElements == 1) {
+ Hi = Node->getOperand(2);
+ Lo = Node->getOperand(3);