]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/testsuite/c-c++-common/goacc/kernels-reduction.c
[PR middle-end/69921] Use "oacc kernels parallelized" attribute for parallelized...
[thirdparty/gcc.git] / gcc / testsuite / c-c++-common / goacc / kernels-reduction.c
1 /* { dg-additional-options "-O2" } */
2 /* { dg-additional-options "-fdump-tree-parloops1-all" } */
3 /* { dg-additional-options "-fdump-tree-optimized" } */
4
5 #include <stdlib.h>
6
7 #define n 10000
8
9 unsigned int a[n];
10
11 void __attribute__((noinline,noclone))
12 foo (void)
13 {
14 int i;
15 unsigned int sum = 1;
16
17 #pragma acc kernels copyin (a[0:n]) copy (sum)
18 {
19 for (i = 0; i < n; ++i)
20 sum += a[i];
21 }
22
23 if (sum != 5001)
24 abort ();
25 }
26
27 /* Check that only one loop is analyzed, and that it can be parallelized. */
28 /* { dg-final { scan-tree-dump-times "SUCCESS: may be parallelized" 1 "parloops1" } } */
29 /* { dg-final { scan-tree-dump-times "(?n)__attribute__\\(\\(oacc kernels parallelized, oacc function \\(, , \\), oacc kernels, omp target entrypoint\\)\\)" 1 "parloops1" } } */
30 /* { dg-final { scan-tree-dump-not "FAILED:" "parloops1" } } */
31
32 /* Check that the loop has been split off into a function. */
33 /* { dg-final { scan-tree-dump-times "(?n);; Function .*foo.*._omp_fn.0" 1 "optimized" } } */