Fixed a LowerCallTo and LowerArguments bug. They were introducing illegal

VBIT_VECTOR nodes. There were some confusion about the semantics of
getPackedTypeBreakdown(). e.g. for <4 x f32> it returns 1 and v4f32, not 4,
and f32.

llvm-svn: 28352
This commit is contained in:
Evan Cheng 2006-05-17 18:16:39 +00:00
parent 6dcec44fec
commit 751cd7653d
1 changed files with 27 additions and 12 deletions

View File

@ -2455,20 +2455,25 @@ TargetLowering::LowerArguments(Function &F, SelectionDAG &DAG) {
// Figure out if there is a Packed type corresponding to this Vector // Figure out if there is a Packed type corresponding to this Vector
// type. If so, convert to the packed type. // type. If so, convert to the packed type.
bool Supported = false;
MVT::ValueType TVT = MVT::getVectorType(getValueType(EltTy), NumElems); MVT::ValueType TVT = MVT::getVectorType(getValueType(EltTy), NumElems);
if (TVT != MVT::Other && isTypeLegal(TVT)) { if (TVT != MVT::Other) {
SDOperand N = SDOperand(Result, i++); SDOperand N = SDOperand(Result, i++);
// Handle copies from generic vectors to registers. // Handle copies from generic vectors to registers.
MVT::ValueType PTyElementVT, PTyLegalElementVT; MVT::ValueType PTyElementVT, PTyLegalElementVT;
unsigned NE = getPackedTypeBreakdown(PTy, PTyElementVT, unsigned NE = getPackedTypeBreakdown(PTy, PTyElementVT,
PTyLegalElementVT); PTyLegalElementVT);
// Insert a VBIT_CONVERT of the FORMAL_ARGUMENTS to a // FIXME: handle NE > 1 cases.
// "N x PTyElementVT" MVT::Vector type. if (NE == 1) {
N = DAG.getNode(ISD::VBIT_CONVERT, MVT::Vector, N, N = DAG.getNode(ISD::VBIT_CONVERT, MVT::Vector, N,
DAG.getConstant(NE, MVT::i32), DAG.getConstant(NumElems, MVT::i32),
DAG.getValueType(PTyElementVT)); DAG.getValueType(getValueType(EltTy)));
Ops.push_back(N); Ops.push_back(N);
} else { Supported = true;
}
}
if (!Supported) {
assert(0 && "Don't support illegal by-val vector arguments yet!"); assert(0 && "Don't support illegal by-val vector arguments yet!");
abort(); abort();
} }
@ -2546,15 +2551,25 @@ TargetLowering::LowerCallTo(SDOperand Chain, const Type *RetTy, bool isVarArg,
// Figure out if there is a Packed type corresponding to this Vector // Figure out if there is a Packed type corresponding to this Vector
// type. If so, convert to the packed type. // type. If so, convert to the packed type.
bool Supported = false;
MVT::ValueType TVT = MVT::getVectorType(getValueType(EltTy), NumElems); MVT::ValueType TVT = MVT::getVectorType(getValueType(EltTy), NumElems);
if (TVT != MVT::Other && isTypeLegal(TVT)) { if (TVT != MVT::Other) {
// Handle copies from generic vectors to registers. // Handle copies from generic vectors to registers.
MVT::ValueType PTyElementVT, PTyLegalElementVT; MVT::ValueType PTyElementVT, PTyLegalElementVT;
unsigned NE = getPackedTypeBreakdown(PTy, PTyElementVT, unsigned NE = getPackedTypeBreakdown(PTy, PTyElementVT,
PTyLegalElementVT); PTyLegalElementVT);
// Insert a VBIT_CONVERT of the MVT::Vector type to the packed type. // FIXME: handle NE > 1 cases.
Ops.push_back(DAG.getNode(ISD::VBIT_CONVERT, TVT, Op)); if (NE == 1) {
} else { // Insert a VBIT_CONVERT of the MVT::Vector type to the packed type.
Op = DAG.getNode(ISD::VBIT_CONVERT, MVT::Vector, Op,
DAG.getConstant(NumElems, MVT::i32),
DAG.getValueType(getValueType(EltTy)));
Ops.push_back(Op);
Supported = true;
}
}
if (!Supported) {
assert(0 && "Don't support illegal by-val vector call args yet!"); assert(0 && "Don't support illegal by-val vector call args yet!");
abort(); abort();
} }