libcpp, c, middle-end: Optimize initializers using #embed in C
[official-gcc.git] / gcc / testsuite / gcc.dg / vect / vect-early-break_26.c
blob47d2a50218bd1b32fe43edcaaabb1079d0b26223
1 /* { dg-add-options vect_early_break } */
2 /* { dg-require-effective-target vect_early_break_hw } */
3 /* { dg-require-effective-target vect_int } */
4 /* { dg-require-effective-target vect_perm } */
6 #include "tree-vect.h"
8 void __attribute__((noipa))
9 foo (int * __restrict__ a, int * __restrict__ b, int * __restrict__ c)
11 int t1 = *c;
12 int t2 = *c;
13 for (int i = 0; i < 64; i+=2)
15 b[i] = a[i] - t1;
16 t1 = a[i];
17 b[i+1] = a[i+1] - t2;
18 t2 = a[i+1];
22 int a[64], b[64];
24 int
25 main ()
27 check_vect ();
28 for (int i = 0; i < 64; ++i)
30 a[i] = i;
31 __asm__ volatile ("" ::: "memory");
33 int c = 7;
34 foo (a, b, &c);
35 for (int i = 2; i < 64; i+=2)
36 if (b[i] != a[i] - a[i-2]
37 || b[i+1] != a[i+1] - a[i-1])
38 abort ();
39 if (b[0] != -7 || b[1] != -6)
40 abort ();
41 return 0;
44 /* { dg-final { scan-tree-dump-times "vectorized 1 loops in function" 2 "vect" } } */