| 1 |
/* PR tree-optimization/53366 */ |
| 2 |
/* { dg-do run { target { size32plus } } } */ |
| 3 |
/* { dg-require-effective-target size32plus } */ |
| 4 |
|
| 5 |
extern void abort (void); |
| 6 |
|
| 7 |
struct S { double v[3]; }; |
| 8 |
struct T { struct S r, i; }; |
| 9 |
struct U { struct T j[5]; }; |
| 10 |
|
| 11 |
void |
| 12 |
foo (struct U *__restrict p1, struct U *__restrict p2, |
| 13 |
struct S l1, struct S l2, struct S l3, struct S l4, |
| 14 |
const double _Complex * __restrict x, int y, int z) |
| 15 |
{ |
| 16 |
int i, j; |
| 17 |
while (y < z - 2) |
| 18 |
{ |
| 19 |
for (j = 0; j < 5; ++j) |
| 20 |
{ |
| 21 |
double a = __real__ x[5 * y + j]; |
| 22 |
double b = __imag__ x[5 * y + j]; |
| 23 |
double c = __real__ x[5 * (y + 2) + j]; |
| 24 |
double d = __imag__ x[5 * (y + 2) + j]; |
| 25 |
double e = __real__ x[5 * (y + 1) + j]; |
| 26 |
double f = __imag__ x[5 * (y + 1) + j]; |
| 27 |
double g = __real__ x[5 * (y + 3) + j]; |
| 28 |
double h = __imag__ x[5 * (y + 3) + j]; |
| 29 |
for (i = 0; i < 3; ++i) |
| 30 |
{ |
| 31 |
p1->j[j].r.v[i] += l2.v[i] * a; |
| 32 |
p1->j[j].r.v[i] += l4.v[i] * c; |
| 33 |
p1->j[j].i.v[i] += l2.v[i] * b; |
| 34 |
p1->j[j].i.v[i] += l4.v[i] * d; |
| 35 |
p2->j[j].r.v[i] += l3.v[i] * e; |
| 36 |
p2->j[j].r.v[i] += l1.v[i] * g; |
| 37 |
p2->j[j].i.v[i] += l3.v[i] * f; |
| 38 |
p2->j[j].i.v[i] += l1.v[i] * h; |
| 39 |
} |
| 40 |
} |
| 41 |
y += 4; |
| 42 |
} |
| 43 |
} |
| 44 |
|
| 45 |
_Complex double x[5005]; |
| 46 |
struct U p1, p2; |
| 47 |
|
| 48 |
int |
| 49 |
main () |
| 50 |
{ |
| 51 |
int i, j; |
| 52 |
struct S l1, l2, l3, l4; |
| 53 |
for (i = 0; i < 5005; ++i) |
| 54 |
x[i] = i + 1.0iF * (2 * i); |
| 55 |
for (i = 0; i < 3; ++i) |
| 56 |
{ |
| 57 |
l1.v[i] = 1; |
| 58 |
l2.v[i] = 2; |
| 59 |
l3.v[i] = 3; |
| 60 |
l4.v[i] = 4; |
| 61 |
} |
| 62 |
foo (&p1, &p2, l1, l2, l3, l4, x, 5, 1000); |
| 63 |
for (j = 0; j < 5; ++j) |
| 64 |
for (i = 0; i < 3; ++i) |
| 65 |
if (p1.j[j].r.v[i] != 3752430 + j * 1494.0 |
| 66 |
|| p1.j[j].i.v[i] != p1.j[j].r.v[i] * 2 |
| 67 |
|| p2.j[j].r.v[i] != 2502450 + j * 996.0 |
| 68 |
|| p2.j[j].i.v[i] != p2.j[j].r.v[i] * 2) |
| 69 |
abort (); |
| 70 |
return 0; |
| 71 |
} |