PR tree-optimization/84740
[official-gcc.git] / gcc / testsuite / gcc.dg / vect / pr57741-3.c
blob2e4954ac7f14b21463b0ef0ca97e05c4eb96e8fd
1 /* PR tree-optimization/57741 */
2 /* { dg-require-effective-target vect_float } */
3 /* { dg-require-effective-target vect_int } */
4 /* { dg-additional-options "-ffast-math" } */
6 #include "tree-vect.h"
8 extern void abort (void);
10 float p[1024] __attribute__((aligned (32))) = { 17.0f };
11 float q[1024] __attribute__((aligned (32))) = { 17.0f };
12 char r[1024] __attribute__((aligned (32))) = { 1 };
14 __attribute__((noinline, noclone)) void
15 foo (float x)
17 int i;
18 float f = 1.0f, g = 2.0f;
19 for (i = 0; i < 1024; i++)
21 p[i] = f;
22 f += x;
23 q[i] = g;
24 g += 0.5f;
25 r[i]++;
29 int
30 main ()
32 int i;
33 check_vect ();
34 r[0] = 0;
35 foo (1.5f);
36 for (i = 0; i < 1024; i++)
37 if (p[i] != 1.0f + i * 1.5f || q[i] != 2.0f + i * 0.5f || r[i] != 1)
38 abort ();
39 return 0;
42 /* { dg-final { scan-tree-dump-times "vectorized 1 loop" 1 "vect" } } */