| 1 |
/* { dg-do run } */ |
| 2 |
/* { dg-additional-options "-ftree-parallelize-loops=2" } */ |
| 3 |
|
| 4 |
void abort (void); |
| 5 |
|
| 6 |
unsigned int g_sum = 1; |
| 7 |
|
| 8 |
unsigned int x[500][500]; |
| 9 |
|
| 10 |
void __attribute__((noinline,noclone)) |
| 11 |
parloop (int N) |
| 12 |
{ |
| 13 |
int i, j; |
| 14 |
unsigned int sum; |
| 15 |
|
| 16 |
/* Double reduction is detected, outer loop is parallelized. */ |
| 17 |
sum = 0; |
| 18 |
for (i = 0; i < N; i++) |
| 19 |
for (j = 0; j < N; j++) |
| 20 |
sum += x[i][j]; |
| 21 |
|
| 22 |
g_sum = sum; |
| 23 |
} |
| 24 |
|
| 25 |
int |
| 26 |
main (void) |
| 27 |
{ |
| 28 |
x[234][432] = 2; |
| 29 |
|
| 30 |
parloop (500); |
| 31 |
|
| 32 |
if (g_sum != 2) |
| 33 |
abort (); |
| 34 |
|
| 35 |
return 0; |
| 36 |
} |