forked from OSchip/llvm-project
Moved type construction out of the loop and added an assert on the legality of the type. Formatted lines to the 80 char limit.
llvm-svn: 140952
This commit is contained in:
parent
84c287e33c
commit
52e8ed9214
llvm/lib/CodeGen/SelectionDAG
|
@ -1614,6 +1614,9 @@ SDValue SelectionDAGLegalize::LegalizeOp(SDValue Op) {
|
||||||
unsigned NumElem = StVT.getVectorNumElements();
|
unsigned NumElem = StVT.getVectorNumElements();
|
||||||
|
|
||||||
unsigned ScalarSize = StVT.getScalarType().getSizeInBits();
|
unsigned ScalarSize = StVT.getScalarType().getSizeInBits();
|
||||||
|
EVT EltVT = EVT::getIntegerVT(*DAG.getContext(), ScalarSize);
|
||||||
|
assert(TLI.isTypeLegal(EltVT) && "Scalar store type must be legal");
|
||||||
|
|
||||||
// Round odd types to the next pow of two.
|
// Round odd types to the next pow of two.
|
||||||
if (!isPowerOf2_32(ScalarSize))
|
if (!isPowerOf2_32(ScalarSize))
|
||||||
ScalarSize = NextPowerOf2(ScalarSize);
|
ScalarSize = NextPowerOf2(ScalarSize);
|
||||||
|
@ -1625,17 +1628,14 @@ SDValue SelectionDAGLegalize::LegalizeOp(SDValue Op) {
|
||||||
|
|
||||||
for (unsigned Idx=0; Idx<NumElem; Idx++) {
|
for (unsigned Idx=0; Idx<NumElem; Idx++) {
|
||||||
SDValue Ex = DAG.getNode(ISD::EXTRACT_VECTOR_ELT, dl,
|
SDValue Ex = DAG.getNode(ISD::EXTRACT_VECTOR_ELT, dl,
|
||||||
WideScalarVT, Tmp3, DAG.getIntPtrConstant(Idx));
|
WideScalarVT, Tmp3, DAG.getIntPtrConstant(Idx));
|
||||||
|
|
||||||
|
Ex = DAG.getNode(ISD::TRUNCATE, dl, EltVT, Ex);
|
||||||
EVT NVT = EVT::getIntegerVT(*DAG.getContext(), ScalarSize);
|
|
||||||
|
|
||||||
Ex = DAG.getNode(ISD::TRUNCATE, dl, NVT, Ex);
|
|
||||||
Tmp2 = DAG.getNode(ISD::ADD, dl, Tmp2.getValueType(), Tmp2,
|
Tmp2 = DAG.getNode(ISD::ADD, dl, Tmp2.getValueType(), Tmp2,
|
||||||
DAG.getIntPtrConstant(Stride));
|
DAG.getIntPtrConstant(Stride));
|
||||||
SDValue Store = DAG.getStore(Tmp1, dl, Ex, Tmp2,
|
SDValue Store = DAG.getStore(Tmp1, dl, Ex, Tmp2,
|
||||||
ST->getPointerInfo().getWithOffset(Idx*Stride),
|
ST->getPointerInfo().getWithOffset(Idx*Stride),
|
||||||
isVolatile, isNonTemporal, Alignment);
|
isVolatile, isNonTemporal, Alignment);
|
||||||
Stores.push_back(Store);
|
Stores.push_back(Store);
|
||||||
}
|
}
|
||||||
Result = DAG.getNode(ISD::TokenFactor, dl, MVT::Other,
|
Result = DAG.getNode(ISD::TokenFactor, dl, MVT::Other,
|
||||||
|
@ -1663,7 +1663,7 @@ SDValue SelectionDAGLegalize::LegalizeOp(SDValue Op) {
|
||||||
for (unsigned Idx=0; Idx<WideNumElem*SizeRatio; Idx++) {
|
for (unsigned Idx=0; Idx<WideNumElem*SizeRatio; Idx++) {
|
||||||
// Extract elment i
|
// Extract elment i
|
||||||
SDValue Ex = DAG.getNode(ISD::EXTRACT_VECTOR_ELT, dl,
|
SDValue Ex = DAG.getNode(ISD::EXTRACT_VECTOR_ELT, dl,
|
||||||
NarrowScalarVT, Tmp3, DAG.getIntPtrConstant(Idx));
|
NarrowScalarVT, Tmp3, DAG.getIntPtrConstant(Idx));
|
||||||
// bump pointer.
|
// bump pointer.
|
||||||
Tmp2 = DAG.getNode(ISD::ADD, dl, Tmp2.getValueType(), Tmp2,
|
Tmp2 = DAG.getNode(ISD::ADD, dl, Tmp2.getValueType(), Tmp2,
|
||||||
DAG.getIntPtrConstant(Stride));
|
DAG.getIntPtrConstant(Stride));
|
||||||
|
@ -1674,8 +1674,8 @@ SDValue SelectionDAGLegalize::LegalizeOp(SDValue Op) {
|
||||||
if (( TLI.isBigEndian() && (Idx%SizeRatio == 0)) ||
|
if (( TLI.isBigEndian() && (Idx%SizeRatio == 0)) ||
|
||||||
((!TLI.isBigEndian() && (Idx%SizeRatio == SizeRatio-1)))) {
|
((!TLI.isBigEndian() && (Idx%SizeRatio == SizeRatio-1)))) {
|
||||||
SDValue Store = DAG.getStore(Tmp1, dl, Ex, Tmp2,
|
SDValue Store = DAG.getStore(Tmp1, dl, Ex, Tmp2,
|
||||||
ST->getPointerInfo().getWithOffset(Idx*Stride),
|
ST->getPointerInfo().getWithOffset(Idx*Stride),
|
||||||
isVolatile, isNonTemporal, Alignment);
|
isVolatile, isNonTemporal, Alignment);
|
||||||
Stores.push_back(Store);
|
Stores.push_back(Store);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue