Debian Codegraph @

gcc/testsuite/c-c++-common/goacc/kernels-double-reduction.c

raw
1 /* { dg-additional-options "-O2" } */
2 /* { dg-additional-options "-fopt-info-optimized-omp" } */
3 /* { dg-additional-options "-fdump-tree-parloops1-all" } */
4 /* { dg-additional-options "-fdump-tree-optimized" } */
5
6 #include <stdlib.h>
7
8 #define N 500
9
10 unsigned int a[N][N];
11
12 void __attribute__((noinline,noclone))
13 foo (void)
14 {
15 int i, j;
16 unsigned int sum = 1;
17
18 #pragma acc kernels copyin (a[0:N]) copy (sum) /* { dg-message "optimized: assigned OpenACC gang loop parallelism" } */
19 {
20 for (i = 0; i < N; ++i)
21 for (j = 0; j < N; ++j)
22 sum += a[i][j];
23 }
24
25 if (sum != 5001)
26 abort ();
27 }
28
29 /* Check that only one loop is analyzed, and that it can be parallelized. */
30 /* { dg-final { scan-tree-dump-times "SUCCESS: may be parallelized" 1 "parloops1" } } */
31 /* { dg-final { scan-tree-dump-times "(?n)__attribute__\\(\\(oacc kernels parallelized, oacc function \\(, , \\), oacc kernels, omp target entrypoint, noclone, noinline\\)\\)" 1 "parloops1" } } */
32 /* { dg-final { scan-tree-dump-not "FAILED:" "parloops1" } } */
33 /* { dg-final { scan-tree-dump-times "parallelizing outer loop" 1 "parloops1" } } */
34
35 /* Check that the loop has been split off into a function. */
36 /* { dg-final { scan-tree-dump-times "(?n);; Function .*foo.*._omp_fn.0" 1 "optimized" } } */