13 #ifndef MLIR_DIALECT_TOSA_IR_TOSAOPS_H
14 #define MLIR_DIALECT_TOSA_IR_TOSAOPS_H
30 #include "mlir/Dialect/Tosa/IR/TosaOpsDialect.h.inc"
33 class PatternRewriter;
42 #include "mlir/Dialect/Tosa/IR/TosaInterfaces.h.inc"
51 template <
typename ConcreteType>
53 :
public TraitBase<ConcreteType, MulOperandsAndResultElementType> {
60 if (llvm::isa<FloatType>(resElemType))
63 if (
auto resIntType = resElemType.dyn_cast<IntegerType>()) {
64 IntegerType lhsIntType =
66 IntegerType rhsIntType =
68 if (lhsIntType != rhsIntType)
69 return op->emitOpError(
70 "requires the same element type for all operands");
75 if (lhsIntType.getWidth() > resIntType.getWidth())
76 return op->emitOpError(
"invalid data type size for operands or result");
90 #define GET_ATTRDEF_CLASSES
91 #include "mlir/Dialect/Tosa/IR/TosaAttributes.h.inc"
93 #define GET_OP_CLASSES
94 #include "mlir/Dialect/Tosa/IR/TosaOps.h.inc"
Helper class for implementing traits.
static LogicalResult verifyTrait(Operation *op)
Operation is the basic unit of execution within MLIR.
LogicalResult verifySameOperandsAndResultElementType(Operation *op)
ParseResult parseTypeOrAttr(OpAsmParser &parser, TypeAttr &typeAttr, Attribute &attr)
void printTypeOrAttr(OpAsmPrinter &p, Operation *op, TypeAttr type, Attribute attr)
Include the generated interface declarations.
LogicalResult failure(bool isFailure=true)
Utility function to generate a LogicalResult.
LogicalResult success(bool isSuccess=true)
Utility function to generate a LogicalResult.
Type getElementTypeOrSelf(Type type)
Return the element type or return the type itself.
This class represents an efficient way to signal success or failure.