@@ -2914,10 +2914,13 @@ NVPTXTargetLowering::LowerSTOREVector(SDValue Op, SelectionDAG &DAG) const {
29142914 Ops.push_back (N->getOperand (0 ));
29152915
29162916 // 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." );
29212924 // Combine individual elements into v2[i,f,bf]16/v4i8 subvectors to be
29222925 // stored as b32s
29232926 unsigned NumEltsPerSubVector = EltVT.getVectorNumElements ();
@@ -5288,11 +5291,13 @@ static void ReplaceLoadVector(SDNode *N, SelectionDAG &DAG,
52885291 LD->getMemOperand ());
52895292
52905293 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." );
52965301 // Generate EXTRACT_VECTOR_ELTs to split v2[i,f,bf]16/v4i8 subvectors back
52975302 // into individual elements.
52985303 for (unsigned i = 0 ; i < NumElts; ++i) {
0 commit comments