| 1 |
/* PR middle-end/66142 */ |
| 2 |
/* { dg-do compile } */ |
| 3 |
/* { dg-additional-options "-ffast-math -fopenmp-simd --param early-inlining-insns=14" } */ |
| 4 |
/* { dg-additional-options "-mavx" { target avx_runtime } } */ |
| 5 |
|
| 6 |
struct A { float x, y; }; |
| 7 |
struct B { struct A t, w; }; |
| 8 |
|
| 9 |
static inline float |
| 10 |
bar (const struct B *x) |
| 11 |
{ |
| 12 |
struct A r; |
| 13 |
float b, c, d; |
| 14 |
r.x = x->t.x; |
| 15 |
r.y = x->t.y; |
| 16 |
b = r.x * x->w.x + r.y * x->w.y; |
| 17 |
c = b + r.x * r.x + r.y * r.y; |
| 18 |
if (c > 0.0f) |
| 19 |
return c + 3.0f; |
| 20 |
return 0.0f; |
| 21 |
} |
| 22 |
|
| 23 |
void |
| 24 |
foo (float *a, float *b, float *c) |
| 25 |
{ |
| 26 |
int i; |
| 27 |
float z = 0.0f; |
| 28 |
float u = *a; |
| 29 |
#pragma omp simd |
| 30 |
for (i = 0; i < 32; i++) |
| 31 |
{ |
| 32 |
float x = b[i]; |
| 33 |
float y = c[i]; |
| 34 |
struct B r; |
| 35 |
r.t.x = 1.0f; |
| 36 |
r.t.y = u; |
| 37 |
r.w.x = x; |
| 38 |
r.w.y = y; |
| 39 |
z += bar (&r); |
| 40 |
} |
| 41 |
*a = z; |
| 42 |
} |
| 43 |
|
| 44 |
/* { dg-final { scan-tree-dump-times "vectorized 1 loops in function" 1 "vect" { target { vect_condition && vect_float } } } } */ |