libcpp, c, middle-end: Optimize initializers using #embed in C
[official-gcc.git] / gcc / testsuite / gcc.dg / tree-ssa / scev-8.c
bloba5b2ff71958d63eec0e816508d9a800e455c861a
1 /* { dg-do compile } */
2 /* { dg-options "-O2 -fdump-tree-ivopts-details" } */
4 int *a;
6 #if __SIZEOF_INT__ == __SIZEOF_SHORT__
7 typedef char small_t;
8 #else
9 typedef short small_t;
10 #endif
12 int
13 foo1 (long long s, long long l)
15 long long i;
17 for (i = s; i < l; i++)
19 a[(small_t)i] = 0;
21 return 0;
24 int
25 foo2 (unsigned char s, unsigned char l, unsigned char c)
27 unsigned char i, step = 1;
28 int sum = 0;
30 for (i = s; i < l; i++)
32 sum += a[c];
33 c += step;
36 return sum;
39 int
40 foo3 (unsigned char s, unsigned char l, unsigned char c)
42 unsigned char i;
43 int sum = 0;
45 for (i = s; i != l; i += c)
47 sum += a[i];
50 return sum;
53 int
54 foo4 (unsigned char s, unsigned char l)
56 unsigned char i;
57 int sum = 0;
59 for (i = s; i != l; i++)
61 sum += a[i];
64 return sum;
67 /* Address of array references are not scevs. */
68 /* { dg-final { scan-tree-dump-not " Type:\\tREFERENCE ADDRESS\n" "ivopts" } } */