aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/trans-openmp.c
diff options
context:
space:
mode:
authorTobias Burnus <tobias@codesourcery.com>2020-07-29 10:37:44 +0200
committerTobias Burnus <tobias@codesourcery.com>2020-07-29 10:37:44 +0200
commit269322ece17202632bc354e9c510e4a5bd6ad84b (patch)
tree0f455436d3c7c8d20fa70bb68296c9e9445fb3b1 /gcc/fortran/trans-openmp.c
parent5c180464b7b0827b3cc07a78e96dfe55352db33f (diff)
downloadgcc-269322ece17202632bc354e9c510e4a5bd6ad84b.zip
gcc-269322ece17202632bc354e9c510e4a5bd6ad84b.tar.gz
gcc-269322ece17202632bc354e9c510e4a5bd6ad84b.tar.bz2
OpenMP: Add 'omp requires' to Fortran (mostly parsing)
gcc/fortran/ChangeLog: * gfortran.h (enum gfc_statement): Add ST_OMP_REQUIRES. (enum gfc_omp_requires_kind): New. (enum gfc_omp_atomic_op): Add GFC_OMP_ATOMIC_ACQ_REL. (struct gfc_namespace): Add omp_requires and omp_target_seen. (gfc_omp_requires_add_clause, (gfc_check_omp_requires): New. * match.h (gfc_match_omp_requires): New. * module.c (enum ab_attribute, attr_bits): Add omp requires clauses. (mio_symbol_attribute): Read/write them. * openmp.c (gfc_check_omp_requires, (gfc_omp_requires_add_clause, gfc_match_omp_requires): New. (gfc_match_omp_oacc_atomic): Use requires's default mem-order. * parse.c (decode_omp_directive): Match requires, set omp_target_seen. (gfc_ascii_statement): Handle ST_OMP_REQUIRES. * trans-openmp.c (gfc_trans_omp_atomic): Handle GFC_OMP_ATOMIC_ACQ_REL. gcc/testsuite/ChangeLog: * gfortran.dg/gomp/requires-1.f90: New test. * gfortran.dg/gomp/requires-2.f90: New test. * gfortran.dg/gomp/requires-3.f90: New test. * gfortran.dg/gomp/requires-4.f90: New test. * gfortran.dg/gomp/requires-5.f90: New test. * gfortran.dg/gomp/requires-6.f90: New test. * gfortran.dg/gomp/requires-7.f90: New test. * gfortran.dg/gomp/requires-8.f90: New test. * gfortran.dg/gomp/requires-9.f90: New test.
Diffstat (limited to 'gcc/fortran/trans-openmp.c')
-rw-r--r--gcc/fortran/trans-openmp.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/gcc/fortran/trans-openmp.c b/gcc/fortran/trans-openmp.c
index d12d7fb..f6a39ed 100644
--- a/gcc/fortran/trans-openmp.c
+++ b/gcc/fortran/trans-openmp.c
@@ -3932,9 +3932,13 @@ gfc_trans_omp_atomic (gfc_code *code)
enum tree_code op = ERROR_MARK;
enum tree_code aop = OMP_ATOMIC;
bool var_on_left = false;
- enum omp_memory_order mo
- = ((atomic_code->ext.omp_atomic & GFC_OMP_ATOMIC_SEQ_CST)
- ? OMP_MEMORY_ORDER_SEQ_CST : OMP_MEMORY_ORDER_RELAXED);
+ enum omp_memory_order mo;
+ if (atomic_code->ext.omp_atomic & GFC_OMP_ATOMIC_SEQ_CST)
+ mo = OMP_MEMORY_ORDER_SEQ_CST;
+ else if (atomic_code->ext.omp_atomic & GFC_OMP_ATOMIC_ACQ_REL)
+ mo = OMP_MEMORY_ORDER_ACQ_REL;
+ else
+ mo = OMP_MEMORY_ORDER_RELAXED;
code = code->block->next;
gcc_assert (code->op == EXEC_ASSIGN);