@@ -2914,10 +2914,13 @@ NVPTXTargetLowering::LowerSTOREVector(SDValue Op, SelectionDAG &DAG) const {
2914
2914
Ops.push_back (N->getOperand (0 ));
2915
2915
2916
2916
// Then the split values
2917
- if (ValVT.getVectorNumElements () > NumElts) {
2918
- // If the number of elements has changed, getVectorLoweringShape has upsized
2919
- // the element types
2920
- assert ((Isv2x16VT (EltVT) || EltVT == MVT::v4i8) && " Unexpected upsized type." );
2917
+ assert (NumElts <= ValVT.getVectorNumElements () &&
2918
+ " NumElts should not increase, only decrease or stay the same." );
2919
+ if (NumElts < ValVT.getVectorNumElements ()) {
2920
+ // If the number of elements has decreased, getVectorLoweringShape has
2921
+ // upsized the element types
2922
+ assert (EltVT.isVector () && EltVT.getSizeInBits () == 32 &&
2923
+ EltVT.getVectorNumElements () <= 4 && " Unexpected upsized type." );
2921
2924
// Combine individual elements into v2[i,f,bf]16/v4i8 subvectors to be
2922
2925
// stored as b32s
2923
2926
unsigned NumEltsPerSubVector = EltVT.getVectorNumElements ();
@@ -5288,11 +5291,13 @@ static void ReplaceLoadVector(SDNode *N, SelectionDAG &DAG,
5288
5291
LD->getMemOperand ());
5289
5292
5290
5293
SmallVector<SDValue> ScalarRes;
5291
- if (ResVT.getVectorNumElements () > NumElts) {
5292
- // If the number of elements has changed, getVectorLoweringShape has upsized
5293
- // the element types
5294
- assert ((Isv2x16VT (EltVT) || EltVT == MVT::v4i8) &&
5295
- " Unexpected upsized type." );
5294
+ assert (NumElts <= ResVT.getVectorNumElements () &&
5295
+ " NumElts should not increase, only decrease or stay the same." );
5296
+ if (NumElts < ResVT.getVectorNumElements ()) {
5297
+ // If the number of elements has decreased, getVectorLoweringShape has
5298
+ // upsized the element types
5299
+ assert (EltVT.isVector () && EltVT.getSizeInBits () == 32 &&
5300
+ EltVT.getVectorNumElements () <= 4 && " Unexpected upsized type." );
5296
5301
// Generate EXTRACT_VECTOR_ELTs to split v2[i,f,bf]16/v4i8 subvectors back
5297
5302
// into individual elements.
5298
5303
for (unsigned i = 0 ; i < NumElts; ++i) {
0 commit comments