annotate gcc/testsuite/gcc.dg/autopar/pr49960.c @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents 04ced10e8804
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
111
kono
parents:
diff changeset
1 /* { dg-do compile } */
kono
parents:
diff changeset
2 /* { dg-options "-O2 -ftree-parallelize-loops=4 -fdump-tree-parloops2-details -fdump-tree-optimized -fno-partial-inlining" } */
kono
parents:
diff changeset
3
kono
parents:
diff changeset
4 #include <stdio.h>
kono
parents:
diff changeset
5 #define MB 100
kono
parents:
diff changeset
6 #define NA 450
kono
parents:
diff changeset
7 #define MA 400
kono
parents:
diff changeset
8
kono
parents:
diff changeset
9 int T[MA][MB],A[MA][NA],B[MB][NA];
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
10 void __attribute__((noinline))
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
11 MRTRBR(int MA_1, int NA_1, int MB_1)
111
kono
parents:
diff changeset
12 {
kono
parents:
diff changeset
13 int i,j, t,k;
kono
parents:
diff changeset
14
kono
parents:
diff changeset
15 /* At the moment we are not able to hoist the loop headers out of the loop
kono
parents:
diff changeset
16 nest.
kono
parents:
diff changeset
17 Partial inlining needs to be disabled so we do not optimize this out
kono
parents:
diff changeset
18 of the function body. */
kono
parents:
diff changeset
19 if (MA_1 < 4 || NA_1 < 4 || MB_1 < 4)
kono
parents:
diff changeset
20 return;
kono
parents:
diff changeset
21
kono
parents:
diff changeset
22 /* The outer most loop is not parallel because for different k's there
kono
parents:
diff changeset
23 is write-write dependency for T[i][j]. */
kono
parents:
diff changeset
24
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
25 /* The innermost loop doesn't get parallelized due to low number of
111
kono
parents:
diff changeset
26 iterations. */
kono
parents:
diff changeset
27
kono
parents:
diff changeset
28 for (k = 3; k < NA_1; k++)
kono
parents:
diff changeset
29 for (i = 3; i < MA_1; i++)
kono
parents:
diff changeset
30 for (j = 3; j < MB_1; j++)
kono
parents:
diff changeset
31 {
kono
parents:
diff changeset
32 t = T[i][j];
kono
parents:
diff changeset
33 T[i][j] = t+2+A[i][k]*B[j][k];
kono
parents:
diff changeset
34 }
kono
parents:
diff changeset
35 }
kono
parents:
diff changeset
36 void main ()
kono
parents:
diff changeset
37 {
kono
parents:
diff changeset
38 int j,i;
kono
parents:
diff changeset
39
kono
parents:
diff changeset
40 for (i = 3; i < MA; i++)
kono
parents:
diff changeset
41 for (j = 3; j < MB; j++)
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
42 {
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
43 __asm__ volatile ("" : : : "memory");
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
44 T[i][j] = (i>j?i:j);
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
45 }
111
kono
parents:
diff changeset
46
kono
parents:
diff changeset
47 MRTRBR (MA,NA,MB);
kono
parents:
diff changeset
48
kono
parents:
diff changeset
49 for (i = MA-1; i < MA; i++)
kono
parents:
diff changeset
50 for (j = MB-10; j < MB; j++)
kono
parents:
diff changeset
51 printf ("i %d j %d T[i][j] = %d\n",i,j,T[i][j]);
kono
parents:
diff changeset
52 }
kono
parents:
diff changeset
53
kono
parents:
diff changeset
54
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
55 /* Check that the outer most loop doesn't get parallelized. */
111
kono
parents:
diff changeset
56
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
57 /* { dg-final { scan-tree-dump-times "SUCCESS: may be parallelized" 1 "parloops2" } } */
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
58 /* { dg-final { scan-tree-dump-times "__builtin_GOMP_parallel" 1 "optimized" } } */