summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.target/i386/pr67770.c
blob: 9368524c145b0b92933e067cfc46792fa9df5552 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/* PR target/67770 */
/* { dg-do run { target ia32 } } */
/* { dg-require-effective-target trampolines } */
/* { dg-options "-O2" } */

__attribute__ ((noinline)) void
foo (int i, void (* __attribute__ ((regparm (3))) bar) (int))
{
  bar (i);
}

int
main ()
{
  int p = 0;

  __attribute__ ((regparm (3), noinline)) void
  bar (int i)
  {
    if (__builtin_expect (i, 0))
      ++p;
  }

  foo (0, bar);
  bar (0);

  if (p != 0)
    __builtin_abort ();

  foo (1, bar);
  bar (1);

  if (p != 2)
    __builtin_abort ();

  return 0;
}