forked from OSchip/llvm-project
[MLIR][LLVM] Add memset intrinsic
Add memset intrinsic into LLVM dialect Reviewed By: mehdi_amini Differential Revision: https://reviews.llvm.org/D111906
This commit is contained in:
parent
d0dbc991c0
commit
40b9c39db1
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue