7fd549d24f
gcc/c/ * c-parser.c (c_parser_omp_clause_default): Handle "OMP_CLAUSE_DEFAULT_PRESENT". gcc/cp/ * parser.c (cp_parser_omp_clause_default): Handle "OMP_CLAUSE_DEFAULT_PRESENT". gcc/fortran/ * gfortran.h (enum gfc_omp_default_sharing): Add "OMP_DEFAULT_PRESENT". * dump-parse-tree.c (show_omp_clauses): Handle it. * openmp.c (gfc_match_omp_clauses): Likewise. * trans-openmp.c (gfc_trans_omp_clauses): Likewise. gcc/ * tree-core.h (enum omp_clause_default_kind): Add "OMP_CLAUSE_DEFAULT_PRESENT". * tree-pretty-print.c (dump_omp_clause): Handle it. * gimplify.c (enum gimplify_omp_var_data): Add "GOVD_MAP_FORCE_PRESENT". (gimplify_adjust_omp_clauses_1): Map it to "GOMP_MAP_FORCE_PRESENT". (oacc_default_clause): Handle "OMP_CLAUSE_DEFAULT_PRESENT". gcc/testsuite/ * c-c++-common/goacc/default-1.c: Update. * c-c++-common/goacc/default-2.c: Likewise. * c-c++-common/goacc/default-4.c: Likewise. * gfortran.dg/goacc/default-1.f95: Likewise. * gfortran.dg/goacc/default-4.f: Likewise. * c-c++-common/goacc/default-5.c: New file. * gfortran.dg/goacc/default-5.f: Likewise. libgomp/ * testsuite/libgomp.oacc-c++/template-reduction.C: Update. * testsuite/libgomp.oacc-c-c++-common/nested-2.c: Update. * testsuite/libgomp.oacc-fortran/data-4-2.f90: Likewise. * testsuite/libgomp.oacc-fortran/default-1.f90: Likewise. * testsuite/libgomp.oacc-fortran/non-scalar-data.f90: Likewise. From-SVN: r248280
173 lines
2.6 KiB
C
173 lines
2.6 KiB
C
/* { dg-do run } */
|
|
|
|
#include <stdlib.h>
|
|
|
|
int
|
|
main (int argc, char *argv[])
|
|
{
|
|
#define N 10
|
|
char a[N];
|
|
int i;
|
|
|
|
for (i = 0; i < N; ++i)
|
|
a[i] = 0;
|
|
|
|
#pragma acc data copy (a)
|
|
{
|
|
#pragma acc parallel present (a)
|
|
{
|
|
int j;
|
|
|
|
for (j = 0; j < N; ++j)
|
|
a[j] = j;
|
|
}
|
|
}
|
|
|
|
for (i = 0; i < N; ++i)
|
|
{
|
|
if (a[i] != i)
|
|
abort ();
|
|
}
|
|
|
|
for (i = 0; i < N; ++i)
|
|
a[i] = 0;
|
|
|
|
#pragma acc data copy (a)
|
|
{
|
|
#pragma acc kernels present (a)
|
|
{
|
|
int j;
|
|
|
|
for (j = 0; j < N; ++j)
|
|
a[j] = j;
|
|
}
|
|
}
|
|
|
|
for (i = 0; i < N; ++i)
|
|
{
|
|
if (a[i] != i)
|
|
abort ();
|
|
}
|
|
|
|
for (i = 0; i < N; ++i)
|
|
a[i] = 0;
|
|
|
|
#pragma acc data copy (a)
|
|
{
|
|
#pragma acc data present (a)
|
|
{
|
|
#pragma acc parallel present (a)
|
|
{
|
|
int j;
|
|
|
|
for (j = 0; j < N; ++j)
|
|
a[j] = j;
|
|
}
|
|
}
|
|
}
|
|
|
|
for (i = 0; i < N; ++i)
|
|
{
|
|
if (a[i] != i)
|
|
abort ();
|
|
}
|
|
|
|
#pragma acc data copy (a)
|
|
{
|
|
#pragma acc data present (a)
|
|
{
|
|
#pragma acc kernels present (a)
|
|
{
|
|
int j;
|
|
|
|
for (j = 0; j < N; ++j)
|
|
a[j] = j;
|
|
}
|
|
}
|
|
}
|
|
|
|
for (i = 0; i < N; ++i)
|
|
{
|
|
if (a[i] != i)
|
|
abort ();
|
|
}
|
|
|
|
for (i = 0; i < N; ++i)
|
|
a[i] = 0;
|
|
|
|
#pragma acc enter data copyin (a)
|
|
|
|
#pragma acc data present (a)
|
|
{
|
|
#pragma acc parallel present (a)
|
|
{
|
|
int j;
|
|
|
|
for (j = 0; j < N; ++j)
|
|
a[j] = j;
|
|
}
|
|
}
|
|
|
|
#pragma acc exit data copyout (a)
|
|
|
|
for (i = 0; i < N; ++i)
|
|
{
|
|
if (a[i] != i)
|
|
abort ();
|
|
}
|
|
|
|
#pragma acc enter data copyin (a)
|
|
|
|
#pragma acc data present (a)
|
|
{
|
|
#pragma acc kernels present (a)
|
|
{
|
|
int j;
|
|
|
|
for (j = 0; j < N; ++j)
|
|
a[j] = j;
|
|
}
|
|
}
|
|
|
|
#pragma acc exit data copyout (a)
|
|
|
|
for (i = 0; i < N; ++i)
|
|
{
|
|
if (a[i] != i)
|
|
abort ();
|
|
}
|
|
|
|
|
|
#pragma acc enter data create (a)
|
|
|
|
#pragma acc parallel default (present)
|
|
{
|
|
for (int j = 0; j < N; ++j)
|
|
a[j] = j + 1;
|
|
}
|
|
|
|
#pragma acc update host (a)
|
|
|
|
for (i = 0; i < N; ++i)
|
|
{
|
|
if (a[i] != i + 1)
|
|
abort ();
|
|
}
|
|
|
|
#pragma acc kernels default (present)
|
|
{
|
|
for (int j = 0; j < N; ++j)
|
|
a[j] = j + 2;
|
|
}
|
|
|
|
#pragma acc exit data copyout (a)
|
|
|
|
for (i = 0; i < N; ++i)
|
|
{
|
|
if (a[i] != i + 2)
|
|
abort ();
|
|
}
|
|
|
|
return 0;
|
|
}
|