1 /* Verify that a simple, explicit acc loop reduction works inside
2 a kernels region. */
3
4 /* { dg-additional-options "--param=openacc-kernels=decompose" } */
5
6 /* { dg-additional-options "-fopt-info-all-omp" }
7 { dg-additional-options "-foffload=-fopt-info-all-omp" } */
8
9 /* { dg-additional-options "--param=openacc-privatization=noisy" }
10 { dg-additional-options "-foffload=--param=openacc-privatization=noisy" }
11 Prune a few: uninteresting, and potentially varying depending on GCC configuration (data types):
12 { dg-prune-output {note: variable 'D\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} } */
13
14 #include <stdlib.h>
15
16 #define N 100
17
18 int
19 main ()
20 {
21 int i, red = 0;
22
23 #pragma acc kernels /* { dg-line l_compute1 } */
24 /* { dg-note {OpenACC 'kernels' decomposition: variable 'red' in 'copy' clause requested to be made addressable} {} { target *-*-* } l_compute1 }
25 { dg-note {variable 'red' made addressable} {} { target *-*-* } l_compute1 } */
26 {
27 #pragma acc loop reduction (+:red) /* { dg-line l_loop_i1 } */
28 /* { dg-note {forwarded loop nest in OpenACC 'kernels' region to 'parloops' for analysis} {} { target *-*-* } l_loop_i1 } */
29 /* { dg-note {variable 'i' in 'private' clause isn't candidate for adjusting OpenACC privatization level: not addressable} {} { target *-*-* } l_loop_i1 } */
30 /* { dg-optimized {assigned OpenACC seq loop parallelism} {} { target *-*-* } l_loop_i1 } */
31 for (i = 0; i < N; i++)
32 red++;
33 }
34
35 if (red != N)
36 abort ();
37
38 return 0;
39 }