[Mlir-commits] [mlir] [mlir][ptr] Add the `ptradd` and `type_offset` ops, and `int_space` attr (PR #136434)
Tobias Gysi
llvmlistbot at llvm.org
Sat Apr 19 12:11:53 PDT 2025
================
@@ -12,6 +12,69 @@
include "mlir/Dialect/Ptr/IR/PtrDialect.td"
include "mlir/Dialect/Ptr/IR/PtrAttrDefs.td"
include "mlir/Dialect/Ptr/IR/MemorySpaceInterfaces.td"
+include "mlir/Interfaces/SideEffectInterfaces.td"
include "mlir/IR/OpAsmInterface.td"
+//===----------------------------------------------------------------------===//
+// PtrAddOp
+//===----------------------------------------------------------------------===//
+
+def Ptr_PtrAddOp : Pointer_Op<"ptradd", [
+ Pure, AllTypesMatch<["base", "result"]>
+ ]> {
+ let summary = "Pointer add operation";
+ let description = [{
+ The `ptradd` operation adds an integer offset to a pointer to produce a new
+ pointer. The input and output pointer types are always the same.
+
+ Example:
+
+ ```mlir
+ %x_off = ptr.ptradd %x, %off : !ptr.ptr<0>, i32
----------------
gysit wrote:
I guess in the future we may also want to add some overflow flag that specifies the behavior of the op in case of an integer overflow similar to gep's inbounds / nusw (at least if the index type is an integer with a specified bit width and not index type)?
https://github.com/llvm/llvm-project/pull/136434
More information about the Mlir-commits
mailing list