PR tree-optimization/84740
[official-gcc.git] / gcc / testsuite / gcc.dg / vect / pr66623.c
blobf90c673f82d330e5ebf77b20be8d98b34b6f6b05
1 /* { dg-require-effective-target vect_float } */
3 #include "tree-vect.h"
5 extern void abort (void);
7 #define OP *
8 #define INIT 1.0
10 float __attribute__((noinline,noclone))
11 foo (float *__restrict__ i)
13 float l = INIT;
14 int a;
15 int b;
17 for (a = 0; a < 4; a++)
18 for (b = 0; b < 4; b++)
19 l = l OP i[b];
21 return l;
24 float __attribute__((noinline,noclone))
25 foo_ref (float *__restrict__ i)
27 float l = INIT;
29 l = l OP i[0];
30 l = l OP i[1];
31 l = l OP i[2];
32 l = l OP i[3];
34 l = l OP i[0];
35 l = l OP i[1];
36 l = l OP i[2];
37 l = l OP i[3];
39 l = l OP i[0];
40 l = l OP i[1];
41 l = l OP i[2];
42 l = l OP i[3];
44 l = l OP i[0];
45 l = l OP i[1];
46 l = l OP i[2];
47 l = l OP i[3];
49 return l;
52 union u
54 float f;
55 unsigned int u;
58 int
59 main (void)
61 union u res, res2;
62 float a[4];
64 if (sizeof (float) != sizeof (unsigned int))
65 return 0;
67 check_vect ();
69 a[0] = 0.01;
70 a[1] = 0.01;
71 a[2] = 0.01;
72 a[3] = 1.0;
74 res.f = foo_ref (a);
76 res2.f = foo (a);
78 if (res.u != res2.u)
79 abort ();
81 return 0;
84 /* need -ffast-math to vectorize this loop. */
85 /* ARM NEON passes -ffast-math to these tests, so expect this to fail. */
86 /* { dg-final { scan-tree-dump-times "vectorized 0 loops" 1 "vect" { xfail arm_neon_ok } } } */