aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/gcc.target/mips/lazy-binding-1.c
blob: a30594840dd173cf9ceb0978aa177da2ad338dbb (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
/* { dg-do compile } */
/* { dg-options "-mshared -mexplicit-relocs -fno-delayed-branch -fno-unroll-loops" } */
/* We can load into something other than $25 when not optimizing,
   then immediately move into $25.  */
/* { dg-skip-if "code quality test" { *-*-* } { "-O0" } { "" } } */

void bar (void);

NOMIPS16 void
foo (int n)
{
  while (n--)
    {
      bar ();
      bar ();
    }
}

/* There should be exactly five uses of $25: one to set up $gp, two to
   load the address of bar (), and two to call it.  */
/* { dg-final { scan-assembler-times "\tl.\t\\\$25,%call16\\\(bar\\\)" 2 } } */
/* { dg-final { scan-assembler-times "\tjalrs?\t\\\$25" 2 } } */
/* { dg-final { scan-assembler "(\\\$28,|\t.cpload\t)\\\$25" } } */
/* { dg-final { scan-assembler-times "\\\$25" 5 } } */