summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.target/nios2/cdx-callret.c
blob: 239ec6e943e7b925d221b3a2ca6b27d85db42267 (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
/* { dg-do compile } */
/* { dg-options "-O2 -march=r2 -mcdx" } */

/* Check generation of R2 CDX callr.n, jmpr.n, ret.n instructions.  */

typedef int (*F) (void);

int x (F f)
{
  f ();

  /* Note that the compiler might generate a return via pop.n or ldwm;
     the test below is to make sure that it doesn't generate a 32-bit
     return instruction.  */
  return 3;
}

int y (F f)
{
  return f ();
}

/* { dg-final { scan-assembler "\tcallr\\.n\t.*" } } */
/* { dg-final { scan-assembler-not "\tret$" } } */
/* { dg-final { scan-assembler "\tjmpr\\.n\t.*" } } */