static SDValue getExtendInVec(bool Signed, const SDLoc &DL, EVT VT, SDValue In,
SelectionDAG &DAG) {
EVT InVT = In.getValueType();
+ assert(VT.isVector() && InVT.isVector() && "Expected vector VTs.");
// For 256-bit vectors, we only need the lower (128-bit) input half.
// For 512-bit vectors, we only need the lower input half or quarter.
- if (VT.getSizeInBits() > 128 && InVT.getSizeInBits() > 128) {
- int Scale = VT.getScalarSizeInBits() / InVT.getScalarSizeInBits();
+ if (InVT.getSizeInBits() > 128) {
+ assert(VT.getSizeInBits() == InVT.getSizeInBits() &&
+ "Expected VTs to be the same size!");
+ unsigned Scale = VT.getScalarSizeInBits() / InVT.getScalarSizeInBits();
In = extractSubVector(In, 0, DAG, DL,
- std::max(128, (int)VT.getSizeInBits() / Scale));
+ std::max(128U, VT.getSizeInBits() / Scale));
InVT = In.getValueType();
}
- if (VT.getVectorNumElements() == In.getValueType().getVectorNumElements())
+ if (VT.getVectorNumElements() == InVT.getVectorNumElements())
return DAG.getNode(Signed ? ISD::SIGN_EXTEND : ISD::ZERO_EXTEND,
DL, VT, In);