libcpp, c, middle-end: Optimize initializers using #embed in C
[official-gcc.git] / gcc / testsuite / gcc.dg / loop-versioning-1.c
blob2f2c1eeee7221c25e002a3c9a8ea414a1cbbb381
1 /* { dg-options "-O3 -fdump-tree-lversion-details" } */
2 /* { dg-require-effective-target size32plus } */
4 /* The simplest IV case. */
6 void
7 f1 (double *x, int stepx, int n)
9 for (int i = 0; i < n; ++i)
10 x[stepx * i] = 100;
13 void
14 f2 (double *x, int stepx, int limit)
16 for (int i = 0; i < limit; i += stepx)
17 x[i] = 100;
20 void
21 f3 (double *x, int stepx, int limit)
23 for (double *y = x; y < x + limit; y += stepx)
24 *y = 100;
27 void
28 f4 (double *x, int stepx, unsigned int n)
30 for (unsigned int i = 0; i < n; ++i)
31 x[stepx * i] = 100;
34 void
35 f5 (double *x, int stepx, unsigned int limit)
37 for (unsigned int i = 0; i < limit; i += stepx)
38 x[i] = 100;
41 void
42 f6 (double *x, int stepx, unsigned int limit)
44 for (double *y = x; y < x + limit; y += stepx)
45 *y = 100;
48 #if __SIZEOF_SIZE_T__ < 4
49 double x[1000];
50 #else
51 double x[10000];
52 #endif
54 void
55 g1 (int stepx, int n)
57 for (int i = 0; i < n; ++i)
58 x[stepx * i] = 100;
61 void
62 g2 (int stepx, int limit)
64 for (int i = 0; i < limit; i += stepx)
65 x[i] = 100;
68 void
69 g3 (int stepx, int limit)
71 for (double *y = x; y < x + limit; y += stepx)
72 *y = 100;
75 void
76 g4 (int stepx, unsigned int n)
78 for (unsigned int i = 0; i < n; ++i)
79 x[stepx * i] = 100;
82 void
83 g5 (int stepx, unsigned int limit)
85 for (unsigned int i = 0; i < limit; i += stepx)
86 x[i] = 100;
89 void
90 g6 (int stepx, unsigned int limit)
92 for (double *y = x; y < x + limit; y += stepx)
93 *y = 100;
96 /* { dg-final { scan-tree-dump-times {want to version containing loop} 12 "lversion" } } */
97 /* { dg-final { scan-tree-dump-times {versioned this loop} 12 "lversion" } } */