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