libcpp, c, middle-end: Optimize initializers using #embed in C
[official-gcc.git] / gcc / testsuite / gcc.dg / tree-ssa / ldist-26.c
blob98450cf8c2be874b3060c005f7568fc96958daa8
1 /* { dg-do run } */
2 /* { dg-options "-O3 -ftree-loop-distribution -fdump-tree-ldist-details" } */
4 extern void abort (void);
6 int a[130], b[128], c[128];
8 int __attribute__((noinline,noclone))
9 foo (int len, int x)
11 int i;
12 for (i = 1; i <= len; ++i)
14 a[i] = a[i + 2] + 1;
15 b[i] = 0;
16 a[i + 1] = a[i] - 3;
17 if (i < x)
18 c[i] = a[i];
20 return i;
23 int main()
25 int i;
26 for (i = 0; i < 130; ++i)
27 a[i] = i;
28 foo (127, 67);
29 if (a[0] != 0 || a[1] != 4 || a[127] != 130)
30 abort ();
31 return 0;
34 /* Loop splitting splits the iteration space so we end up with two
35 loops entering loop distribution. Both should have the b[i] = 0
36 part split out as memset. */
37 /* { dg-final { scan-tree-dump-times "distributed: split to 1 loops and 1 library calls" 2 "ldist" } } */
38 /* { dg-final { scan-tree-dump-times "generated memset zero" 2 "ldist" } } */