]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/testsuite/c-c++-common/goacc/kernels-reduction.c
Use plain -fopenacc to enable OpenACC kernels processing
[thirdparty/gcc.git] / gcc / testsuite / c-c++-common / goacc / kernels-reduction.c
CommitLineData
40e26f94 1/* { dg-additional-options "-O2" } */
40e26f94
TV
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
9unsigned int a[n];
10
11void __attribute__((noinline,noclone))
12foo (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-not "FAILED:" "parloops1" } } */
30
31/* Check that the loop has been split off into a function. */
32/* { dg-final { scan-tree-dump-times "(?n);; Function .*foo.*._omp_fn.0" 1 "optimized" } } */
33
f99c3557 34/* { dg-final { scan-tree-dump-times "(?n)oacc function \\(0," 1 "parloops1" } } */