[Mlir-commits] [mlir] [mlir][arith] Add overflow flags support to arith ops (PR #77211)

Jakub Kuderski llvmlistbot at llvm.org
Sun Jan 7 15:01:14 PST 2024


================
@@ -203,15 +219,22 @@ def Arith_AddIOp : Arith_TotalIntBinaryOp<"addi", [Commutative]> {
 
     The `addi` operation takes two operands and returns one result, each of
     these is required to be the same type. This type may be an integer scalar type, 
-    a vector whose element type is integer, or a tensor of integers. It has no 
-    standard attributes.
+    a vector whose element type is integer, or a tensor of integers.
+
+    This op supports nuw/nsw flags which stands stand for "No Unsigned Wrap" and
+    "No Signed Wrap", respectively. If the nuw and/or nsw flags are present, the
+    result value is undefined if unsigned and/or signed overflow, respectively,
+    occurs.
----------------
kuhar wrote:

The result should be `poison`.

```suggestion
    This op supports `nuw`/`nsw` overflow flags which stands stand for "No Unsigned Wrap"
    and "No Signed Wrap", respectively. If the `nuw` and/or `nsw` flags are present,
    and an unsigned/signed overflow occurs (respectively), the result is poison.
```

https://github.com/llvm/llvm-project/pull/77211


More information about the Mlir-commits mailing list