Hi Cesar! On Wed, 05 Nov 2014 17:36:46 +0100, I wrote: > In r217146, I applied the following to gomp-4_0-branch: > > commit e8e44b733808997d06c0cdf9bf5756ce03530f42 > Author: tschwinge <tschwinge@138bc75d-0d04-0410-961f-82ee72b054a4> > Date: Wed Nov 5 16:35:30 2014 +0000 > > OpenACC cache directive maintenance. > > gcc/c/ > * c-parser.c (c_parser_oacc_cache): Generate OACC_CACHE. > * c-typeck.c (c_finish_omp_clauses): Handle OMP_CLAUSE__CACHE_. > gcc/cp/ > * parser.c (cp_parser_oacc_cache): Generate OACC_CACHE. > * semantics.c (finish_omp_clauses): Handle OMP_CLAUSE__CACHE_. > gcc/ > * gimplify.c (gimplify_oacc_cache): New function. > (gimplify_expr): Use it for OACC_CACHE. > (gimplify_scan_omp_clauses, gimplify_adjust_omp_clauses): Handle > OMP_CLAUSE__CACHE_.
> --- gcc/c/c-parser.c
> +++ gcc/c/c-parser.c
> static tree
> -c_parser_oacc_cache (location_t loc __attribute__((unused)), c_parser
> *parser)
> +c_parser_oacc_cache (location_t loc, c_parser *parser)
> {
> - c_parser_omp_var_list_parens (parser, OMP_NO_CLAUSE_CACHE, NULL);
> + tree stmt, clauses;
> +
> + clauses = c_parser_omp_var_list_parens (parser, OMP_CLAUSE__CACHE_, NULL);
> + clauses = c_finish_omp_clauses (clauses);
> +
> c_parser_skip_to_pragma_eol (parser);
>
> - return NULL_TREE;
> + stmt = make_node (OACC_CACHE);
> + TREE_TYPE (stmt) = void_type_node;
> + OACC_CACHE_CLAUSES (stmt) = clauses;
> + SET_EXPR_LOCATION (stmt, loc);
> + add_stmt (stmt);
> +
> + return stmt;
> }
> --- gcc/c/c-typeck.c
> +++ gcc/c/c-typeck.c
> @@ -12204,6 +12204,7 @@ c_finish_omp_clauses (tree clauses)
> case OMP_CLAUSE_MAP:
> case OMP_CLAUSE_TO:
> case OMP_CLAUSE_FROM:
> + case OMP_CLAUSE__CACHE_:
> t = OMP_CLAUSE_DECL (c);
> if (TREE_CODE (t) == TREE_LIST)
> {
[The "same" for C++.]
I also tried to make this work for Fortran, but didn't manage to (in
a reasonable amount of time, which has not been a lot that I allocated)
;-) -- would you please have a look at this (but it's not urgent).
commit 7cf14ddb307a5b271e098f3a3fdb0452f6036f91
Author: Thomas Schwinge <[email protected]>
Date: Wed Nov 5 09:16:12 2014 +0100
cache: Fortran experimenting.
---
gcc/fortran/frontend-passes.c | 3 ++-
gcc/fortran/openmp.c | 12 ++----------
gcc/fortran/trans-openmp.c | 18 ++++++++++++------
gcc/testsuite/gfortran.dg/goacc/cache-1.f95 | 1 -
gcc/testsuite/gfortran.dg/goacc/coarray.f95 | 1 -
gcc/testsuite/gfortran.dg/goacc/cray.f95 | 2 --
gcc/testsuite/gfortran.dg/goacc/loop-1.f95 | 1 -
gcc/testsuite/gfortran.dg/goacc/parameter.f95 | 1 -
8 files changed, 16 insertions(+), 23 deletions(-)
diff --git gcc/fortran/frontend-passes.c gcc/fortran/frontend-passes.c
index 97a9164..729629e 100644
--- gcc/fortran/frontend-passes.c
+++ gcc/fortran/frontend-passes.c
@@ -2190,7 +2190,8 @@ gfc_code_walker (gfc_code **c, walk_code_fn_t codefn,
walk_expr_fn_t exprfn,
gfc_omp_namelist *n;
static int list_types[]
= { OMP_LIST_ALIGNED, OMP_LIST_LINEAR, OMP_LIST_DEPEND,
- OMP_LIST_MAP, OMP_LIST_TO, OMP_LIST_FROM };
+ OMP_LIST_MAP, OMP_LIST_TO, OMP_LIST_FROM,
+ OMP_LIST_CACHE };
size_t idx;
WALK_SUBEXPR (co->ext.omp_clauses->if_expr);
WALK_SUBEXPR (co->ext.omp_clauses->final_expr);
diff --git gcc/fortran/openmp.c gcc/fortran/openmp.c
index 959798a..167331a 100644
--- gcc/fortran/openmp.c
+++ gcc/fortran/openmp.c
@@ -3102,6 +3102,7 @@ resolve_omp_clauses (gfc_code *code, locus *where,
case OMP_LIST_MAP:
case OMP_LIST_TO:
case OMP_LIST_FROM:
+ case OMP_LIST_CACHE:
for (; n != NULL; n = n->next)
{
if (n->expr)
@@ -4594,13 +4595,6 @@ resolve_oacc_loop(gfc_code *code)
}
-static void
-resolve_oacc_cache (gfc_code *code)
-{
- gfc_error ("Sorry, !$ACC cache unimplemented yet at %L", &code->loc);
-}
-
-
void
gfc_resolve_oacc_declare (gfc_namespace *ns)
{
@@ -4675,6 +4669,7 @@ gfc_resolve_oacc_directive (gfc_code *code, gfc_namespace
*ns ATTRIBUTE_UNUSED)
case EXEC_OACC_ENTER_DATA:
case EXEC_OACC_EXIT_DATA:
case EXEC_OACC_WAIT:
+ case EXEC_OACC_CACHE:
resolve_omp_clauses (code, &code->loc, code->ext.omp_clauses, NULL,
true);
break;
@@ -4683,9 +4678,6 @@ gfc_resolve_oacc_directive (gfc_code *code, gfc_namespace
*ns ATTRIBUTE_UNUSED)
case EXEC_OACC_LOOP:
resolve_oacc_loop (code);
break;
- case EXEC_OACC_CACHE:
- resolve_oacc_cache (code);
- break;
default:
break;
}
diff --git gcc/fortran/trans-openmp.c gcc/fortran/trans-openmp.c
index 7dd4498..e39e903 100644
--- gcc/fortran/trans-openmp.c
+++ gcc/fortran/trans-openmp.c
@@ -1806,9 +1806,9 @@ gfc_trans_omp_clauses (stmtblock_t *block,
gfc_omp_clauses *clauses,
case OMP_LIST_DEVICE_RESIDENT:
clause_code = OMP_CLAUSE_DEVICE_RESIDENT;
goto add_clause;
- case OMP_LIST_CACHE:
- clause_code = OMP_CLAUSE__CACHE_;
- goto add_clause;
+// case OMP_LIST_CACHE:
+// clause_code = OMP_CLAUSE__CACHE_;
+// goto add_clause;
add_clause:
omp_clauses
@@ -2178,14 +2178,20 @@ gfc_trans_omp_clauses (stmtblock_t *block,
gfc_omp_clauses *clauses,
break;
case OMP_LIST_TO:
case OMP_LIST_FROM:
+ case OMP_LIST_CACHE:
for (; n != NULL; n = n->next)
{
if (!n->sym->attr.referenced)
continue;
- tree node = build_omp_clause (input_location,
- list == OMP_LIST_TO
- ? OMP_CLAUSE_TO : OMP_CLAUSE_FROM);
+ switch (list)
+ {
+ case OMP_LIST_TO: clause_code = OMP_CLAUSE_TO; break;
+ case OMP_LIST_FROM: clause_code = OMP_CLAUSE_FROM; break;
+ case OMP_LIST_CACHE: clause_code = OMP_CLAUSE__CACHE_; break;
+ default: gcc_unreachable ();
+ }
+ tree node = build_omp_clause (input_location, clause_code);
if (n->expr == NULL || n->expr->ref->u.ar.type == AR_FULL)
{
tree decl = gfc_get_symbol_decl (n->sym);
diff --git gcc/testsuite/gfortran.dg/goacc/cache-1.f95
gcc/testsuite/gfortran.dg/goacc/cache-1.f95
index 746cf02..74ab332 100644
--- gcc/testsuite/gfortran.dg/goacc/cache-1.f95
+++ gcc/testsuite/gfortran.dg/goacc/cache-1.f95
@@ -9,4 +9,3 @@ program test
!$acc cache (d)
enddo
end
-! { dg-prune-output "unimplemented" }
diff --git gcc/testsuite/gfortran.dg/goacc/coarray.f95
gcc/testsuite/gfortran.dg/goacc/coarray.f95
index 4f1224e..f0adac6 100644
--- gcc/testsuite/gfortran.dg/goacc/coarray.f95
+++ gcc/testsuite/gfortran.dg/goacc/coarray.f95
@@ -32,4 +32,3 @@ contains
!$acc update self (a)
end subroutine oacc1
end module test
-! { dg-prune-output "ACC cache unimplemented" }
diff --git gcc/testsuite/gfortran.dg/goacc/cray.f95
gcc/testsuite/gfortran.dg/goacc/cray.f95
index 8f2c077..1ed40fd 100644
--- gcc/testsuite/gfortran.dg/goacc/cray.f95
+++ gcc/testsuite/gfortran.dg/goacc/cray.f95
@@ -24,7 +24,6 @@ contains
!$acc end parallel loop
!$acc parallel loop
do i = 1,5
- ! Subarrays are not implemented yet
!$acc cache (pointee) ! TODO: This must fail, as in openacc-1_0-branch
enddo
!$acc end parallel loop
@@ -53,4 +52,3 @@ contains
!$acc update self (ptr)
end subroutine oacc1
end module test
-! { dg-prune-output "unimplemented" }
diff --git gcc/testsuite/gfortran.dg/goacc/loop-1.f95
gcc/testsuite/gfortran.dg/goacc/loop-1.f95
index e1b2dfd..817039f 100644
--- gcc/testsuite/gfortran.dg/goacc/loop-1.f95
+++ gcc/testsuite/gfortran.dg/goacc/loop-1.f95
@@ -168,4 +168,3 @@ subroutine test1
end subroutine test1
end module test
! { dg-prune-output "Deleted" }
-! { dg-prune-output "ACC cache unimplemented" }
diff --git gcc/testsuite/gfortran.dg/goacc/parameter.f95
gcc/testsuite/gfortran.dg/goacc/parameter.f95
index 1364181..82c25ba 100644
--- gcc/testsuite/gfortran.dg/goacc/parameter.f95
+++ gcc/testsuite/gfortran.dg/goacc/parameter.f95
@@ -29,4 +29,3 @@ contains
!$acc update self (a) ! { dg-error "not a variable" }
end subroutine oacc1
end module test
-! { dg-prune-output "unimplemented" }
Grüße,
Thomas
pgpaBIWJdSHqC.pgp
Description: PGP signature
