diff options
author | Thomas Schwinge <tschwinge@gcc.gnu.org> | 2015-10-27 09:39:15 +0100 |
---|---|---|
committer | Thomas Schwinge <tschwinge@gcc.gnu.org> | 2015-10-27 09:39:15 +0100 |
commit | 88bae6f494dc867edd8e6257658974d629bdc53b (patch) | |
tree | 6ab5ea8ba1b8126fa0e7ad76b11ad320ba2c7edb /gcc/c-family | |
parent | 5acdb61b69011e9d0f6b507fc37160b85ba04c51 (diff) | |
download | gcc-88bae6f494dc867edd8e6257658974d629bdc53b.zip gcc-88bae6f494dc867edd8e6257658974d629bdc53b.tar.gz gcc-88bae6f494dc867edd8e6257658974d629bdc53b.tar.bz2 |
[PR c/64765, c/64880] Support OpenACC Combined Directives in C, C++
gcc/c-family/
PR c/64765
PR c/64880
* c-common.h (c_oacc_split_loop_clauses): Declare function.
* c-omp.c (c_oacc_split_loop_clauses): New function.
gcc/c/
PR c/64765
PR c/64880
* c-parser.c (c_parser_oacc_loop): Add mask, cclauses formal
parameters, and handle these. Adjust all users.
(c_parser_oacc_kernels, c_parser_oacc_parallel): Merge functions
into...
(c_parser_oacc_kernels_parallel): ... this new function. Adjust
all users.
* c-tree.h (c_finish_oacc_parallel, c_finish_oacc_kernels): Don't
declare functions.
(c_finish_omp_construct): Declare function.
* c-typeck.c (c_finish_oacc_parallel, c_finish_oacc_kernels):
Merge functions into...
(c_finish_omp_construct): ... this new function.
gcc/cp/
PR c/64765
PR c/64880
* cp-tree.h (finish_oacc_kernels, finish_oacc_parallel): Don't
declare functions.
(finish_omp_construct): Declare function.
* parser.c (cp_parser_oacc_loop): Add p_name, mask, cclauses
formal parameters, and handle these. Adjust all users.
(cp_parser_oacc_kernels, cp_parser_oacc_parallel): Merge functions
into...
(cp_parser_oacc_kernels_parallel): ... this new function. Adjust
all users.
* semantics.c (finish_oacc_kernels, finish_oacc_parallel): Merge functions into...
(finish_omp_construct): ... this new function.
gcc/
* tree.h (OACC_PARALLEL_BODY, OACC_PARALLEL_CLAUSES)
(OACC_KERNELS_BODY, OACC_KERNELS_CLAUSES, OACC_KERNELS_COMBINED)
(OACC_PARALLEL_COMBINED): Don't define macros. Adjust all users.
gcc/testsuite/
PR c/64765
PR c/64880
* c-c++-common/goacc/loop-1.c: Don't skip for C++. Don't prune
sorry message.
(PR64765): New function.
* gfortran.dg/goacc/coarray_2.f90: XFAIL.
* gfortran.dg/goacc/combined_loop.f90: Extend. Don't prune
sorry message.
* gfortran.dg/goacc/cray.f95: Refine prune directive.
* gfortran.dg/goacc/parameter.f95: Likewise.
libgomp/
* testsuite/libgomp.oacc-c-c++-common/combdir-1.c: New file.
* testsuite/libgomp.oacc-fortran/combdir-1.f90: Likewise.
From-SVN: r229404
Diffstat (limited to 'gcc/c-family')
-rw-r--r-- | gcc/c-family/ChangeLog | 9 | ||||
-rw-r--r-- | gcc/c-family/c-common.h | 1 | ||||
-rw-r--r-- | gcc/c-family/c-omp.c | 40 |
3 files changed, 47 insertions, 3 deletions
diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog index f2beefd..4d22572 100644 --- a/gcc/c-family/ChangeLog +++ b/gcc/c-family/ChangeLog @@ -1,3 +1,12 @@ +2015-10-27 Thomas Schwinge <thomas@codesourcery.com> + James Norris <jnorris@codesourcery.com> + Cesar Philippidis <cesar@codesourcery.com> + + PR c/64765 + PR c/64880 + * c-common.h (c_oacc_split_loop_clauses): Declare function. + * c-omp.c (c_oacc_split_loop_clauses): New function. + 2015-10-21 Martin Sebor <msebor@redhat.com> PR driver/68043 diff --git a/gcc/c-family/c-common.h b/gcc/c-family/c-common.h index 4b5cac8..6a381f2 100644 --- a/gcc/c-family/c-common.h +++ b/gcc/c-family/c-common.h @@ -1269,6 +1269,7 @@ extern void c_finish_omp_taskyield (location_t); extern tree c_finish_omp_for (location_t, enum tree_code, tree, tree, tree, tree, tree, tree, tree); extern tree c_finish_oacc_wait (location_t, tree, tree); +extern tree c_oacc_split_loop_clauses (tree, tree *); extern void c_omp_split_clauses (location_t, enum tree_code, omp_clause_mask, tree, tree *); extern tree c_omp_declare_simd_clauses_to_numbers (tree, tree); diff --git a/gcc/c-family/c-omp.c b/gcc/c-family/c-omp.c index 36f9b66..93bff2e 100644 --- a/gcc/c-family/c-omp.c +++ b/gcc/c-family/c-omp.c @@ -691,13 +691,47 @@ c_finish_omp_for (location_t locus, enum tree_code code, tree declv, } } -/* Right now we have 21 different combined/composite constructs, this - function attempts to split or duplicate clauses for combined +/* This function splits clauses for OpenACC combined loop + constructs. OpenACC combined loop constructs are: + #pragma acc kernels loop + #pragma acc parallel loop +*/ + +tree +c_oacc_split_loop_clauses (tree clauses, tree *not_loop_clauses) +{ + tree next, loop_clauses; + + loop_clauses = *not_loop_clauses = NULL_TREE; + for (; clauses ; clauses = next) + { + next = OMP_CLAUSE_CHAIN (clauses); + + switch (OMP_CLAUSE_CODE (clauses)) + { + case OMP_CLAUSE_COLLAPSE: + case OMP_CLAUSE_REDUCTION: + OMP_CLAUSE_CHAIN (clauses) = loop_clauses; + loop_clauses = clauses; + break; + + default: + OMP_CLAUSE_CHAIN (clauses) = *not_loop_clauses; + *not_loop_clauses = clauses; + break; + } + } + + return loop_clauses; +} + +/* This function attempts to split or duplicate clauses for OpenMP + combined/composite constructs. Right now there are 21 different constructs. CODE is the innermost construct in the combined construct, and MASK allows to determine which constructs are combined together, as every construct has at least one clause that no other construct has (except for OMP_SECTIONS, but that can be only combined with parallel). - Combined/composite constructs are: + OpenMP combined/composite constructs are: #pragma omp distribute parallel for #pragma omp distribute parallel for simd #pragma omp distribute simd |