aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.apple/asm-function-5.c
blob: 7808daaa81bd58c1380f964347b3e20e1bf1c83d (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
38
39
40
41
42
43
44
45
46
47
48
49
/* APPLE LOCAL file CW asm blocks */
/* Test function calls in asm functions.  */

/* { dg-do run { target powerpc*-*-* } } */
/* { dg-options "-fasm-blocks -O2" } */

void abort(void);

int glob = 0;

int other ();
int stubfn ();
int localfn () { return other (); }

asm void foo(int arg)
{
  nofralloc
  mflr r0
  stmw r30,-8(r1)
  stw r0,8(r1)
  stwu r1,-80(r1)
  bl stubfn
    /*  bl L_stubfn$stub */
  lwz r0,88(r1)
  addi r1,r1,80
  mtlr r0
  lmw r30,-8(r1)
  b localfn
}

void bar (int arg)
{
  stubfn ();
  localfn ();
}

int stubfn () { return other(); }

int other () { return ++glob; }

int main ()
{
  bar(34);
  foo(92);
  if (glob != 4)
    abort ();
  return 0;
}