Retro68/gcc/libgomp/testsuite/libgomp.oacc-c-c++-common/cache-1.c

49 lines
677 B
C
Raw Normal View History

2015-08-28 15:33:40 +00:00
int
main (int argc, char **argv)
{
#define N 2
int a[N], b[N];
int i;
for (i = 0; i < N; i++)
{
a[i] = 3;
b[i] = 0;
}
#pragma acc parallel copyin (a[0:N]) copyout (b[0:N])
{
int ii;
for (ii = 0; ii < N; ii++)
{
const int idx = ii;
int n = 1;
const int len = n;
#pragma acc cache (a[0:N])
#pragma acc cache (a[0:N], b[0:N])
#pragma acc cache (a[0])
#pragma acc cache (a[0], a[1], b[0:N])
#pragma acc cache (a[idx])
#pragma acc cache (a[idx:len])
b[ii] = a[ii];
}
}
for (i = 0; i < N; i++)
{
if (a[i] != b[i])
__builtin_abort ();
}
return 0;
}