| 1 |
/* { dg-do run } */ |
| 2 |
/* { dg-options "-O2 -floop-interchange -fdump-tree-linterchange-details" } */ |
| 3 |
/* { dg-require-effective-target size20plus } */ |
| 4 |
/* { dg-skip-if "too big data segment" { visium-*-* } } */ |
| 5 |
|
| 6 |
typedef int int32_t __attribute__((mode (__SI__))); |
| 7 |
|
| 8 |
#define M 256 |
| 9 |
int a[M][M], b[M][M]; |
| 10 |
int32_t __attribute__((noinline)) |
| 11 |
double_reduc (int n) |
| 12 |
{ |
| 13 |
int32_t sum = 0; |
| 14 |
for (int j = 0; j < n; j++) |
| 15 |
{ |
| 16 |
for (int i = 0; i < n; i++) |
| 17 |
sum = sum + (int32_t)a[i][j]*(int32_t)b[i][j]; |
| 18 |
} |
| 19 |
return sum; |
| 20 |
} |
| 21 |
|
| 22 |
extern void abort (); |
| 23 |
|
| 24 |
static void __attribute__((noinline)) |
| 25 |
init (int i) |
| 26 |
{ |
| 27 |
for (int j = 0; j < M; j++) |
| 28 |
{ |
| 29 |
a[i][j] = i; |
| 30 |
b[i][j] = j; |
| 31 |
} |
| 32 |
} |
| 33 |
|
| 34 |
int main (void) |
| 35 |
{ |
| 36 |
for (int i = 0; i < M; ++i) |
| 37 |
init (i); |
| 38 |
|
| 39 |
int32_t sum = double_reduc (M); |
| 40 |
|
| 41 |
if (sum != 1065369600) |
| 42 |
abort (); |
| 43 |
|
| 44 |
return 0; |
| 45 |
} |
| 46 |
|
| 47 |
/* { dg-final { scan-tree-dump-times "Loop_pair<outer:., inner:.> is interchanged" 1 "linterchange" } } */ |