MVT VT = Op.getSimpleValueType();
MVT EltVT = VT.getVectorElementType();
unsigned NumElts = VT.getVectorNumElements();
+ unsigned EltSizeInBits = EltVT.getScalarSizeInBits();
if (EltVT == MVT::i1)
return InsertBitToMaskVector(Op, DAG, Subtarget);
// Variable insertion indices, usually we're better off spilling to stack,
// but AVX512 can use a variable compare+select by comparing against all
// possible vector indices.
- if (!(Subtarget.hasBWI() ||
- (Subtarget.hasAVX512() && EltVT.getScalarSizeInBits() >= 32)))
+ if (!(Subtarget.hasBWI() || (Subtarget.hasAVX512() && EltSizeInBits >= 32)))
return SDValue();
- MVT IdxSVT = MVT::getIntegerVT(EltVT.getScalarSizeInBits());
+ MVT IdxSVT = MVT::getIntegerVT(EltSizeInBits);
MVT IdxVT = MVT::getVectorVT(IdxSVT, NumElts);
SDValue IdxExt = DAG.getZExtOrTrunc(N2, dl, IdxSVT);
SDValue IdxSplat = DAG.getSplatBuildVector(IdxVT, dl, IdxExt);
// a blend shuffle with a rematerializable vector than a costly integer
// insertion.
if ((IsZeroElt || IsAllOnesElt) && Subtarget.hasSSE41() &&
- 16 <= EltVT.getSizeInBits()) {
+ 16 <= EltSizeInBits) {
SmallVector<int, 8> BlendMask;
for (unsigned i = 0; i != NumElts; ++i)
BlendMask.push_back(i == IdxVal ? i + NumElts : i);
SDValue V = extract128BitVector(N0, IdxVal, DAG, dl);
// Insert the element into the desired chunk.
- unsigned NumEltsIn128 = 128 / EltVT.getSizeInBits();
+ unsigned NumEltsIn128 = 128 / EltSizeInBits;
assert(isPowerOf2_32(NumEltsIn128));
// Since NumEltsIn128 is a power of 2 we can use mask instead of modulo.
unsigned IdxIn128 = IdxVal & (NumEltsIn128 - 1);
// it to i32 first.
if (EltVT == MVT::i16 || EltVT == MVT::i8) {
N1 = DAG.getNode(ISD::ZERO_EXTEND, dl, MVT::i32, N1);
- MVT ShufVT = MVT::getVectorVT(MVT::i32, VT.getSizeInBits()/32);
+ MVT ShufVT = MVT::getVectorVT(MVT::i32, VT.getSizeInBits() / 32);
N1 = DAG.getNode(ISD::SCALAR_TO_VECTOR, dl, ShufVT, N1);
N1 = getShuffleVectorZeroOrUndef(N1, 0, true, Subtarget, DAG);
return DAG.getBitcast(VT, N1);