#include "mlir/Dialect/Func/Transforms/FuncConversions.h"
#include "mlir/Dialect/Vector/IR/VectorOps.h"
#include "mlir/Transforms/DialectConversion.h"
+#include "llvm/Support/FormatVariadic.h"
#include "llvm/Support/MathExtras.h"
#include <cassert>
->convertType(op.getType())
.dyn_cast_or_null<VectorType>();
if (!newTy)
- return rewriter.notifyMatchFailure(loc, "expected scalar or vector type");
+ return rewriter.notifyMatchFailure(
+ loc, llvm::formatv("unsupported type: {0}", op.getType()));
Type newElemTy = reduceInnermostDim(newTy);
->convertType(op.getType())
.template dyn_cast_or_null<VectorType>();
if (!newTy)
- return rewriter.notifyMatchFailure(loc, "unsupported type");
+ return rewriter.notifyMatchFailure(
+ loc, llvm::formatv("unsupported type: {0}", op.getType()));
auto [lhsElem0, lhsElem1] =
extractLastDimHalves(rewriter, loc, adaptor.getLhs());
->convertType(op.getType())
.dyn_cast_or_null<VectorType>();
if (!newTy)
- return rewriter.notifyMatchFailure(loc, "expected scalar or vector type");
+ return rewriter.notifyMatchFailure(
+ loc, llvm::formatv("unsupported type: {0}", op.getType()));
Type newElemTy = reduceInnermostDim(newTy);
unsigned newBitWidth = newTy.getElementTypeBitWidth();
->convertType(op.getType())
.dyn_cast_or_null<VectorType>();
if (!newTy)
- return rewriter.notifyMatchFailure(loc, "unsupported type");
+ return rewriter.notifyMatchFailure(
+ loc, llvm::formatv("unsupported type: {0}", op.getType()));
Type newResultComponentTy = reduceInnermostDim(newTy);
->convertType(op.getType())
.dyn_cast_or_null<VectorType>();
if (!newTy)
- return rewriter.notifyMatchFailure(loc, "unsupported type");
+ return rewriter.notifyMatchFailure(
+ loc, llvm::formatv("unsupported type: {0}", op.getType()));
Type newResultComponentTy = reduceInnermostDim(newTy);
auto newTy =
getTypeConverter()->convertType(oldTy).dyn_cast_or_null<VectorType>();
if (!newTy)
- return rewriter.notifyMatchFailure(loc, "unsupported type");
+ return rewriter.notifyMatchFailure(
+ loc, llvm::formatv("unsupported type: {0}", op.getType()));
Type newOperandTy = reduceInnermostDim(newTy);
// `oldBitWidth` == `2 * newBitWidth`
auto newTy =
getTypeConverter()->convertType(oldTy).dyn_cast_or_null<VectorType>();
if (!newTy)
- return rewriter.notifyMatchFailure(loc, "unsupported type");
+ return rewriter.notifyMatchFailure(
+ loc, llvm::formatv("unsupported type: {0}", op.getType()));
Type newOperandTy = reduceInnermostDim(newTy);
// `oldBitWidth` == `2 * newBitWidth`
// Check if the result type is legal for this target. Currently, we do not
// support truncation to types wider than supported by the target.
if (!getTypeConverter()->isLegal(op.getType()))
- return rewriter.notifyMatchFailure(loc,
- "unsupported truncation result type");
+ return rewriter.notifyMatchFailure(
+ loc, llvm::formatv("unsupported truncation result type: {0}",
+ op.getType()));
// Discard the high half of the input. Truncate the low half, if necessary.
Value extracted = extractLastDimSlice(rewriter, loc, adaptor.getIn(), 0);