@@ -10152,13 +10152,15 @@ SDValue RISCVTargetLowering::lowerINSERT_SUBVECTOR(SDValue Op,
10152
10152
unsigned OrigIdx = Op.getConstantOperandVal(2);
10153
10153
const RISCVRegisterInfo *TRI = Subtarget.getRegisterInfo();
10154
10154
10155
+ if (OrigIdx == 0 && Vec.isUndef())
10156
+ return Op;
10157
+
10155
10158
// We don't have the ability to slide mask vectors up indexed by their i1
10156
10159
// elements; the smallest we can do is i8. Often we are able to bitcast to
10157
10160
// equivalent i8 vectors. Note that when inserting a fixed-length vector
10158
10161
// into a scalable one, we might not necessarily have enough scalable
10159
10162
// elements to safely divide by 8: nxv1i1 = insert nxv1i1, v4i1 is valid.
10160
- if (SubVecVT.getVectorElementType() == MVT::i1 &&
10161
- (OrigIdx != 0 || !Vec.isUndef())) {
10163
+ if (SubVecVT.getVectorElementType() == MVT::i1) {
10162
10164
if (VecVT.getVectorMinNumElements() >= 8 &&
10163
10165
SubVecVT.getVectorMinNumElements() >= 8) {
10164
10166
assert(OrigIdx % 8 == 0 && "Invalid index");
@@ -10196,8 +10198,6 @@ SDValue RISCVTargetLowering::lowerINSERT_SUBVECTOR(SDValue Op,
10196
10198
// vector group up the full amount.
10197
10199
const auto VLen = Subtarget.getRealVLen();
10198
10200
if (SubVecVT.isFixedLengthVector() && !VLen) {
10199
- if (OrigIdx == 0 && Vec.isUndef() && !VecVT.isFixedLengthVector())
10200
- return Op;
10201
10201
MVT ContainerVT = VecVT;
10202
10202
if (VecVT.isFixedLengthVector()) {
10203
10203
ContainerVT = getContainerForFixedLengthVector(VecVT);
@@ -10208,11 +10208,6 @@ SDValue RISCVTargetLowering::lowerINSERT_SUBVECTOR(SDValue Op,
10208
10208
DAG.getUNDEF(ContainerVT), SubVec,
10209
10209
DAG.getVectorIdxConstant(0, DL));
10210
10210
10211
- if (OrigIdx == 0 && Vec.isUndef() && VecVT.isFixedLengthVector()) {
10212
- SubVec = convertFromScalableVector(VecVT, SubVec, DAG, Subtarget);
10213
- return DAG.getBitcast(Op.getValueType(), SubVec);
10214
- }
10215
-
10216
10211
SDValue Mask =
10217
10212
getDefaultVLOps(VecVT, ContainerVT, DL, DAG, Subtarget).first;
10218
10213
// Set the vector length to only the number of elements we care about. Note
0 commit comments