[Mlir-commits] [mlir] [mlir][llvmir] Added extra builders for CallInstrinsicOp (PR #111664)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Wed Oct 9 04:52:48 PDT 2024
https://github.com/FMarno created https://github.com/llvm/llvm-project/pull/111664
I've added the extra builders I would like to see for CallIntrinsicOp.
This is inspired by the comment from @antiagainst from [here](https://github.com/llvm/llvm-project/pull/108933#issuecomment-2392751569). I am also building Triton.
>From 6be01c87f62d4ee08295004b143be6e2e061a8b1 Mon Sep 17 00:00:00 2001
From: Finlay Marno <finlay.marno at codeplay.com>
Date: Wed, 9 Oct 2024 11:56:59 +0100
Subject: [PATCH] [mlir][llvmir] Added extra builders for CallInstrinsicOp
---
mlir/include/mlir/Dialect/LLVMIR/LLVMOps.td | 5 +++++
mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp | 19 +++++++++++++++++++
2 files changed, 24 insertions(+)
diff --git a/mlir/include/mlir/Dialect/LLVMIR/LLVMOps.td b/mlir/include/mlir/Dialect/LLVMIR/LLVMOps.td
index 88e82ce48959b0..ff5199fe40d124 100644
--- a/mlir/include/mlir/Dialect/LLVMIR/LLVMOps.td
+++ b/mlir/include/mlir/Dialect/LLVMIR/LLVMOps.td
@@ -1943,6 +1943,11 @@ def LLVM_CallIntrinsicOp
attr-dict
}];
+ let builders = [
+ OpBuilder<(ins "Type": $results, "StringAttr":$intrin, "ValueRange":$args)>,
+ OpBuilder<(ins "TypeRange": $results, "StringAttr":$intrin, "ValueRange":$args, "FastmathFlagsAttr":$fastMathFlags)>
+ ];
+
let hasVerifier = 1;
}
diff --git a/mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp b/mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp
index fb7024a14f8d4e..27cbd77f110326 100644
--- a/mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp
+++ b/mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp
@@ -3353,6 +3353,25 @@ struct LLVMOpAsmDialectInterface : public OpAsmDialectInterface {
};
} // namespace
+//===----------------------------------------------------------------------===//
+// CallIntrinsicOp
+//===----------------------------------------------------------------------===//
+
+void CallIntrinsicOp::build(OpBuilder &builder, OperationState &state,
+ mlir::TypeRange results, mlir::StringAttr intrin,
+ mlir::ValueRange args,
+ mlir::LLVM::FastmathFlagsAttr fastMathFlags) {
+
+ build(builder, state, results, intrin, args, fastMathFlags,
+ llvm::ArrayRef<mlir::ValueRange>{});
+}
+void CallIntrinsicOp::build(OpBuilder &builder, OperationState &state,
+ mlir::Type results, mlir::StringAttr intrin,
+ mlir::ValueRange args) {
+ build(builder, state, {results}, intrin, args, FastmathFlagsAttr{},
+ llvm::ArrayRef<mlir::ValueRange>{});
+}
+
//===----------------------------------------------------------------------===//
// LinkerOptionsOp
//===----------------------------------------------------------------------===//
More information about the Mlir-commits
mailing list