OSDN Git Service

PR tree-optimization/51799
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.dg / tree-ssa / pr32044.c
1 /* { dg-do compile } */
2 /* { dg-options "-O2 -fdump-tree-optimized" } */
3
4 int foo (int n)
5 {
6   while (n >= 45)
7     n -= 45;
8
9   return n;
10 }
11
12 int bar (int n)
13 {
14   while (n >= 64)
15     n -= 64;
16
17   return n;
18 }
19
20 int bla (int n)
21 {
22   int i = 0;
23
24   while (n >= 45)
25     {
26       i++;
27       n -= 45;
28     }
29
30   return i;
31 }
32
33 int baz (int n)
34 {
35   int i = 0;
36
37   while (n >= 64)
38     {
39       i++;
40       n -= 64;
41     }
42
43   return i;
44 }
45
46 /* The loops computing division/modulo by 64 should be eliminated */
47 /* { dg-final { scan-tree-dump-times "if" 6 "optimized" } } */
48
49 /* There should be no division/modulo in the final dump (division and modulo
50    by 64 are done using bit operations).  */
51 /* { dg-final { scan-tree-dump-times "/" 0 "optimized" } } */
52 /* { dg-final { scan-tree-dump-times "%" 0 "optimized" } } */
53
54 /* { dg-final { cleanup-tree-dump "optimized" } } */