forked from OSchip/llvm-project
[flang][OpenMP] Added support for lowering OpenMP taskyield construct
Summary: This patch lower `!OMP TASKYIELD` construct from PFT to OpenMPDialect operations. Construct is lowered with conformance to OpenMP 5.0 spec. Patch is carved out of following merged PR: https://github.com/flang-compiler/f18-llvm-project/pull/297 Reviewed: kiranchandramohan Differential Revision: https://reviews.llvm.org/D84350
This commit is contained in:
parent
b27ab9ce74
commit
9e4ab439c2
|
@ -39,7 +39,9 @@ static void genOMP(Fortran::lower::AbstractConverter &absConv,
|
|||
absConv.getCurrentLocation());
|
||||
break;
|
||||
case llvm::omp::Directive::OMPD_taskyield:
|
||||
TODO();
|
||||
absConv.getFirOpBuilder().create<mlir::omp::TaskyieldOp>(
|
||||
absConv.getCurrentLocation());
|
||||
break;
|
||||
case llvm::omp::Directive::OMPD_target_enter_data:
|
||||
TODO();
|
||||
case llvm::omp::Directive::OMPD_target_exit_data:
|
||||
|
|
|
@ -56,4 +56,19 @@ TEST_F(OpenMPLoweringTest, TaskWait) {
|
|||
EXPECT_EQ(succeeded(taskWaitOp.verify()), true);
|
||||
}
|
||||
|
||||
TEST_F(OpenMPLoweringTest, TaskYield) {
|
||||
// Construct a dummy parse tree node for `!OMP taskyield`.
|
||||
struct Fortran::parser::OmpSimpleStandaloneDirective taskYieldDirective(
|
||||
llvm::omp::Directive::OMPD_taskyield);
|
||||
|
||||
// Check and lower the `!OMP taskyield` node to `TaskYieldOp` operation of
|
||||
// OpenMPDialect.
|
||||
EXPECT_EQ(taskYieldDirective.v, llvm::omp::Directive::OMPD_taskyield);
|
||||
auto taskYieldOp = mlirOpBuilder->create<mlir::omp::TaskyieldOp>(
|
||||
mlirOpBuilder->getUnknownLoc());
|
||||
|
||||
EXPECT_EQ(taskYieldOp.getOperationName(), "omp.taskyield");
|
||||
EXPECT_EQ(succeeded(taskYieldOp.verify()), true);
|
||||
}
|
||||
|
||||
// main() from gtest_main
|
||||
|
|
Loading…
Reference in New Issue