Require target lra in gcc.dg/pr108095.c
[official-gcc.git] / gcc / testsuite / gcc.dg / predict-22.c
blob1aed03fae792d44b12800cd93c534ec5c26be3d6
1 /* { dg-do compile { target freorder } } */
2 /* { dg-options "-O2 -fdump-tree-optimized-details-blocks -fdump-rtl-bbpart-details-blocks -freorder-blocks-and-partition" } */
3 volatile int v;
4 void bar (void) __attribute__((leaf, cold));
5 void baz (int *);
7 void
8 foo (int x, int y, int z)
10 static int f __attribute__((section ("mysection")));
11 f = 1;
12 if (__builtin_expect (x, 0))
13 if (__builtin_expect (y, 0))
14 if (__builtin_expect (z, 0))
16 f = 2;
17 bar ();
18 v += 1;
19 v *= 2;
20 v /= 2;
21 v -= 1;
22 v += 1;
23 v *= 2;
24 v /= 2;
25 v -= 1;
26 v += 1;
27 v *= 2;
28 v /= 2;
29 v -= 1;
30 v += 1;
31 v *= 2;
32 v /= 2;
33 v -= 1;
34 v += 1;
35 v *= 2;
36 v /= 2;
37 v -= 1;
38 v += 1;
39 v *= 2;
40 v /= 2;
41 v -= 1;
42 v += 1;
43 v *= 2;
44 v /= 2;
45 v -= 1;
46 v += 1;
47 v *= 2;
48 v /= 2;
49 v -= 1;
50 f = 3;
51 __builtin_abort ();
53 f = 4;
54 f = 5;
55 baz (&f);
57 /* { dg-final { scan-tree-dump-times "Invalid sum" 0 "optimized"} } */
58 /* { dg-final { scan-tree-dump-times "count 0 .precise" 1 "optimized"} } */
59 /* { dg-final { scan-rtl-dump-times "COLD_PARTITION" 1 "bbpart"} } */