Skip to content

Commit 6fe62e9

Browse files
committed
[X86] Use SelectionDAG::getExtractSubvector/getInsertSubvector in X86 extractSubVector/insertSubVector helpers. NFC.
1 parent d9a5f7b commit 6fe62e9

File tree

1 file changed

+7
-12
lines changed

1 file changed

+7
-12
lines changed

llvm/lib/Target/X86/X86ISelLowering.cpp

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4135,8 +4135,7 @@ static SDValue extractSubVector(SDValue Vec, unsigned IdxVal, SelectionDAG &DAG,
41354135
isNullConstant(Vec.getOperand(2)))
41364136
return DAG.getUNDEF(ResultVT);
41374137

4138-
SDValue VecIdx = DAG.getVectorIdxConstant(IdxVal, dl);
4139-
return DAG.getNode(ISD::EXTRACT_SUBVECTOR, dl, ResultVT, Vec, VecIdx);
4138+
return DAG.getExtractSubvector(dl, ResultVT, Vec, IdxVal);
41404139
}
41414140

41424141
/// Generate a DAG to grab 128-bits from a vector > 128 bits. This
@@ -4148,7 +4147,8 @@ static SDValue extractSubVector(SDValue Vec, unsigned IdxVal, SelectionDAG &DAG,
41484147
static SDValue extract128BitVector(SDValue Vec, unsigned IdxVal,
41494148
SelectionDAG &DAG, const SDLoc &dl) {
41504149
assert((Vec.getValueType().is256BitVector() ||
4151-
Vec.getValueType().is512BitVector()) && "Unexpected vector size!");
4150+
Vec.getValueType().is512BitVector()) &&
4151+
"Unexpected vector size!");
41524152
return extractSubVector(Vec, IdxVal, DAG, dl, 128);
41534153
}
41544154

@@ -4167,20 +4167,16 @@ static SDValue insertSubVector(SDValue Result, SDValue Vec, unsigned IdxVal,
41674167
// Inserting UNDEF is Result
41684168
if (Vec.isUndef())
41694169
return Result;
4170-
EVT VT = Vec.getValueType();
4171-
EVT ElVT = VT.getVectorElementType();
4172-
EVT ResultVT = Result.getValueType();
41734170

41744171
// Insert the relevant vectorWidth bits.
4175-
unsigned ElemsPerChunk = vectorWidth/ElVT.getSizeInBits();
4172+
EVT VT = Vec.getValueType();
4173+
unsigned ElemsPerChunk = vectorWidth / VT.getScalarSizeInBits();
41764174
assert(isPowerOf2_32(ElemsPerChunk) && "Elements per chunk not power of 2");
41774175

41784176
// This is the index of the first element of the vectorWidth-bit chunk
41794177
// we want. Since ElemsPerChunk is a power of 2 just need to clear bits.
41804178
IdxVal &= ~(ElemsPerChunk - 1);
4181-
4182-
SDValue VecIdx = DAG.getVectorIdxConstant(IdxVal, dl);
4183-
return DAG.getNode(ISD::INSERT_SUBVECTOR, dl, ResultVT, Result, Vec, VecIdx);
4179+
return DAG.getInsertSubvector(dl, Result, Vec, IdxVal);
41844180
}
41854181

41864182
/// Generate a DAG to put 128-bits into a vector > 128 bits. This
@@ -4216,8 +4212,7 @@ static SDValue widenSubVector(MVT VT, SDValue Vec, bool ZeroNewElements,
42164212
}
42174213
SDValue Res = ZeroNewElements ? getZeroVector(VT, Subtarget, DAG, dl)
42184214
: DAG.getUNDEF(VT);
4219-
return DAG.getNode(ISD::INSERT_SUBVECTOR, dl, VT, Res, Vec,
4220-
DAG.getVectorIdxConstant(0, dl));
4215+
return DAG.getInsertSubvector(dl, Res, Vec, 0);
42214216
}
42224217

42234218
/// Widen a vector to a larger size with the same scalar type, with the new

0 commit comments

Comments
 (0)