gcc/libgomp/testsuite/libgomp.oacc-c-c++-common/kernels-loop-3.c

32 lines
501 B
C
Raw Normal View History

Add oacc kernels test in libgomp 2016-01-18 Tom de Vries <tom@codesourcery.com> * testsuite/libgomp.oacc-c-c++-common/kernels-loop-2.c: New test. * testsuite/libgomp.oacc-c-c++-common/kernels-loop-3.c: Same. * testsuite/libgomp.oacc-c-c++-common/kernels-loop-and-seq-2.c: Same. * testsuite/libgomp.oacc-c-c++-common/kernels-loop-and-seq-3.c: Same. * testsuite/libgomp.oacc-c-c++-common/kernels-loop-and-seq-4.c: Same. * testsuite/libgomp.oacc-c-c++-common/kernels-loop-and-seq-5.c: Same. * testsuite/libgomp.oacc-c-c++-common/kernels-loop-and-seq-6.c: Same. * testsuite/libgomp.oacc-c-c++-common/kernels-loop-and-seq.c: Same. * testsuite/libgomp.oacc-c-c++-common/kernels-loop-collapse.c: Same. * testsuite/libgomp.oacc-c-c++-common/kernels-loop-data-2.c: Same. * testsuite/libgomp.oacc-c-c++-common/kernels-loop-data-enter-exit-2.c: Same. * testsuite/libgomp.oacc-c-c++-common/kernels-loop-data-enter-exit.c: Same. * testsuite/libgomp.oacc-c-c++-common/kernels-loop-data-update.c: Same. * testsuite/libgomp.oacc-c-c++-common/kernels-loop-data.c: Same. * testsuite/libgomp.oacc-c-c++-common/kernels-loop-g.c: Same. * testsuite/libgomp.oacc-c-c++-common/kernels-loop-mod-not-zero.c: Same. * testsuite/libgomp.oacc-c-c++-common/kernels-loop-n.c: Same. * testsuite/libgomp.oacc-c-c++-common/kernels-loop-nest.c: Same. * testsuite/libgomp.oacc-c-c++-common/kernels-loop.c: Same. * testsuite/libgomp.oacc-c-c++-common/kernels-parallel-loop-data-enter-exit.c: Same. * testsuite/libgomp.oacc-c-c++-common/kernels-reduction.c: Same. From-SVN: r232515
2016-01-18 13:53:03 +01:00
#include <stdlib.h>
#define N (1024 * 512)
#define COUNTERTYPE unsigned int
int
main (void)
{
unsigned int i;
unsigned int *__restrict c;
c = (unsigned int *__restrict)malloc (N * sizeof (unsigned int));
for (COUNTERTYPE i = 0; i < N; i++)
c[i] = i * 2;
#pragma acc kernels copy (c[0:N])
{
for (COUNTERTYPE ii = 0; ii < N; ii++)
c[ii] = c[ii] + ii + 1;
}
for (COUNTERTYPE i = 0; i < N; i++)
if (c[i] != i * 2 + i + 1)
abort ();
free (c);
return 0;
}