Mercurial > hg > CbC > CbC_gcc
comparison gcc/testsuite/gcc.dg/autopar/pr49960.c @ 111:04ced10e8804
gcc 7
author | kono |
---|---|
date | Fri, 27 Oct 2017 22:46:09 +0900 |
parents | |
children | 84e7813d76e9 |
comparison
equal
deleted
inserted
replaced
68:561a7518be6b | 111:04ced10e8804 |
---|---|
1 /* { dg-do compile } */ | |
2 /* { dg-options "-O2 -ftree-parallelize-loops=4 -fdump-tree-parloops2-details -fdump-tree-optimized -fno-partial-inlining" } */ | |
3 | |
4 #include <stdio.h> | |
5 #define MB 100 | |
6 #define NA 450 | |
7 #define MA 400 | |
8 | |
9 int T[MA][MB],A[MA][NA],B[MB][NA]; | |
10 void MRTRBR(int MA_1, int NA_1, int MB_1) | |
11 { | |
12 int i,j, t,k; | |
13 | |
14 /* At the moment we are not able to hoist the loop headers out of the loop | |
15 nest. | |
16 Partial inlining needs to be disabled so we do not optimize this out | |
17 of the function body. */ | |
18 if (MA_1 < 4 || NA_1 < 4 || MB_1 < 4) | |
19 return; | |
20 | |
21 /* The outer most loop is not parallel because for different k's there | |
22 is write-write dependency for T[i][j]. */ | |
23 | |
24 /* The two inner loops don't get parallelized due to low number of | |
25 iterations. */ | |
26 | |
27 for (k = 3; k < NA_1; k++) | |
28 for (i = 3; i < MA_1; i++) | |
29 for (j = 3; j < MB_1; j++) | |
30 { | |
31 t = T[i][j]; | |
32 T[i][j] = t+2+A[i][k]*B[j][k]; | |
33 } | |
34 } | |
35 void main () | |
36 { | |
37 int j,i; | |
38 | |
39 for (i = 3; i < MA; i++) | |
40 for (j = 3; j < MB; j++) | |
41 T[i][j] = (i>j?i:j); | |
42 | |
43 MRTRBR (MA,NA,MB); | |
44 | |
45 for (i = MA-1; i < MA; i++) | |
46 for (j = MB-10; j < MB; j++) | |
47 printf ("i %d j %d T[i][j] = %d\n",i,j,T[i][j]); | |
48 } | |
49 | |
50 | |
51 /* Check that the outer most loop doesn't get parallelized (thus no loop gets parallelized) */ | |
52 | |
53 /* { dg-final { scan-tree-dump-times "SUCCESS: may be parallelized" 0 "parloops2" } } */ | |
54 /* { dg-final { scan-tree-dump-times "loopfn" 0 "optimized" } } */ |