aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/predict-4.C
blob: ab40b48a3400029f3a8271a7b5e2e4047010c882 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
/* { dg-do compile } */
/* { dg-options "-O2 -fdump-tree-profile_estimate -std=c++11" } */

int a, b, c;

void
bar ()
{
  switch (a)
  {
    case 3: __builtin_puts("a"); break;
    [[unlikely]] case 42: __builtin_puts("e"); break;
    [[likely]] case 333: __builtin_puts("i"); break;
  } 
}

/* { dg-final { scan-tree-dump "default.*4.98%.*case 3.*4.98%.*case 42.*0.05%.*case 333.*90.00%" "profile_estimate"} } */