Update 'Q' constraint documentation.
[official-gcc.git] / libgomp / testsuite / libgomp.oacc-c-c++-common / vector-length-128-4.c
blobe5d1df09b8a314088daf20f7b6c28174ba81b887
1 /* { dg-do run { target openacc_nvidia_accel_selected } } */
2 /* { dg-additional-options "-foffload=-fdump-tree-oaccdevlow" } */
3 /* { dg-set-target-env-var "GOMP_DEBUG" "1" } */
5 #include <stdlib.h>
7 #define N 1024
9 unsigned int a[N];
10 unsigned int b[N];
11 unsigned int c[N];
12 unsigned int n = N;
14 int
15 main (void)
17 for (unsigned int i = 0; i < n; ++i)
19 a[i] = i % 3;
20 b[i] = i % 5;
23 #pragma acc parallel num_workers (2) vector_length (128) copyin (a,b) copyout (c)
25 #pragma acc loop worker
26 for (unsigned int i = 0; i < 4; i++)
27 #pragma acc loop vector
28 for (unsigned int j = 0; j < n / 4; j++)
29 c[(i * N / 4) + j] = a[(i * N / 4) + j] + b[(i * N / 4) + j];
32 for (unsigned int i = 0; i < n; ++i)
33 if (c[i] != (i % 3) + (i % 5))
34 abort ();
36 return 0;
39 /* { dg-final { scan-offload-tree-dump "__attribute__\\(\\(oacc function \\(1, 2, 128\\)" "oaccdevlow" } } */
40 /* { dg-output "nvptx_exec: kernel main\\\$_omp_fn\\\$0: launch gangs=1, workers=2, vectors=128" } */