@@ -1106,7 +1106,7 @@ struct ConvertVectorMaskedLoad final
1106
1106
// / * vector<4xi4> -> i8 - yes (N = 2)
1107
1107
// / * vector<3xi4> -> i8 - no (N would have to be 1.5)
1108
1108
// / * vector<3xi2> -> i16 - no (N would have to be 0.5)
1109
- static bool isSubByteVecFittable (VectorType subByteVecTy,
1109
+ static bool fitsInMultiByteContainerTy (VectorType subByteVecTy,
1110
1110
Type multiByteScalarTy) {
1111
1111
assert ((isa<IntegerType, FloatType>(multiByteScalarTy)) && " Not scalar!" );
1112
1112
@@ -1160,7 +1160,7 @@ struct ConvertVectorTransferRead final
1160
1160
1161
1161
// Note, per-element-alignment was already verified above.
1162
1162
bool isFullyAligned =
1163
- isSubByteVecFittable (op.getVectorType (), containerElemTy);
1163
+ fitsInMultiByteContainerTy (op.getVectorType (), containerElemTy);
1164
1164
1165
1165
auto newPadding = rewriter.create <arith::ExtUIOp>(loc, containerElemTy,
1166
1166
adaptor.getPadding ());
@@ -1496,38 +1496,31 @@ static LogicalResult alignedConversionPrecondition(PatternRewriter &rewriter,
1496
1496
VectorType subByteVecTy,
1497
1497
Type containerTy,
1498
1498
Operation *op) {
1499
+ assert (containerTy.isIntOrFloat () &&
1500
+ " container element type is not a scalar" );
1501
+
1499
1502
// TODO: This is validating the inputs rather than checking the conditions
1500
1503
// documented above. Replace with an assert.
1501
1504
if (!subByteVecTy)
1502
1505
return rewriter.notifyMatchFailure (op, " not a vector!" );
1503
1506
1504
- // TODO: This is validating the inputs rather than checking the conditions
1505
- // documented above. Replace with an assert.
1506
- if (!containerTy.isIntOrFloat ())
1507
- return rewriter.notifyMatchFailure (op, " not a scalar!" );
1508
-
1509
1507
unsigned subByteBits = subByteVecTy.getElementTypeBitWidth ();
1510
1508
unsigned multiByteBits = containerTy.getIntOrFloatBitWidth ();
1511
1509
1512
1510
// Enforced by the common pre-conditions.
1513
1511
assert (multiByteBits % 8 == 0 && " Not a multi-byte scalar type!" );
1514
1512
1515
- // TODO: Remove this condition - the assert above (and
1516
- // commonConversionPrecondtion) takes care of that.
1517
- if (multiByteBits < 8 )
1518
- return rewriter.notifyMatchFailure (op, " not a multi-byte scalar type!" );
1519
-
1520
1513
// TODO: Add support other widths (when/if needed)
1521
1514
if (subByteBits != 2 && subByteBits != 4 )
1522
1515
return rewriter.notifyMatchFailure (
1523
1516
op, " only 2-bit and 4-bit sub-byte type is supported at this moment" );
1524
1517
1525
- // Condition 1.
1518
+ // Condition 1 ("per-element" alignment)
1526
1519
if (multiByteBits % subByteBits != 0 )
1527
1520
return rewriter.notifyMatchFailure (op, " unalagined element types" );
1528
1521
1529
- // Condition 2.
1530
- if (!isSubByteVecFittable (subByteVecTy, containerTy))
1522
+ // Condition 2 ("full" alignment)
1523
+ if (!fitsInMultiByteContainerTy (subByteVecTy, containerTy))
1531
1524
return rewriter.notifyMatchFailure (
1532
1525
op, " not possible to fit this sub-byte vector type into a vector of "
1533
1526
" the given multi-byte type" );
0 commit comments