Precommit NFC part of DAGCombiner change. NFC.

This is NFC part of DAGCombiner::visitEXTRACT_SUBVECTOR()
change in the D73132.
This commit is contained in:
Stanislav Mekhanoshin 2020-01-22 09:01:22 -08:00
parent fb8a3d1834
commit 2d0fcf786c
1 changed files with 11 additions and 9 deletions

View File

@ -18565,16 +18565,18 @@ SDValue DAGCombiner::visitEXTRACT_SUBVECTOR(SDNode *N) {
unsigned DestSrcRatio = DestNumElts / SrcNumElts;
if ((NVT.getVectorNumElements() % DestSrcRatio) == 0) {
unsigned NewExtNumElts = NVT.getVectorNumElements() / DestSrcRatio;
EVT NewExtVT = EVT::getVectorVT(*DAG.getContext(),
SrcVT.getScalarType(), NewExtNumElts);
if ((N->getConstantOperandVal(1) % DestSrcRatio) == 0 &&
TLI.isOperationLegalOrCustom(ISD::EXTRACT_SUBVECTOR, NewExtVT)) {
unsigned IndexValScaled = N->getConstantOperandVal(1) / DestSrcRatio;
EVT ScalarVT = SrcVT.getScalarType();
if ((N->getConstantOperandVal(1) % DestSrcRatio) == 0) {
SDLoc DL(N);
SDValue NewIndex = DAG.getVectorIdxConstant(IndexValScaled, DL);
SDValue NewExtract = DAG.getNode(ISD::EXTRACT_SUBVECTOR, DL, NewExtVT,
V.getOperand(0), NewIndex);
return DAG.getBitcast(NVT, NewExtract);
unsigned IndexValScaled = N->getConstantOperandVal(1) / DestSrcRatio;
EVT NewExtVT = EVT::getVectorVT(*DAG.getContext(),
ScalarVT, NewExtNumElts);
if (TLI.isOperationLegalOrCustom(ISD::EXTRACT_SUBVECTOR, NewExtVT)) {
SDValue NewIndex = DAG.getVectorIdxConstant(IndexValScaled, DL);
SDValue NewExtract = DAG.getNode(ISD::EXTRACT_SUBVECTOR, DL, NewExtVT,
V.getOperand(0), NewIndex);
return DAG.getBitcast(NVT, NewExtract);
}
}
}
}