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