Imported Upstream version 4.8.1
[platform/upstream/gcc48.git] / gcc / testsuite / gcc.dg / tree-ssa / slsr-14.c
1 /* Straight-line strength reduction control flow variation.  */
2
3 /* { dg-do compile } */
4 /* { dg-options "-O3 -fdump-tree-optimized" } */
5
6 int
7 f (int n, int c, int s)
8 {
9   int a1, a2, x, x1, x2, x3, x4;
10
11   a1 = 2 * s;
12
13   if (n > 64)
14     {
15       x1 = c + a1;
16       a2 = 4 * s;
17       x2 = c + a2;
18       x = x1 + x2;
19     }
20   else
21     {
22       x3 = c + a1;
23       a2 = 4 * s;
24       x4 = c + a2;
25       x = x4 / x3;
26     }
27
28   return x;
29 }
30
31 /* { dg-final { scan-tree-dump-times " \\* " 1 "optimized" } } */
32 /* { dg-final { cleanup-tree-dump "optimized" } } */