[mlir] Add stacksave, stackrestore to llvm dialect

Reviewed By: ftynse

Differential Revision: https://reviews.llvm.org/D96333
This commit is contained in:
Denys Shabalin 2021-02-09 15:09:02 +01:00 committed by Alex Zinenko
parent 98146c1f5d
commit fa581f9438
2 changed files with 27 additions and 0 deletions

View File

@ -1277,6 +1277,19 @@ def LLVM_CoroResumeOp : LLVM_IntrOp<"coro.resume", [], [], [], 0> {
let assemblyFormat = "$handle attr-dict";
}
//
// Stack save/restore intrinsics.
//
def LLVM_StackSaveOp : LLVM_OneResultIntrOp<"stacksave"> {
let assemblyFormat = "attr-dict `:` type($res)";
}
def LLVM_StackRestoreOp : LLVM_ZeroResultIntrOp<"stackrestore"> {
let arguments = (ins LLVM_i8Ptr:$ptr);
let assemblyFormat = "$ptr attr-dict";
}
//
// Vector Reductions.
//

View File

@ -405,6 +405,20 @@ llvm.func @coro_resume(%arg0: !llvm.ptr<i8>) {
llvm.return
}
// CHECK-LABEL: @stack_save
llvm.func @stack_save() {
// CHECK: call i8* @llvm.stacksave
%0 = llvm.intr.stacksave : !llvm.ptr<i8>
llvm.return
}
// CHECK-LABEL: @stack_restore
llvm.func @stack_restore(%arg0: !llvm.ptr<i8>) {
// CHECK: call void @llvm.stackrestore
llvm.intr.stackrestore %arg0
llvm.return
}
// Check that intrinsics are declared with appropriate types.
// CHECK-DAG: declare float @llvm.fma.f32(float, float, float)
// CHECK-DAG: declare <8 x float> @llvm.fma.v8f32(<8 x float>, <8 x float>, <8 x float>) #0