| 1 |
/* { dg-require-effective-target size32plus } */ |
| 2 |
|
| 3 |
#define DEBUG 0 |
| 4 |
#if DEBUG |
| 5 |
#include <stdio.h> |
| 6 |
#endif |
| 7 |
|
| 8 |
#define N 200 |
| 9 |
|
| 10 |
int A[N][N], B[N][N], C[N][N]; |
| 11 |
|
| 12 |
static int __attribute__((noinline)) |
| 13 |
matmult (void) |
| 14 |
{ |
| 15 |
int i, j, k; |
| 16 |
|
| 17 |
/* Loops J and K should be interchanged. */ |
| 18 |
for (i = 0; i < N; i++) |
| 19 |
for (j = 0; j < N; j++) |
| 20 |
{ |
| 21 |
A[i][j] = 0; |
| 22 |
for (k = 0; k < N; k++) |
| 23 |
A[i][j] += B[i][k] * C[k][j]; |
| 24 |
} |
| 25 |
|
| 26 |
return A[0][0] + A[N-1][N-1]; |
| 27 |
} |
| 28 |
|
| 29 |
extern void abort (); |
| 30 |
|
| 31 |
int |
| 32 |
main (void) |
| 33 |
{ |
| 34 |
int i, j, res; |
| 35 |
|
| 36 |
for (i = 0; i < N; i++) |
| 37 |
for (j = 0; j < N; j++) |
| 38 |
{ |
| 39 |
A[i][j] = 0; |
| 40 |
B[i][j] = i - j; |
| 41 |
C[i][j] = i + j; |
| 42 |
} |
| 43 |
|
| 44 |
res = matmult (); |
| 45 |
|
| 46 |
#if DEBUG |
| 47 |
fprintf (stderr, "res = %d \n", res); |
| 48 |
#endif |
| 49 |
|
| 50 |
if (res != 2626800) |
| 51 |
abort (); |
| 52 |
|
| 53 |
return 0; |
| 54 |
} |
| 55 |
|
| 56 |
/* { dg-final { scan-tree-dump "tiled by" "graphite" } } */ |