| 1 |
/* PR tree-optimization/83337 */ |
| 2 |
/* { dg-do run { target int32plus } } */ |
| 3 |
/* { dg-options "-O2 -floop-interchange" } */ |
| 4 |
/* { dg-skip-if "too big stack" { visium-*-* } } */ |
| 5 |
|
| 6 |
/* Copied from graphite/interchange-5.c */ |
| 7 |
|
| 8 |
#define DEBUG 0 |
| 9 |
#if DEBUG |
| 10 |
#include <stdio.h> |
| 11 |
#endif |
| 12 |
|
| 13 |
#define N 100 |
| 14 |
#define M 1111 |
| 15 |
|
| 16 |
extern void abort (); |
| 17 |
|
| 18 |
static void __attribute__((noipa)) |
| 19 |
foo (int n) |
| 20 |
{ |
| 21 |
int i, j; |
| 22 |
struct S { char d[n]; int a : 3; int b : 17; int c : 12; }; |
| 23 |
struct S A[N][M]; |
| 24 |
|
| 25 |
for (i = 0; i < N; i++) |
| 26 |
{ |
| 27 |
asm volatile ("" : : "g" (&A[0][0]) : "memory"); |
| 28 |
for (j = 0; j < M; j++) |
| 29 |
A[i][j].b = 2; |
| 30 |
} |
| 31 |
asm volatile ("" : : "g" (&A[0][0]) : "memory"); |
| 32 |
|
| 33 |
for (i = 0; i < M; i++) |
| 34 |
for (j = 0; j < N; j++) |
| 35 |
A[j][i].b = 5 * A[j][i].b; |
| 36 |
|
| 37 |
asm volatile ("" : : "g" (&A[0][0]) : "memory"); |
| 38 |
int res = A[0][0].b + A[N-1][M-1].b; |
| 39 |
|
| 40 |
#if DEBUG |
| 41 |
fprintf (stderr, "res = %d \n", res); |
| 42 |
#endif |
| 43 |
|
| 44 |
if (res != 20) |
| 45 |
abort (); |
| 46 |
} |
| 47 |
|
| 48 |
int |
| 49 |
main (void) |
| 50 |
{ |
| 51 |
foo (1); |
| 52 |
foo (8); |
| 53 |
return 0; |
| 54 |
} |