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/] [trampoline-1.c] - Blame information for rev 298

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 298 jeremybenn
/* PR target/12865 */
2
/* Origin: Waldek Hebisch <hebisch@math.uni.wroc.pl> */
3
 
4
/* { dg-do run } */
5
/* { dg-require-effective-target trampolines } */
6
/* { dg-options "-O2" } */
7
 
8
#ifndef NO_TRAMPOLINES
9
 
10
/* This used to fail on various versions of Solaris 2 because the
11
   trampoline couldn't be made executable.  */
12
 
13
extern void abort(void);
14
extern double fabs(double);
15
 
16
void foo (void)
17
{
18
  const int correct[1100] = {1, 0, -2, 0, 1, 0, 1, -1, -10, -30, -67};
19
  int i;
20
 
21
  double x1 (void) {return 1; }
22
  double x2 (void) {return -1;}
23
  double x3 (void) {return -1;}
24
  double x4 (void) {return 1; }
25
  double x5 (void) {return 0; }
26
 
27
  typedef double pfun(void);
28
 
29
  double a (int k, pfun x1, pfun x2, pfun x3, pfun x4, pfun x5)
30
  {
31
    double b (void)
32
    {
33
      k = k - 1;
34
      return a (k, b, x1, x2, x3, x4 );
35
    }
36
 
37
    if (k <= 0)
38
      return x4 () + x5 ();
39
    else
40
      return b ();
41
  }
42
 
43
  for (i=0; i<=10; i++)
44
  {
45
    if (fabs(a( i, x1, x2, x3, x4, x5 ) - correct [i]) > 0.1)
46
      abort();
47
  }
48
}
49
#endif
50
 
51
int main (void)
52
{
53
#ifndef NO_TRAMPOLINES
54
  foo ();
55
#endif
56
  return 0;
57
}

powered by: WebSVN 2.1.0

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