comparison gcc/testsuite/c-c++-common/goacc/kernels-double-reduction.c @ 111:04ced10e8804

gcc 7
author kono
date Fri, 27 Oct 2017 22:46:09 +0900
parents
children 1830386684a0
comparison
equal deleted inserted replaced
68:561a7518be6b 111:04ced10e8804
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 500
8
9 unsigned int a[N][N];
10
11 void __attribute__((noinline,noclone))
12 foo (void)
13 {
14 int i, j;
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 for (j = 0; j < N; ++j)
21 sum += a[i][j];
22 }
23
24 if (sum != 5001)
25 abort ();
26 }
27
28 /* Check that only one loop is analyzed, and that it can be parallelized. */
29 /* { dg-final { scan-tree-dump-times "SUCCESS: may be parallelized" 1 "parloops1" } } */
30 /* { dg-final { scan-tree-dump-times "(?n)__attribute__\\(\\(oacc kernels parallelized, oacc function \\(, , \\), oacc kernels, omp target entrypoint, noclone, noinline\\)\\)" 1 "parloops1" } } */
31 /* { dg-final { scan-tree-dump-not "FAILED:" "parloops1" } } */
32 /* { dg-final { scan-tree-dump-times "parallelizing outer loop" 1 "parloops1" } } */
33
34 /* Check that the loop has been split off into a function. */
35 /* { dg-final { scan-tree-dump-times "(?n);; Function .*foo.*._omp_fn.0" 1 "optimized" } } */