| 1 |
/* { dg-do compile } */ |
| 2 |
/* { dg-options "-O2 -ftree-parallelize-loops=4 -fdump-tree-parloops2-details -fdump-tree-optimized" } */ |
| 3 |
|
| 4 |
void abort (void); |
| 5 |
|
| 6 |
int g_sum=0; |
| 7 |
int x[500][500]; |
| 8 |
|
| 9 |
void |
| 10 |
parloop (int N) |
| 11 |
{ |
| 12 |
int i, j; |
| 13 |
int sum; |
| 14 |
|
| 15 |
/* The inner reduction is not recognized as reduction because we cannot assume |
| 16 |
that int wraps on overflow. The way to fix this is to implement the |
| 17 |
reduction operation in unsigned type, but we've not yet implemented |
| 18 |
this. */ |
| 19 |
sum = 0; |
| 20 |
for (i = 0; i < N; i++) |
| 21 |
for (j = 0; j < N; j++) |
| 22 |
sum += x[i][j]; |
| 23 |
|
| 24 |
g_sum = sum; |
| 25 |
} |
| 26 |
|
| 27 |
|
| 28 |
/* { dg-final { scan-tree-dump-times "parallelizing inner loop" 0 "parloops2" } } */ |
| 29 |
/* { dg-final { scan-tree-dump-times "parallelizing outer loop" 1 "parloops2" { xfail *-*-* } } } */ |
| 30 |
/* { dg-final { scan-tree-dump-times "loopfn" 4 "optimized" { xfail *-*-* } } } */ |