tidy up, reduce indentation

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111982 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner 2010-08-24 22:43:11 +00:00
parent 992ea38e0e
commit 549fa267ef
2 changed files with 131 additions and 135 deletions

View File

@ -86,7 +86,6 @@ private:
// 2) For vectors, use a wider vector type (e.g. v3i32 -> v4i32). // 2) For vectors, use a wider vector type (e.g. v3i32 -> v4i32).
if (!VT.isVector()) if (!VT.isVector())
return PromoteInteger; return PromoteInteger;
else
return WidenVector; return WidenVector;
case TargetLowering::Expand: case TargetLowering::Expand:
// Expand can mean // Expand can mean
@ -95,16 +94,15 @@ private:
if (!VT.isVector()) { if (!VT.isVector()) {
if (VT.isInteger()) if (VT.isInteger())
return ExpandInteger; return ExpandInteger;
else if (VT.getSizeInBits() == if (VT.getSizeInBits() ==
TLI.getTypeToTransformTo(*DAG.getContext(), VT).getSizeInBits()) TLI.getTypeToTransformTo(*DAG.getContext(), VT).getSizeInBits())
return SoftenFloat; return SoftenFloat;
else
return ExpandFloat; return ExpandFloat;
} else if (VT.getVectorNumElements() == 1) {
return ScalarizeVector;
} else {
return SplitVector;
} }
if (VT.getVectorNumElements() == 1)
return ScalarizeVector;
return SplitVector;
} }
} }

View File

@ -1283,10 +1283,12 @@ SDValue DAGTypeLegalizer::WidenVecRes_Binary(SDNode *N) {
SDValue InOp1 = GetWidenedVector(N->getOperand(0)); SDValue InOp1 = GetWidenedVector(N->getOperand(0));
SDValue InOp2 = GetWidenedVector(N->getOperand(1)); SDValue InOp2 = GetWidenedVector(N->getOperand(1));
return DAG.getNode(N->getOpcode(), dl, WidenVT, InOp1, InOp2); return DAG.getNode(N->getOpcode(), dl, WidenVT, InOp1, InOp2);
} else if (NumElts == 1) { }
// No legal vector version so unroll the vector operation and then widen. // No legal vector version so unroll the vector operation and then widen.
if (NumElts == 1)
return DAG.UnrollVectorOp(N, WidenVT.getVectorNumElements()); return DAG.UnrollVectorOp(N, WidenVT.getVectorNumElements());
} else {
// Since the operation can trap, apply operation on the original vector. // Since the operation can trap, apply operation on the original vector.
EVT MaxVT = VT; EVT MaxVT = VT;
SDValue InOp1 = GetWidenedVector(N->getOperand(0)); SDValue InOp1 = GetWidenedVector(N->getOperand(0));
@ -1364,8 +1366,7 @@ SDValue DAGTypeLegalizer::WidenVecRes_Binary(SDNode *N) {
} }
ConcatOps[Idx+1] = VecOp; ConcatOps[Idx+1] = VecOp;
ConcatEnd = Idx + 2; ConcatEnd = Idx + 2;
} } else {
else {
// Vector type, create a CONCAT_VECTORS of type NextVT // Vector type, create a CONCAT_VECTORS of type NextVT
SDValue undefVec = DAG.getUNDEF(VT); SDValue undefVec = DAG.getUNDEF(VT);
unsigned OpsToConcat = NextSize/VT.getVectorNumElements(); unsigned OpsToConcat = NextSize/VT.getVectorNumElements();
@ -1392,15 +1393,13 @@ SDValue DAGTypeLegalizer::WidenVecRes_Binary(SDNode *N) {
} }
// add undefs of size MaxVT until ConcatOps grows to length of WidenVT // add undefs of size MaxVT until ConcatOps grows to length of WidenVT
unsigned NumOps = unsigned NumOps = WidenVT.getVectorNumElements()/MaxVT.getVectorNumElements();
WidenVT.getVectorNumElements()/MaxVT.getVectorNumElements();
if (NumOps != ConcatEnd ) { if (NumOps != ConcatEnd ) {
SDValue UndefVal = DAG.getUNDEF(MaxVT); SDValue UndefVal = DAG.getUNDEF(MaxVT);
for (unsigned j = ConcatEnd; j < NumOps; ++j) for (unsigned j = ConcatEnd; j < NumOps; ++j)
ConcatOps[j] = UndefVal; ConcatOps[j] = UndefVal;
} }
return DAG.getNode(ISD::CONCAT_VECTORS, dl, WidenVT, &ConcatOps[0], NumOps); return DAG.getNode(ISD::CONCAT_VECTORS, dl, WidenVT, &ConcatOps[0], NumOps);
}
} }
SDValue DAGTypeLegalizer::WidenVecRes_Convert(SDNode *N) { SDValue DAGTypeLegalizer::WidenVecRes_Convert(SDNode *N) {
@ -1561,7 +1560,7 @@ SDValue DAGTypeLegalizer::WidenVecRes_BIT_CONVERT(SDNode *N) {
unsigned NewNumElts = WidenSize / InSize; unsigned NewNumElts = WidenSize / InSize;
if (InVT.isVector()) { if (InVT.isVector()) {
EVT InEltVT = InVT.getVectorElementType(); EVT InEltVT = InVT.getVectorElementType();
NewInVT= EVT::getVectorVT(*DAG.getContext(), InEltVT, NewInVT = EVT::getVectorVT(*DAG.getContext(), InEltVT,
WidenSize / InEltVT.getSizeInBits()); WidenSize / InEltVT.getSizeInBits());
} else { } else {
NewInVT = EVT::getVectorVT(*DAG.getContext(), InVT, NewNumElts); NewInVT = EVT::getVectorVT(*DAG.getContext(), InVT, NewNumElts);
@ -1686,8 +1685,7 @@ SDValue DAGTypeLegalizer::WidenVecRes_CONVERT_RNDSAT(SDNode *N) {
SDValue RndOp = N->getOperand(3); SDValue RndOp = N->getOperand(3);
SDValue SatOp = N->getOperand(4); SDValue SatOp = N->getOperand(4);
EVT WidenVT = TLI.getTypeToTransformTo(*DAG.getContext(), EVT WidenVT = TLI.getTypeToTransformTo(*DAG.getContext(), N->getValueType(0));
N->getValueType(0));
unsigned WidenNumElts = WidenVT.getVectorNumElements(); unsigned WidenNumElts = WidenVT.getVectorNumElements();
EVT InVT = InOp.getValueType(); EVT InVT = InOp.getValueType();
@ -1720,9 +1718,9 @@ SDValue DAGTypeLegalizer::WidenVecRes_CONVERT_RNDSAT(SDNode *N) {
SmallVector<SDValue, 16> Ops(NumConcat); SmallVector<SDValue, 16> Ops(NumConcat);
Ops[0] = InOp; Ops[0] = InOp;
SDValue UndefVal = DAG.getUNDEF(InVT); SDValue UndefVal = DAG.getUNDEF(InVT);
for (unsigned i = 1; i != NumConcat; ++i) { for (unsigned i = 1; i != NumConcat; ++i)
Ops[i] = UndefVal; Ops[i] = UndefVal;
}
InOp = DAG.getNode(ISD::CONCAT_VECTORS, dl, InWidenVT, &Ops[0],NumConcat); InOp = DAG.getNode(ISD::CONCAT_VECTORS, dl, InWidenVT, &Ops[0],NumConcat);
return DAG.getConvertRndSat(WidenVT, dl, InOp, DTyOp, STyOp, RndOp, return DAG.getConvertRndSat(WidenVT, dl, InOp, DTyOp, STyOp, RndOp,
SatOp, CvtCode); SatOp, CvtCode);