[Mlir-commits] [mlir] 40b9c39 - [MLIR][LLVM] Add memset intrinsic
William S. Moses
llvmlistbot at llvm.org
Sat Oct 16 15:20:52 PDT 2021
Author: William S. Moses
Date: 2021-10-16T18:20:48-04:00
New Revision: 40b9c39db15929b2b70762b68ecc6c16721f9fb1
URL: https://github.com/llvm/llvm-project/commit/40b9c39db15929b2b70762b68ecc6c16721f9fb1
DIFF: https://github.com/llvm/llvm-project/commit/40b9c39db15929b2b70762b68ecc6c16721f9fb1.diff
LOG: [MLIR][LLVM] Add memset intrinsic
Add memset intrinsic into LLVM dialect
Reviewed By: mehdi_amini
Differential Revision: https://reviews.llvm.org/D111906
Added:
Modified:
mlir/include/mlir/Dialect/LLVMIR/LLVMOps.td
mlir/test/Target/LLVMIR/llvmir-intrinsics.mlir
Removed:
################################################################################
diff --git a/mlir/include/mlir/Dialect/LLVMIR/LLVMOps.td b/mlir/include/mlir/Dialect/LLVMIR/LLVMOps.td
index 8176c3fefea9c..1e41587404c67 100644
--- a/mlir/include/mlir/Dialect/LLVMIR/LLVMOps.td
+++ b/mlir/include/mlir/Dialect/LLVMIR/LLVMOps.td
@@ -1384,6 +1384,11 @@ def LLVM_MemcpyInlineOp : LLVM_ZeroResultIntrOp<"memcpy.inline", [0, 1, 2]> {
LLVM_Type:$isVolatile);
}
+def LLVM_MemsetOp : LLVM_ZeroResultIntrOp<"memset", [0, 2]> {
+ let arguments = (ins LLVM_Type:$dst, LLVM_Type:$val, LLVM_Type:$len,
+ LLVM_Type:$isVolatile);
+}
+
// Intrinsics with multiple returns.
def LLVM_SAddWithOverflowOp
diff --git a/mlir/test/Target/LLVMIR/llvmir-intrinsics.mlir b/mlir/test/Target/LLVMIR/llvmir-intrinsics.mlir
index 8eff72c0e021f..0a4bf63d0c3c1 100644
--- a/mlir/test/Target/LLVMIR/llvmir-intrinsics.mlir
+++ b/mlir/test/Target/LLVMIR/llvmir-intrinsics.mlir
@@ -312,6 +312,14 @@ llvm.func @memcpy_test(%arg0: i32, %arg2: !llvm.ptr<i8>, %arg3: !llvm.ptr<i8>) {
llvm.return
}
+// CHECK-LABEL: @memset_test
+llvm.func @memset_test(%arg0: i32, %arg2: !llvm.ptr<i8>, %arg3: i8) {
+ %i1 = llvm.mlir.constant(false) : i1
+ // CHECK: call void @llvm.memset.p0i8.i32(i8* %{{.*}}, i8 %{{.*}}, i32 %{{.*}}, i1 {{.*}})
+ "llvm.intr.memset"(%arg2, %arg3, %arg0, %i1) : (!llvm.ptr<i8>, i8, i32, i1) -> ()
+ llvm.return
+}
+
// CHECK-LABEL: @sadd_with_overflow_test
llvm.func @sadd_with_overflow_test(%arg0: i32, %arg1: i32, %arg2: vector<8xi32>, %arg3: vector<8xi32>) {
// CHECK: call { i32, i1 } @llvm.sadd.with.overflow.i32
More information about the Mlir-commits
mailing list