diff options
author | Chung-Lin Tang <cltang@codesourcery.com> | 2016-06-03 14:25:12 +0000 |
---|---|---|
committer | Chung-Lin Tang <cltang@gcc.gnu.org> | 2016-06-03 14:25:12 +0000 |
commit | b605f6639c14383eb274e90c4fa6f995af514fbc (patch) | |
tree | 23dd423fd8de79a39d2c78c414903727101e5b86 /gcc | |
parent | 36b85e432865a312aa8edc8978e38266e8a0f14c (diff) | |
download | gcc-b605f6639c14383eb274e90c4fa6f995af514fbc.zip gcc-b605f6639c14383eb274e90c4fa6f995af514fbc.tar.gz gcc-b605f6639c14383eb274e90c4fa6f995af514fbc.tar.bz2 |
c-typeck.c (c_finish_omp_clauses): Mark OpenACC reduction arguments as addressable when async clause exists.
2016-06-03 Chung-Lin Tang <cltang@codesourcery.com>
c/
* c-typeck.c (c_finish_omp_clauses): Mark OpenACC reduction
arguments as addressable when async clause exists.
cp/
* semantics.c (finish_omp_clauses): Mark OpenACC reduction
arguments as addressable when async clause exists.
fortran/
* trans-openmp.c (gfc_trans_omp_reduction_list): Add mark_addressable
bool parameter, set reduction clause DECLs as addressable when true.
(gfc_trans_omp_clauses): Pass clauses->async to
gfc_trans_omp_reduction_list, add comment describing OpenACC situation.
libgomp/
* testsuite/libgomp.oacc-fortran/reduction-8.f90: New testcase.
* testsuite/libgomp.oacc-c-c++-common/reduction-8.c: New testcase.
From-SVN: r237070
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/c/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/c/c-typeck.c | 11 | ||||
-rw-r--r-- | gcc/cp/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/cp/semantics.c | 11 | ||||
-rw-r--r-- | gcc/fortran/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/fortran/trans-openmp.c | 9 |
6 files changed, 46 insertions, 2 deletions
diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog index d2a8947..1262c82 100644 --- a/gcc/c/ChangeLog +++ b/gcc/c/ChangeLog @@ -1,3 +1,8 @@ +2016-06-03 Chung-Lin Tang <cltang@codesourcery.com> + + * c-typeck.c (c_finish_omp_clauses): Mark OpenACC reduction + arguments as addressable when async clause exists. + 2016-05-30 Jakub Jelinek <jakub@redhat.com> PR c++/71349 diff --git a/gcc/c/c-typeck.c b/gcc/c/c-typeck.c index 1520c20..0ff28f2 100644 --- a/gcc/c/c-typeck.c +++ b/gcc/c/c-typeck.c @@ -12529,6 +12529,7 @@ c_finish_omp_clauses (tree clauses, enum c_omp_region_type ort) tree *nowait_clause = NULL; bool ordered_seen = false; tree schedule_clause = NULL_TREE; + bool oacc_async = false; bitmap_obstack_initialize (NULL); bitmap_initialize (&generic_head, &bitmap_default_obstack); @@ -12539,6 +12540,14 @@ c_finish_omp_clauses (tree clauses, enum c_omp_region_type ort) bitmap_initialize (&map_field_head, &bitmap_default_obstack); bitmap_initialize (&oacc_reduction_head, &bitmap_default_obstack); + if (ort & C_ORT_ACC) + for (c = clauses; c; c = OMP_CLAUSE_CHAIN (c)) + if (OMP_CLAUSE_CODE (c) == OMP_CLAUSE_ASYNC) + { + oacc_async = true; + break; + } + for (pc = &clauses, c = clauses; c ; c = *pc) { bool remove = false; @@ -12575,6 +12584,8 @@ c_finish_omp_clauses (tree clauses, enum c_omp_region_type ort) remove = true; break; } + if (oacc_async) + c_mark_addressable (t); type = TREE_TYPE (t); if (TREE_CODE (t) == MEM_REF) type = TREE_TYPE (type); diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 69d3da1..bec708c 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2016-06-03 Chung-Lin Tang <cltang@codesourcery.com> + + * semantics.c (finish_omp_clauses): Mark OpenACC reduction + arguments as addressable when async clause exists. + 2016-06-02 Jan Hubicka <jh@suse.cz> * cp-gimplify.c (genericize_continue_stmt): Force addition of diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c index 8e682c5..5365091 100644 --- a/gcc/cp/semantics.c +++ b/gcc/cp/semantics.c @@ -5775,6 +5775,7 @@ finish_omp_clauses (tree clauses, enum c_omp_region_type ort) bool branch_seen = false; bool copyprivate_seen = false; bool ordered_seen = false; + bool oacc_async = false; bitmap_obstack_initialize (NULL); bitmap_initialize (&generic_head, &bitmap_default_obstack); @@ -5785,6 +5786,14 @@ finish_omp_clauses (tree clauses, enum c_omp_region_type ort) bitmap_initialize (&map_field_head, &bitmap_default_obstack); bitmap_initialize (&oacc_reduction_head, &bitmap_default_obstack); + if (ort & C_ORT_ACC) + for (c = clauses; c; c = OMP_CLAUSE_CHAIN (c)) + if (OMP_CLAUSE_CODE (c) == OMP_CLAUSE_ASYNC) + { + oacc_async = true; + break; + } + for (pc = &clauses, c = clauses; c ; c = *pc) { bool remove = false; @@ -5828,6 +5837,8 @@ finish_omp_clauses (tree clauses, enum c_omp_region_type ort) t = n; goto check_dup_generic_t; } + if (oacc_async) + cxx_mark_addressable (t); goto check_dup_generic; case OMP_CLAUSE_COPYPRIVATE: copyprivate_seen = true; diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 2a9c9ce..8c04089 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,10 @@ +2016-06-03 Chung-Lin Tang <cltang@codesourcery.com> + + * trans-openmp.c (gfc_trans_omp_reduction_list): Add mark_addressable + bool parameter, set reduction clause DECLs as addressable when true. + (gfc_trans_omp_clauses): Pass clauses->async to + gfc_trans_omp_reduction_list, add comment describing OpenACC situation. + 2016-06-01 Jerry DeLisle <jvdelisle@gcc.gnu.org> PR fortran/52393 diff --git a/gcc/fortran/trans-openmp.c b/gcc/fortran/trans-openmp.c index d3276f9..ab07fe4 100644 --- a/gcc/fortran/trans-openmp.c +++ b/gcc/fortran/trans-openmp.c @@ -1646,7 +1646,7 @@ gfc_trans_omp_array_reduction_or_udr (tree c, gfc_omp_namelist *n, locus where) static tree gfc_trans_omp_reduction_list (gfc_omp_namelist *namelist, tree list, - locus where) + locus where, bool mark_addressable) { for (; namelist != NULL; namelist = namelist->next) if (namelist->sym->attr.referenced) @@ -1657,6 +1657,8 @@ gfc_trans_omp_reduction_list (gfc_omp_namelist *namelist, tree list, tree node = build_omp_clause (where.lb->location, OMP_CLAUSE_REDUCTION); OMP_CLAUSE_DECL (node) = t; + if (mark_addressable) + TREE_ADDRESSABLE (t) = 1; switch (namelist->u.reduction_op) { case OMP_REDUCTION_PLUS: @@ -1747,7 +1749,10 @@ gfc_trans_omp_clauses (stmtblock_t *block, gfc_omp_clauses *clauses, switch (list) { case OMP_LIST_REDUCTION: - omp_clauses = gfc_trans_omp_reduction_list (n, omp_clauses, where); + /* An OpenACC async clause indicates the need to set reduction + arguments addressable, to allow asynchronous copy-out. */ + omp_clauses = gfc_trans_omp_reduction_list (n, omp_clauses, where, + clauses->async); break; case OMP_LIST_PRIVATE: clause_code = OMP_CLAUSE_PRIVATE; |