]> git.ipfire.org Git - thirdparty/gcc.git/commit - gcc/fortran/gfortran.h
Fortran/OpenMP: Add omp loop [PR99928]
authorTobias Burnus <tobias@codesourcery.com>
Fri, 4 Jun 2021 10:06:59 +0000 (12:06 +0200)
committerTobias Burnus <tobias@codesourcery.com>
Fri, 4 Jun 2021 10:08:24 +0000 (12:08 +0200)
commit178191e1dfafd8db149edcdef7a39e9e2c00f216
tree85549e8299e3e53dc2446dcd95ee738945c8ee81
parentb7dd2e4eeb44bc8678ecde8a6c7401de85e63561
Fortran/OpenMP: Add omp loop [PR99928]

PR middle-end/99928

gcc/fortran/ChangeLog:

* dump-parse-tree.c (show_omp_clauses): Handle bind clause.
(show_omp_node): Handle loop directive.
* frontend-passes.c (gfc_code_walker): Likewise.
* gfortran.h (enum gfc_statement): Add
ST_OMP_(END_)(TARGET_)(|PARALLEL_|TEAMS_)LOOP.
(enum gfc_omp_bind_type): New.
(gfc_omp_clauses): Use it.
(enum gfc_exec_op): Add EXEC_OMP_(TARGET_)(|PARALLEL_|TEAMS_)LOOP.
* match.h (gfc_match_omp_loop, gfc_match_omp_parallel_loop,
gfc_match_omp_target_parallel_loop, gfc_match_omp_target_teams_loop,
gfc_match_omp_teams_loop): New.
* openmp.c (enum omp_mask1): Add OMP_CLAUSE_BIND.
(gfc_match_omp_clauses): Handle it.
(OMP_LOOP_CLAUSES, gfc_match_omp_loop, gfc_match_omp_teams_loop,
gfc_match_omp_target_teams_loop, gfc_match_omp_parallel_loop,
gfc_match_omp_target_parallel_loop): New.
(resolve_omp_clauses, resolve_omp_do, omp_code_to_statement,
gfc_resolve_omp_directive): Handle omp loop.
* parse.c (decode_omp_directive case_exec_markers, gfc_ascii_statement,
parse_omp_do, parse_executable): Likewise.
(parse_omp_structured_block): Remove ST_ which use parse_omp_do.
* resolve.c (gfc_resolve_blocks): Add omp loop.
* st.c (gfc_free_statement): Likewise.
* trans-openmp.c (gfc_trans_omp_clauses): Handle bind clause.
(gfc_trans_omp_do, gfc_trans_omp_parallel_do, gfc_trans_omp_distribute,
gfc_trans_omp_teams, gfc_trans_omp_target, gfc_trans_omp_directive):
Handle loop directive.
(gfc_split_omp_clauses): Likewise; fix firstprivate/lastprivate
and (in_)reduction for taskloop.
* trans.c (trans_code): Handle omp loop directive.

gcc/testsuite/ChangeLog:

* gfortran.dg/gomp/pr99928-3.f90: Add 'default(none)', following
C/C++ version of the patch.
* gfortran.dg/gomp/loop-1.f90: New test.
* gfortran.dg/gomp/loop-2.f90: New test.
* gfortran.dg/gomp/pr99928-1.f90: New test; based on C/C++ test.
* gfortran.dg/gomp/pr99928-11.f90: Likewise.
* gfortran.dg/gomp/pr99928-2.f90: Likewise.
* gfortran.dg/gomp/pr99928-4.f90: Likewise.
* gfortran.dg/gomp/pr99928-5.f90: Likewise.
* gfortran.dg/gomp/pr99928-6.f90: Likewise.
* gfortran.dg/gomp/pr99928-8.f90: Likewise.
* gfortran.dg/goacc/omp.f95: Use 'acc kernels loops' instead
of 'acc loops' to hide unrelated bug for now.
* gfortran.dg/goacc/omp-fixed.f: Likewise
22 files changed:
gcc/fortran/dump-parse-tree.c
gcc/fortran/frontend-passes.c
gcc/fortran/gfortran.h
gcc/fortran/match.h
gcc/fortran/openmp.c
gcc/fortran/parse.c
gcc/fortran/resolve.c
gcc/fortran/st.c
gcc/fortran/trans-openmp.c
gcc/fortran/trans.c
gcc/testsuite/gfortran.dg/goacc/omp-fixed.f
gcc/testsuite/gfortran.dg/goacc/omp.f95
gcc/testsuite/gfortran.dg/gomp/loop-1.f90 [new file with mode: 0644]
gcc/testsuite/gfortran.dg/gomp/loop-2.f90 [new file with mode: 0644]
gcc/testsuite/gfortran.dg/gomp/pr99928-1.f90 [new file with mode: 0644]
gcc/testsuite/gfortran.dg/gomp/pr99928-11.f90 [new file with mode: 0644]
gcc/testsuite/gfortran.dg/gomp/pr99928-2.f90 [new file with mode: 0644]
gcc/testsuite/gfortran.dg/gomp/pr99928-3.f90
gcc/testsuite/gfortran.dg/gomp/pr99928-4.f90 [new file with mode: 0644]
gcc/testsuite/gfortran.dg/gomp/pr99928-5.f90 [new file with mode: 0644]
gcc/testsuite/gfortran.dg/gomp/pr99928-6.f90 [new file with mode: 0644]
gcc/testsuite/gfortran.dg/gomp/pr99928-8.f90 [new file with mode: 0644]