* tree-loop-distribution.c (struct partition): New field recording
[official-gcc.git] / gcc / testsuite / gcc.dg / vect / pr66142.c
blob94854eac2db94263d7efd929147854d1b37e0201
1 /* PR middle-end/66142 */
2 /* { dg-do compile } */
3 /* { dg-additional-options "-ffast-math -fopenmp-simd" } */
4 /* { dg-additional-options "-mavx" { target avx_runtime } } */
6 struct A { float x, y; };
7 struct B { struct A t, w; };
9 static inline float
10 bar (const struct B *x)
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;
23 void
24 foo (float *a, float *b, float *c)
26 int i;
27 float z = 0.0f;
28 float u = *a;
29 #pragma omp simd
30 for (i = 0; i < 32; i++)
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);
41 *a = z;
44 /* { dg-final { scan-tree-dump-times "vectorized 1 loops in function" 1 "vect" { target vect_condition } } } */