Hi! On Thu, 4 May 2017 15:11:30 -0700, Cesar Philippidis <ce...@codesourcery.com> wrote: > This patch make the c, c++ and fortran FEs aware of the new OpenACC 2.5 > if_present clause for the update directive.
Thanks! > The ME and runtime support > will come in a separate followup patch. > Thomas, for some reason I'm seeing a couple of new UNRESOLVED tests for > update-1.C. ;-) You need to instantiate C++ templates for any code to be generated. > The c++ tests running with goacc.exp are built with > -fopenacc, but for some reason the tests in g++.dg/goacc/ are still ran > without -fopenacc for g++.dg/dg.exp. Maybe there's something wrong with > g++.dg/goacc/goacc.exp handling of .C files? I'm not aware of any such a problem, but please do verify. I also added missing handling in gcc/tree-nested.c, and corrsponding test coverage. Committed to gomp-4_0-branch in r247629: commit afb07db9e7f52dac835f6c0a764b8884187bc798 Author: tschwinge <tschwinge@138bc75d-0d04-0410-961f-82ee72b054a4> Date: Fri May 5 08:09:39 2017 +0000 OpenACC if_present clause fixes gcc/ * tree-nested.c (convert_nonlocal_omp_clauses) (convert_local_omp_clauses): Handle OMP_CLAUSE_IF_PRESENT. gcc/testsuite/ * g++.dg/goacc/update-1.C: Update. * gcc.dg/goacc/nested-function-1.c: Likewise. * gfortran.dg/goacc/nested-function-1.f90: Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gomp-4_0-branch@247629 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog.gomp | 5 +++++ gcc/testsuite/ChangeLog.gomp | 6 ++++++ gcc/testsuite/g++.dg/goacc/update-1.C | 20 ++++++++++++++++++++ gcc/testsuite/gcc.dg/goacc/nested-function-1.c | 4 ++++ .../gfortran.dg/goacc/nested-function-1.f90 | 4 ++++ gcc/tree-nested.c | 2 ++ 6 files changed, 41 insertions(+) diff --git gcc/ChangeLog.gomp gcc/ChangeLog.gomp index f24c483..b914cb1 100644 --- gcc/ChangeLog.gomp +++ gcc/ChangeLog.gomp @@ -1,3 +1,8 @@ +2017-05-05 Thomas Schwinge <tho...@codesourcery.com> + + * tree-nested.c (convert_nonlocal_omp_clauses) + (convert_local_omp_clauses): Handle OMP_CLAUSE_IF_PRESENT. + 2017-05-04 Cesar Philippidis <ce...@codesourcery.com> * gimplify.c (gimplify_scan_omp_clauses): Handle OMP_CLAUSE_IF_PRESENT. diff --git gcc/testsuite/ChangeLog.gomp gcc/testsuite/ChangeLog.gomp index 12b79e3..d1f7c84 100644 --- gcc/testsuite/ChangeLog.gomp +++ gcc/testsuite/ChangeLog.gomp @@ -1,3 +1,9 @@ +2017-05-05 Thomas Schwinge <tho...@codesourcery.com> + + * g++.dg/goacc/update-1.C: Update. + * gcc.dg/goacc/nested-function-1.c: Likewise. + * gfortran.dg/goacc/nested-function-1.f90: Likewise. + 2017-05-04 Cesar Philippidis <ce...@codesourcery.com> * c-c++-common/goacc/update-if_present-1.c: New test. diff --git gcc/testsuite/g++.dg/goacc/update-1.C gcc/testsuite/g++.dg/goacc/update-1.C index 10c8020..cb4b11e 100644 --- gcc/testsuite/g++.dg/goacc/update-1.C +++ gcc/testsuite/g++.dg/goacc/update-1.C @@ -15,4 +15,24 @@ t () #pragma acc update self(c) device(b) host (a) async(10) if (a == 5) if_present } +class +C +{ +private: + bool a; + float b; + +public: + bool operator== (int x) + { + return a == x; + } +}; + +void +f () +{ + t<C> (); +} + /* { dg-final { scan-tree-dump-times "pragma omp target oacc_update if_present" 4 "omplower" } } */ diff --git gcc/testsuite/gcc.dg/goacc/nested-function-1.c gcc/testsuite/gcc.dg/goacc/nested-function-1.c index e17c0e2..5fc2e46 100644 --- gcc/testsuite/gcc.dg/goacc/nested-function-1.c +++ gcc/testsuite/gcc.dg/goacc/nested-function-1.c @@ -25,6 +25,8 @@ int main () local_a[i] = 5; local_arg = 5; +#pragma acc update device(local_a) if_present + #pragma acc kernels loop \ gang(num:local_arg) worker(local_arg) vector(local_arg) \ wait async(local_arg) @@ -62,6 +64,8 @@ int main () nonlocal_a[i] = 5; nonlocal_arg = 5; +#pragma acc update device(nonlocal_a) if_present + #pragma acc kernels loop \ gang(num:nonlocal_arg) worker(nonlocal_arg) vector(nonlocal_arg) \ wait async(nonlocal_arg) diff --git gcc/testsuite/gfortran.dg/goacc/nested-function-1.f90 gcc/testsuite/gfortran.dg/goacc/nested-function-1.f90 index 2fcaa40..bbb53c3 100644 --- gcc/testsuite/gfortran.dg/goacc/nested-function-1.f90 +++ gcc/testsuite/gfortran.dg/goacc/nested-function-1.f90 @@ -25,6 +25,8 @@ contains local_a (:) = 5 local_arg = 5 + !$acc update device(local_a) if_present + !$acc kernels loop & !$acc gang(num:local_arg) worker(local_arg) vector(local_arg) & !$acc wait async(local_arg) @@ -60,6 +62,8 @@ contains nonlocal_a (:) = 5 nonlocal_arg = 5 + !$acc update device(nonlocal_a) if_present + !$acc kernels loop & !$acc gang(num:nonlocal_arg) worker(nonlocal_arg) vector(nonlocal_arg) & !$acc wait async(nonlocal_arg) diff --git gcc/tree-nested.c gcc/tree-nested.c index b5b73d0..3ddfd65 100644 --- gcc/tree-nested.c +++ gcc/tree-nested.c @@ -1202,6 +1202,7 @@ convert_nonlocal_omp_clauses (tree *pclauses, struct walk_stmt_info *wi) case OMP_CLAUSE_SEQ: case OMP_CLAUSE_INDEPENDENT: case OMP_CLAUSE_AUTO: + case OMP_CLAUSE_IF_PRESENT: break; case OMP_CLAUSE_DEVICE_TYPE: @@ -1900,6 +1901,7 @@ convert_local_omp_clauses (tree *pclauses, struct walk_stmt_info *wi) case OMP_CLAUSE_SEQ: case OMP_CLAUSE_INDEPENDENT: case OMP_CLAUSE_AUTO: + case OMP_CLAUSE_IF_PRESENT: break; case OMP_CLAUSE_DEVICE_TYPE: Grüße Thomas