@@ -344,14 +344,27 @@ void RawBufferAtomicCmpswapOp::getCanonicalizationPatterns(
344344LogicalResult ScaledExtPacked816Op::verify () {
345345 int blockSize = getBlockSize ();
346346 assert ((blockSize == 16 || blockSize == 32 ) && " invalid block size" );
347+
347348 int firstScaleByte = getFirstScaleByte ();
348- if (blockSize == 16 && !llvm::is_contained ({0 , 1 }, firstScaleByte)) {
349- return emitOpError (
350- " blockSize of 16 can only have firstScaleByte be 0 or 1." );
349+ auto sourceType = cast<VectorType>(getSource ().getType ());
350+ Type elementType = sourceType.getElementType ();
351+ auto floatType = cast<FloatType>(elementType);
352+ int bitWidth = floatType.getWidth ();
353+
354+ if (llvm::is_contained ({4 , 6 }, bitWidth) && blockSize == 16 &&
355+ !llvm::is_contained ({0 , 1 }, firstScaleByte)) {
356+ return emitOpError (" blockSize of 16 can only have firstScaleByte be 0 or 1 "
357+ " for f4 and f6." );
358+ }
359+ if (llvm::is_contained ({4 , 6 }, bitWidth) && blockSize == 32 &&
360+ !llvm::is_contained ({0 , 2 }, firstScaleByte)) {
361+ return emitOpError (" blockSize of 32 can only have firstScaleByte be 0 or 2 "
362+ " for f4 and f6." );
351363 }
352- if (blockSize == 32 && !llvm::is_contained ({0 , 2 }, firstScaleByte)) {
364+ if (bitWidth == 8 && blockSize == 16 &&
365+ !llvm::is_contained ({0 , 2 }, firstScaleByte)) {
353366 return emitOpError (
354- " blockSize of 32 can only have firstScaleByte be 0 or 2." );
367+ " blockSize of 16 can only have firstScaleByte be 0 or 2 for f8 ." );
355368 }
356369
357370 return success ();
0 commit comments