Debian Codegraph @

gcc/testsuite/c-c++-common/goacc/combined-reduction.c

raw
1 /* { dg-do compile } */
2 /* { dg-options "-fopenacc -fdump-tree-gimple" } */
3
4 /* See also '../../gfortran.dg/goacc/reduction-2.f95'. */
5
6 #include <assert.h>
7
8 int
9 main ()
10 {
11 int i, v1 = 0, n = 100;
12
13 #pragma acc parallel loop reduction(+:v1)
14 for (i = 0; i < n; i++)
15 v1++;
16
17 assert (v1 == n);
18
19 #pragma acc kernels loop reduction(+:v1)
20 for (i = 0; i < n; i++)
21 v1++;
22
23 assert (v1 == n);
24
25 #pragma acc serial loop reduction(+:v1)
26 for (i = 0; i < n; i++)
27 v1++;
28
29 assert (v1 == n);
30
31 return 0;
32 }
33
34 /* { dg-final { scan-tree-dump-times "omp target oacc_parallel reduction.+:v1. map.tofrom:v1" 1 "gimple" } } */
35 /* { dg-final { scan-tree-dump-times "acc loop reduction.+:v1. private.i." 1 "gimple" } } */
36 /* { dg-final { scan-tree-dump-times "omp target oacc_kernels map.force_tofrom:n .len: 4.. map.force_tofrom:v1 .len: 4.." 1 "gimple" } } */
37 /* { dg-final { scan-tree-dump-times "acc loop reduction.+:v1. private.i." 1 "gimple" } } */
38 /* { dg-final { scan-tree-dump-times "omp target oacc_serial reduction.+:v1. map.tofrom:v1" 1 "gimple" } } */
39 /* { dg-final { scan-tree-dump-times "acc loop reduction.+:v1. private.i." 1 "gimple" } } */