summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.target/powerpc/pr79439-2.c
blob: ec142081ff309fe9e0936d1952491c63f95f62d9 (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
/* { dg-do compile { target { powerpc*-*-linux* && lp64 } } } */
/* { dg-options "-O2 -fpic -fno-reorder-blocks -mno-pcrel" } */
/* { dg-require-effective-target fpic } */

/* On the Linux 64-bit ABIs, we should not eliminate NOP in the 'rec' call if
   -fpic is used because rec can be interposed at link time (since it has an
   alias), and the recursive call should call the interposed function.  The
   Linux 32-bit ABIs do not require NOPs after the BL instruction.  */

int f (void);

void
g (void)
{
}

int
rec (int a)
{
  int ret = 0;
  if (a > 10 && f ())
    ret += rec (a - 1);
  g ();
  return a + ret;
}

int rec_alias (int) __attribute__ ((alias ("rec")));

/* { dg-final { scan-assembler-times {\mbl f\M}   1 } } */
/* { dg-final { scan-assembler-times {\mbl g\M}   1 } } */
/* { dg-final { scan-assembler-times {\mbl rec\M} 1 } } */
/* { dg-final { scan-assembler-times {\mnop\M}    3 } } */