OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.5.1/] [gcc/] [testsuite/] [gcc.dg/] [sibcall-6.c] - Blame information for rev 298

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 298 jeremybenn
/* A simple check to see whether indirect calls are
2
   being sibcall optimized on targets that do support
3
   this notion, i.e. have the according call patterns
4
   in place.
5
 
6
   Copyright (C) 2002 Free Software Foundation Inc.
7
   Contributed by Andreas Bauer <baueran@in.tum.de>  */
8
 
9
/* { dg-do run { target i?86-*-* x86_64-*-* s390*-*-* } } */
10
/* { dg-skip-if "" { { i?86-*-* x86_64-*-* } && { ilp32 && { ! nonpic } } } { "*" } { "" } } */
11
/* { dg-options "-O2 -foptimize-sibling-calls -fno-ipa-cp" } */
12
 
13
extern void abort (void);
14
extern void exit (int);
15
 
16
int foo (int);
17
int bar (int);
18
 
19
int (*ptr) (int);
20
int *f_addr;
21
 
22
int
23
main ()
24
{
25
  ptr = bar;
26
  foo (7);
27
  exit (0);
28
}
29
 
30
int __attribute__ ((noinline))
31
bar (b)
32
     int b;
33
{
34
  if (f_addr == (int*) __builtin_return_address (0))
35
    return b;
36
  else
37
    abort ();
38
}
39
 
40
int __attribute__ ((noinline))
41
foo (f)
42
     int f;
43
{
44
  f_addr = (int*) __builtin_return_address (0);
45
  return (*ptr)(f);
46
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.