[nvptx] Enable large vectors -- reduction testcases
[gcc.git] / libgomp / testsuite / libgomp.oacc-c-c++-common / vred2d-128.c
1 /* Test large vector lengths. */
2
3 #include <assert.h>
4
5 #define n 10000
6 int a1[n], a2[n];
7
8 #define gentest(name, outer, inner) \
9 void name () \
10 { \
11 long i, j, t1, t2, t3; \
12 _Pragma(outer) \
13 for (i = 0; i < n; i++) \
14 { \
15 t1 = 0; \
16 t2 = 0; \
17 _Pragma(inner) \
18 for (j = i; j < n; j++) \
19 { \
20 t1++; \
21 t2--; \
22 } \
23 a1[i] = t1; \
24 a2[i] = t2; \
25 } \
26 for (i = 0; i < n; i++) \
27 { \
28 assert (a1[i] == n-i); \
29 assert (a2[i] == -(n-i)); \
30 } \
31 } \
32
33 gentest (test1, "acc parallel loop gang vector_length (128) firstprivate (t1, t2)",
34 "acc loop vector reduction(+:t1) reduction(-:t2)")
35
36 gentest (test2, "acc parallel loop gang vector_length (128) firstprivate (t1, t2)",
37 "acc loop worker vector reduction(+:t1) reduction(-:t2)")
38
39 gentest (test3, "acc parallel loop gang worker vector_length (128) firstprivate (t1, t2)",
40 "acc loop vector reduction(+:t1) reduction(-:t2)")
41
42 gentest (test4, "acc parallel loop firstprivate (t1, t2)",
43 "acc loop reduction(+:t1) reduction(-:t2)")
44
45
46 int
47 main ()
48 {
49 test1 ();
50 test2 ();
51 test3 ();
52 test4 ();
53
54 return 0;
55 }