Mercurial > hg > CbC > CbC_gcc
comparison gcc/testsuite/c-c++-common/goacc/kernels-loop-mod-not-zero.c @ 111:04ced10e8804
gcc 7
author | kono |
---|---|
date | Fri, 27 Oct 2017 22:46:09 +0900 |
parents | |
children |
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 ((1024 * 512) + 1) | |
8 #define COUNTERTYPE unsigned int | |
9 | |
10 int | |
11 main (void) | |
12 { | |
13 unsigned int *__restrict a; | |
14 unsigned int *__restrict b; | |
15 unsigned int *__restrict c; | |
16 | |
17 a = (unsigned int *__restrict)malloc (N * sizeof (unsigned int)); | |
18 b = (unsigned int *__restrict)malloc (N * sizeof (unsigned int)); | |
19 c = (unsigned int *__restrict)malloc (N * sizeof (unsigned int)); | |
20 | |
21 for (COUNTERTYPE i = 0; i < N; i++) | |
22 a[i] = i * 2; | |
23 | |
24 for (COUNTERTYPE i = 0; i < N; i++) | |
25 b[i] = i * 4; | |
26 | |
27 #pragma acc kernels copyin (a[0:N], b[0:N]) copyout (c[0:N]) | |
28 { | |
29 for (COUNTERTYPE ii = 0; ii < N; ii++) | |
30 c[ii] = a[ii] + b[ii]; | |
31 } | |
32 | |
33 for (COUNTERTYPE i = 0; i < N; i++) | |
34 if (c[i] != a[i] + b[i]) | |
35 abort (); | |
36 | |
37 free (a); | |
38 free (b); | |
39 free (c); | |
40 | |
41 return 0; | |
42 } | |
43 | |
44 /* Check that only one loop is analyzed, and that it can be parallelized. */ | |
45 /* { dg-final { scan-tree-dump-times "SUCCESS: may be parallelized" 1 "parloops1" } } */ | |
46 /* { dg-final { scan-tree-dump-times "(?n)__attribute__\\(\\(oacc kernels parallelized, oacc function \\(, , \\), oacc kernels, omp target entrypoint\\)\\)" 1 "parloops1" } } */ | |
47 /* { dg-final { scan-tree-dump-not "FAILED:" "parloops1" } } */ | |
48 | |
49 /* Check that the loop has been split off into a function. */ | |
50 /* { dg-final { scan-tree-dump-times "(?n);; Function .*main._omp_fn.0" 1 "optimized" } } */ |