[Mlir-commits] [mlir] [mlir][arith] Add overflow flags support to arith ops (PR #77211)
Tobias Gysi
llvmlistbot at llvm.org
Sun Jan 7 23:23:28 PST 2024
================
@@ -137,6 +137,22 @@ class Arith_CompareOpOfAnyRank<string mnemonic, list<Trait> traits = []> :
let results = (outs BoolLikeOfAnyRank:$result);
}
+class Arith_IntArithmeticOpWithOverflowFlag<string mnemonic, list<Trait> traits = []> :
+ Arith_BinaryOp<mnemonic, traits #
+ [Pure, DeclareOpInterfaceMethods<InferIntRangeInterface>,
+ DeclareOpInterfaceMethods<ArithIntegerOverflowFlagsInterface>]>,
+ Arguments<(ins SignlessIntegerLike:$lhs, SignlessIntegerLike:$rhs,
+ DefaultValuedAttr<
+ Arith_IntegerOverflowAttr, "::mlir::arith::IntegerOverflowFlags::none">:$overflowFlags)>,
+ Results<(outs SignlessIntegerLike:$result)> {
+
+ let assemblyFormat = [{ $lhs `,` $rhs (`overflow` `` $overflowFlags^)?
+ attr-dict `:` type($result) }];
+
+ let hasFolder = 1;
+ let hasCanonicalizer = 1;
----------------
gysit wrote:
The derived ops still seem to set the folder and canonicalizer flags? I guess the flags should only be here or on the derived ops?
https://github.com/llvm/llvm-project/pull/77211
More information about the Mlir-commits
mailing list