libcpp, c, middle-end: Optimize initializers using #embed in C
[official-gcc.git] / gcc / testsuite / gcc.dg / vect / pr88598-6.c
blob2d6e0d73fae13d8ab74fc8b5e47d4fd8302b5ffe
1 /* { dg-additional-options "-ffast-math -fdump-tree-optimized" } */
3 #include "tree-vect.h"
5 #define N 4
7 float a[N];
9 float __attribute__ ((noipa))
10 f1 (void)
12 float b[N] = { 0, 1, 1, 1 }, res = 0;
13 for (int i = 0; i < N; ++i)
14 res += a[i] * b[i];
15 return res;
18 float __attribute__ ((noipa))
19 f2 (void)
21 float b[N] = { 0, 1, 0, 1 }, res = 0;
22 for (int i = 0; i < N; ++i)
23 res += a[i] * b[i];
24 return res;
27 float __attribute__ ((noipa))
28 f3 (void)
30 float b[N] = { 1, 1, 0, 0 }, res = 0;
31 for (int i = 0; i < N; ++i)
32 res += a[i] * b[i];
33 return res;
36 int
37 main ()
39 check_vect ();
41 for (int i = 0; i < N; ++i)
42 a[i] = 0xe0 + i;
44 if (f1 () != a[1] + a[2] + a[3]
45 || f2 () != a[1] + a[3]
46 || f3 () != a[0] + a[1])
47 __builtin_abort ();
49 return 0;