aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/parse.c
diff options
context:
space:
mode:
authorTobias Burnus <tobias@codesourcery.com>2021-06-01 12:46:37 +0200
committerTobias Burnus <tobias@codesourcery.com>2021-06-01 12:47:57 +0200
commitf6bf436d9ab907d090823895abb7a2d5ba7ff50c (patch)
tree3a378e9201640f8b0a3a961d22fb5763459fdc64 /gcc/fortran/parse.c
parent28daadc98094501175c9dfe4a985871fa6aa4f94 (diff)
downloadgcc-f6bf436d9ab907d090823895abb7a2d5ba7ff50c.zip
gcc-f6bf436d9ab907d090823895abb7a2d5ba7ff50c.tar.gz
gcc-f6bf436d9ab907d090823895abb7a2d5ba7ff50c.tar.bz2
Fortran/OpenMP: Support (parallel) master taskloop (simd) [PR99928]
PR middle-end/99928 gcc/fortran/ChangeLog: * dump-parse-tree.c (show_omp_node, show_code_node): Handle (parallel) master taskloop (simd). * frontend-passes.c (gfc_code_walker): Set in_omp_workshare to false for parallel master taskloop (simd). * gfortran.h (enum gfc_statement): Add ST_OMP_(END_)(PARALLEL_)MASTER_TASKLOOP(_SIMD). (enum gfc_exec_op): EXEC_OMP_(PARALLEL_)MASTER_TASKLOOP(_SIMD). * match.h (gfc_match_omp_master_taskloop, gfc_match_omp_master_taskloop_simd, gfc_match_omp_parallel_master_taskloop, gfc_match_omp_parallel_master_taskloop_simd): New prototype. * openmp.c (gfc_match_omp_parallel_master_taskloop, gfc_match_omp_parallel_master_taskloop_simd, gfc_match_omp_master_taskloop, gfc_match_omp_master_taskloop_simd): New. (gfc_match_omp_taskloop_simd): Permit 'reduction' clause. (resolve_omp_clauses): Handle new combined directives; remove inscan-reduction check to reduce multiple errors; add task-reduction error for 'taskloop simd'. (gfc_resolve_omp_parallel_blocks, resolve_omp_do, omp_code_to_statement, gfc_resolve_omp_directive): Handle new combined constructs. * parse.c (decode_omp_directive, next_statement, gfc_ascii_statement, parse_omp_do, parse_omp_structured_block, parse_executable): Likewise. * resolve.c (gfc_resolve_blocks, gfc_resolve_code): Likewise. * st.c (gfc_free_statement): Likewise. * trans.c (trans_code): Likewise. * trans-openmp.c (gfc_split_omp_clauses, gfc_trans_omp_directive): Likewise. (gfc_trans_omp_parallel_master): Move after gfc_trans_omp_master_taskloop; handle parallel master taskloop (simd) as well. (gfc_trans_omp_taskloop): Take gfc_exec_op as arg. (gfc_trans_omp_master_taskloop): New. gcc/testsuite/ChangeLog: * gfortran.dg/gomp/reduction5.f90: Remove dg-error; the issue is now diagnosed with less error output. * gfortran.dg/gomp/scan-1.f90: Likewise. * gfortran.dg/gomp/pr99928-3.f90: New test. * gfortran.dg/gomp/taskloop-1.f90: New test.
Diffstat (limited to 'gcc/fortran/parse.c')
-rw-r--r--gcc/fortran/parse.c73
1 files changed, 72 insertions, 1 deletions
diff --git a/gcc/fortran/parse.c b/gcc/fortran/parse.c
index 6efb3fd..c44e23c 100644
--- a/gcc/fortran/parse.c
+++ b/gcc/fortran/parse.c
@@ -920,11 +920,19 @@ decode_omp_directive (void)
matchs ("end do simd", gfc_match_omp_end_nowait, ST_OMP_END_DO_SIMD);
matcho ("end do", gfc_match_omp_end_nowait, ST_OMP_END_DO);
matchs ("end simd", gfc_match_omp_eos_error, ST_OMP_END_SIMD);
+ matcho ("end master taskloop simd", gfc_match_omp_eos_error,
+ ST_OMP_END_MASTER_TASKLOOP_SIMD);
+ matcho ("end master taskloop", gfc_match_omp_eos_error,
+ ST_OMP_END_MASTER_TASKLOOP);
matcho ("end master", gfc_match_omp_eos_error, ST_OMP_END_MASTER);
matchs ("end ordered", gfc_match_omp_eos_error, ST_OMP_END_ORDERED);
matchs ("end parallel do simd", gfc_match_omp_eos_error,
ST_OMP_END_PARALLEL_DO_SIMD);
matcho ("end parallel do", gfc_match_omp_eos_error, ST_OMP_END_PARALLEL_DO);
+ matcho ("end parallel master taskloop simd", gfc_match_omp_eos_error,
+ ST_OMP_END_PARALLEL_MASTER_TASKLOOP_SIMD);
+ matcho ("end parallel master taskloop", gfc_match_omp_eos_error,
+ ST_OMP_END_PARALLEL_MASTER_TASKLOOP);
matcho ("end parallel master", gfc_match_omp_eos_error,
ST_OMP_END_PARALLEL_MASTER);
matcho ("end parallel sections", gfc_match_omp_eos_error,
@@ -974,6 +982,10 @@ decode_omp_directive (void)
matcho ("flush", gfc_match_omp_flush, ST_OMP_FLUSH);
break;
case 'm':
+ matcho ("master taskloop simd", gfc_match_omp_master_taskloop_simd,
+ ST_OMP_MASTER_TASKLOOP_SIMD);
+ matcho ("master taskloop", gfc_match_omp_master_taskloop,
+ ST_OMP_MASTER_TASKLOOP);
matcho ("master", gfc_match_omp_master, ST_OMP_MASTER);
break;
case 'o':
@@ -992,6 +1004,12 @@ decode_omp_directive (void)
matchs ("parallel do simd", gfc_match_omp_parallel_do_simd,
ST_OMP_PARALLEL_DO_SIMD);
matcho ("parallel do", gfc_match_omp_parallel_do, ST_OMP_PARALLEL_DO);
+ matcho ("parallel master taskloop simd",
+ gfc_match_omp_parallel_master_taskloop_simd,
+ ST_OMP_PARALLEL_MASTER_TASKLOOP_SIMD);
+ matcho ("parallel master taskloop",
+ gfc_match_omp_parallel_master_taskloop,
+ ST_OMP_PARALLEL_MASTER_TASKLOOP);
matcho ("parallel master", gfc_match_omp_parallel_master,
ST_OMP_PARALLEL_MASTER);
matcho ("parallel sections", gfc_match_omp_parallel_sections,
@@ -1610,8 +1628,11 @@ next_statement (void)
case ST_IF_BLOCK: case ST_BLOCK: case ST_ASSOCIATE: \
case ST_WHERE_BLOCK: case ST_SELECT_CASE: case ST_SELECT_TYPE: \
case ST_SELECT_RANK: case ST_OMP_PARALLEL: case ST_OMP_PARALLEL_MASTER: \
+ case ST_OMP_PARALLEL_MASTER_TASKLOOP: \
+ case ST_OMP_PARALLEL_MASTER_TASKLOOP_SIMD: \
case ST_OMP_PARALLEL_SECTIONS: case ST_OMP_SECTIONS: case ST_OMP_ORDERED: \
- case ST_OMP_CRITICAL: case ST_OMP_MASTER: case ST_OMP_SINGLE: \
+ case ST_OMP_CRITICAL: case ST_OMP_MASTER: case ST_OMP_MASTER_TASKLOOP: \
+ case ST_OMP_MASTER_TASKLOOP_SIMD: case ST_OMP_SINGLE: \
case ST_OMP_DO: case ST_OMP_PARALLEL_DO: case ST_OMP_ATOMIC: \
case ST_OMP_WORKSHARE: case ST_OMP_PARALLEL_WORKSHARE: \
case ST_OMP_TASK: case ST_OMP_TASKGROUP: case ST_OMP_SIMD: \
@@ -2341,6 +2362,12 @@ gfc_ascii_statement (gfc_statement st)
case ST_OMP_END_MASTER:
p = "!$OMP END MASTER";
break;
+ case ST_OMP_END_MASTER_TASKLOOP:
+ p = "!$OMP END MASTER TASKLOOP";
+ break;
+ case ST_OMP_END_MASTER_TASKLOOP_SIMD:
+ p = "!$OMP END MASTER TASKLOOP SIMD";
+ break;
case ST_OMP_END_ORDERED:
p = "!$OMP END ORDERED";
break;
@@ -2356,6 +2383,12 @@ gfc_ascii_statement (gfc_statement st)
case ST_OMP_END_PARALLEL_MASTER:
p = "!$OMP END PARALLEL MASTER";
break;
+ case ST_OMP_END_PARALLEL_MASTER_TASKLOOP:
+ p = "!$OMP END PARALLEL MASTER TASKLOOP";
+ break;
+ case ST_OMP_END_PARALLEL_MASTER_TASKLOOP_SIMD:
+ p = "!$OMP END PARALLEL MASTER TASKLOOP SIMD";
+ break;
case ST_OMP_END_PARALLEL_SECTIONS:
p = "!$OMP END PARALLEL SECTIONS";
break;
@@ -2437,6 +2470,12 @@ gfc_ascii_statement (gfc_statement st)
case ST_OMP_MASTER:
p = "!$OMP MASTER";
break;
+ case ST_OMP_MASTER_TASKLOOP:
+ p = "!$OMP MASTER TASKLOOP";
+ break;
+ case ST_OMP_MASTER_TASKLOOP_SIMD:
+ p = "!$OMP MASTER TASKLOOP SIMD";
+ break;
case ST_OMP_ORDERED:
case ST_OMP_ORDERED_DEPEND:
p = "!$OMP ORDERED";
@@ -2453,6 +2492,12 @@ gfc_ascii_statement (gfc_statement st)
case ST_OMP_PARALLEL_MASTER:
p = "!$OMP PARALLEL MASTER";
break;
+ case ST_OMP_PARALLEL_MASTER_TASKLOOP:
+ p = "!$OMP PARALLEL MASTER TASKLOOP";
+ break;
+ case ST_OMP_PARALLEL_MASTER_TASKLOOP_SIMD:
+ p = "!$OMP PARALLEL MASTER TASKLOOP SIMD";
+ break;
case ST_OMP_PARALLEL_SECTIONS:
p = "!$OMP PARALLEL SECTIONS";
break;
@@ -5025,6 +5070,16 @@ parse_omp_do (gfc_statement omp_st)
break;
case ST_OMP_TASKLOOP: omp_end_st = ST_OMP_END_TASKLOOP; break;
case ST_OMP_TASKLOOP_SIMD: omp_end_st = ST_OMP_END_TASKLOOP_SIMD; break;
+ case ST_OMP_MASTER_TASKLOOP: omp_end_st = ST_OMP_END_MASTER_TASKLOOP; break;
+ case ST_OMP_MASTER_TASKLOOP_SIMD:
+ omp_end_st = ST_OMP_END_MASTER_TASKLOOP_SIMD;
+ break;
+ case ST_OMP_PARALLEL_MASTER_TASKLOOP:
+ omp_end_st = ST_OMP_END_PARALLEL_MASTER_TASKLOOP;
+ break;
+ case ST_OMP_PARALLEL_MASTER_TASKLOOP_SIMD:
+ omp_end_st = ST_OMP_END_PARALLEL_MASTER_TASKLOOP_SIMD;
+ break;
case ST_OMP_TEAMS_DISTRIBUTE:
omp_end_st = ST_OMP_END_TEAMS_DISTRIBUTE;
break;
@@ -5268,6 +5323,12 @@ parse_omp_structured_block (gfc_statement omp_st, bool workshare_stmts_only)
case ST_OMP_PARALLEL_MASTER:
omp_end_st = ST_OMP_END_PARALLEL_MASTER;
break;
+ case ST_OMP_PARALLEL_MASTER_TASKLOOP:
+ omp_end_st = ST_OMP_END_PARALLEL_MASTER_TASKLOOP;
+ break;
+ case ST_OMP_PARALLEL_MASTER_TASKLOOP_SIMD:
+ omp_end_st = ST_OMP_END_PARALLEL_MASTER_TASKLOOP_SIMD;
+ break;
case ST_OMP_PARALLEL_SECTIONS:
omp_end_st = ST_OMP_END_PARALLEL_SECTIONS;
break;
@@ -5283,6 +5344,12 @@ parse_omp_structured_block (gfc_statement omp_st, bool workshare_stmts_only)
case ST_OMP_MASTER:
omp_end_st = ST_OMP_END_MASTER;
break;
+ case ST_OMP_MASTER_TASKLOOP:
+ omp_end_st = ST_OMP_END_MASTER_TASKLOOP;
+ break;
+ case ST_OMP_MASTER_TASKLOOP_SIMD:
+ omp_end_st = ST_OMP_END_MASTER_TASKLOOP_SIMD;
+ break;
case ST_OMP_SINGLE:
omp_end_st = ST_OMP_END_SINGLE;
break;
@@ -5624,6 +5691,10 @@ parse_executable (gfc_statement st)
case ST_OMP_DO_SIMD:
case ST_OMP_PARALLEL_DO:
case ST_OMP_PARALLEL_DO_SIMD:
+ case ST_OMP_PARALLEL_MASTER_TASKLOOP:
+ case ST_OMP_PARALLEL_MASTER_TASKLOOP_SIMD:
+ case ST_OMP_MASTER_TASKLOOP:
+ case ST_OMP_MASTER_TASKLOOP_SIMD:
case ST_OMP_SIMD:
case ST_OMP_TARGET_PARALLEL_DO:
case ST_OMP_TARGET_PARALLEL_DO_SIMD: