[Mlir-commits] [mlir] MLIR: Add llvm.intr.coro.promise (PR #76640)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Sat Dec 30 14:47:36 PST 2023
https://github.com/yonillasky created https://github.com/llvm/llvm-project/pull/76640
Added to allow generating these intrinsics in out-of-tree MLIR passes.
>From 682fe62e9a667eb43e276589de7fc85ca51f87f4 Mon Sep 17 00:00:00 2001
From: Yoni Lavi <yoni.lavi at nextsilicon.com>
Date: Sat, 30 Dec 2023 23:48:06 +0200
Subject: [PATCH] MLIR: Add llvm.intr.coro.promise
---
mlir/include/mlir/Dialect/LLVMIR/LLVMIntrinsicOps.td | 7 +++++++
mlir/test/Target/LLVMIR/llvmir-intrinsics.mlir | 7 +++++++
2 files changed, 14 insertions(+)
diff --git a/mlir/include/mlir/Dialect/LLVMIR/LLVMIntrinsicOps.td b/mlir/include/mlir/Dialect/LLVMIR/LLVMIntrinsicOps.td
index a798cad6037776..d023cea37e6798 100644
--- a/mlir/include/mlir/Dialect/LLVMIR/LLVMIntrinsicOps.td
+++ b/mlir/include/mlir/Dialect/LLVMIR/LLVMIntrinsicOps.td
@@ -435,6 +435,13 @@ def LLVM_CoroResumeOp : LLVM_IntrOp<"coro.resume", [], [], [], 0> {
let assemblyFormat = "$handle attr-dict `:` qualified(type($handle))";
}
+def LLVM_CoroPromiseOp : LLVM_IntrOp<"coro.promise", [], [], [], 1> {
+ let arguments = (ins LLVM_AnyPointer:$handle,
+ I32:$align,
+ I1:$from);
+ let assemblyFormat = "$handle `,` $align `,` $from attr-dict `:` functional-type(operands, results)";
+}
+
//
// Debug function intrinsics.
//
diff --git a/mlir/test/Target/LLVMIR/llvmir-intrinsics.mlir b/mlir/test/Target/LLVMIR/llvmir-intrinsics.mlir
index 1c0aa8d3407ac6..bcd3ae10d9d9ce 100644
--- a/mlir/test/Target/LLVMIR/llvmir-intrinsics.mlir
+++ b/mlir/test/Target/LLVMIR/llvmir-intrinsics.mlir
@@ -712,6 +712,13 @@ llvm.func @coro_resume(%arg0: !llvm.ptr) {
llvm.return
}
+// CHECK-LABEL: @coro_promise
+llvm.func @coro_promise(%arg0: !llvm.ptr, %arg1 : i32, %arg2 : i1) {
+ // CHECK: call ptr @llvm.coro.promise
+ %0 = llvm.intr.coro.promise %arg0, %arg1, %arg2 : (!llvm.ptr, i32, i1) -> !llvm.ptr
+ llvm.return
+}
+
// CHECK-LABEL: @eh_typeid_for
llvm.func @eh_typeid_for(%arg0 : !llvm.ptr) {
// CHECK: call i32 @llvm.eh.typeid.for
More information about the Mlir-commits
mailing list