[Patch] Fortran: Update omp atomic for OpenMP 5
Jakub Jelinek
jakub@redhat.com
Fri Oct 30 11:36:17 GMT 2020
On Thu, Oct 29, 2020 at 06:05:41PM +0100, Tobias Burnus wrote:
> gcc/fortran/ChangeLog:
>
> * dump-parse-tree.c (show_omp_clauses): Handle atomic clauses.
> (show_omp_node): Call it for atomic.
> * gfortran.h (enum gfc_omp_atomic_op): Add GFC_OMP_ATOMIC_UNSET,
> remove GFC_OMP_ATOMIC_SEQ_CST and GFC_OMP_ATOMIC_ACQ_REL.
> (enum gfc_omp_memorder): Replace OMP_MEMORDER_LAST by
> OMP_MEMORDER_UNSET, add OMP_MEMORDER_SEQ_CST/OMP_MEMORDER_RELAXED.
> (gfc_omp_clauses): Add capture and atomic_op.
> (gfc_code): remove omp_atomic.
> * openmp.c (enum omp_mask1): Add atomic, capture, memorder clauses.
> (gfc_match_omp_clauses): Match them.
> (OMP_ATOMIC_CLAUSES): Add.
> (gfc_match_omp_flush): Update for 'last' to 'unset' change.
> (gfc_match_omp_oacc_atomic): Removed and placed content ..
> (gfc_match_omp_atomic): ... here. Update for OpenMP 5 clauses.
> (gfc_match_oacc_atomic): Match directly here.
> (resolve_omp_atomic, gfc_resolve_omp_directive): Update.
> * parse.c (parse_omp_oacc_atomic): Update for struct gfc_code changes.
> * resolve.c (gfc_resolve_blocks): Update assert.
> * st.c (gfc_free_statement): Also call for EXEC_O{ACC,MP}_ATOMIC.
> * trans-openmp.c (gfc_trans_omp_atomic): Update.
> (gfc_trans_omp_flush): Update for 'last' to 'unset' change.
>
> gcc/testsuite/ChangeLog:
>
> * gfortran.dg/gomp/atomic-2.f90: New test.
> * gfortran.dg/gomp/atomic.f90: New test.
> + gfc_error ("OMP ATOMIC READ at %L incompatible with "
> + "ACQ_REL or RELEASE clauses", &loc);
> + gfc_error ("Unexpected junk after $ACC ATOMIC statement at %C");
> + gfc_free_omp_clauses (c);
Would be nice to be consistent. I think most commonly in diagnostics
we use !$OMP ... and !$ACC , $ACC is not used anywhere, and while
some uses of just OMP ... crept in, they aren't used that much yet.
> - = (gfc_omp_atomic_op) (atomic_code->ext.omp_atomic & GFC_OMP_ATOMIC_MASK);
> + = (gfc_omp_atomic_op) (atomic_code->ext.omp_clauses->atomic_op & GFC_OMP_ATOMIC_MASK);
Too long line.
Otherwise LGTM.
Jakub
More information about the Gcc-patches
mailing list