1 /* { dg-do run { target openacc_nvidia_accel_selected } } */
2 /* { dg-additional-options "-fopenacc-dim=::128" } */
3 /* { dg-additional-options "-foffload=-fdump-tree-oaccloops" } */
4 /* { dg-set-target-env-var "GOMP_DEBUG" "1" } */
5
6 #include <stdlib.h>
7
8 #define N 1024
9
10 unsigned int a[N];
11 unsigned int b[N];
12 unsigned int c[N];
13 unsigned int n = N;
14
15 int
16 main (void)
17 {
18 for (unsigned int i = 0; i < n; ++i)
19 {
20 a[i] = i % 3;
21 b[i] = i % 5;
22 }
23
24 #pragma acc parallel copyin (a,b) copyout (c)
25 {
26 #pragma acc loop vector
27 for (unsigned int i = 0; i < n; i++)
28 c[i] = a[i] + b[i];
29 }
30
31 for (unsigned int i = 0; i < n; ++i)
32 if (c[i] != (i % 3) + (i % 5))
33 abort ();
34
35 return 0;
36 }
37
38 /* { dg-final { scan-offload-tree-dump "__attribute__\\(\\(oacc function \\(1, 1, 128\\)" "oaccloops" } } */
39 /* { dg-output "nvptx_exec: kernel main\\\$_omp_fn\\\$0: launch gangs=1, workers=1, vectors=128" } */