gcc/libgomp/testsuite/libgomp.oacc-c-c++-common/vector-length-128-10.c
Tom de Vries 2cb7a501ab [nvptx] Enable large vectors -- reduction testcases
Add various reduction test-cases with vector length 128.

2019-01-12  Tom de Vries  <tdevries@suse.de>

	* testsuite/libgomp.oacc-c-c++-common/vred2d-128.c: New test.
	* testsuite/libgomp.oacc-fortran/gemm.f90: New test.
	* testsuite/libgomp.oacc-c-c++-common/vector-length-128-10.c: New test.

From-SVN: r267892
2019-01-12 22:18:27 +00:00

40 lines
649 B
C

/* { dg-do run } */
#include <stdlib.h>
#define N 1024
unsigned int a[N];
unsigned int b[N];
unsigned int c[N];
unsigned int n = N;
int
main (void)
{
for (unsigned int i = 0; i < n; ++i)
{
a[i] = i % 3;
b[i] = i % 5;
}
unsigned int res = 1;
unsigned long long res2 = 1;
#pragma acc parallel vector_length (128) copyin (a,b) reduction (+:res, res2) copy (res, res2)
{
#pragma acc loop vector reduction (+:res, res2)
for (unsigned int i = 0; i < n; i++)
{
res += ((a[i] + b[i]) % 2);
res2 += ((a[i] + b[i]) % 2);
}
}
if (res != 478)
abort ();
if (res2 != 478)
abort ();
return 0;
}