OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [tags/] [gnu-src/] [gcc-4.5.1/] [gcc-4.5.1-or32-1.0rc1/] [gcc/] [testsuite/] [gcc.dg/] [sibcall-4.c] - Diff between revs 298 and 338

Only display areas with differences | Details | Blame | View Log

Rev 298 Rev 338
/* Simple check that sibling calls are performed from a
/* Simple check that sibling calls are performed from a
   void non-leaf-function taking no arguments calling a function which
   void non-leaf-function taking no arguments calling a function which
   is about the same as itself.
   is about the same as itself.
 
 
   Copyright (C) 2002 Free Software Foundation Inc.
   Copyright (C) 2002 Free Software Foundation Inc.
   Contributed by Hans-Peter Nilsson  <hp@bitrange.com>  */
   Contributed by Hans-Peter Nilsson  <hp@bitrange.com>  */
 
 
/* { dg-do run { xfail { { arc-*-* avr-*-* cris-*-* crisv32-*-* h8300-*-* hppa*64*-*-* m32r-*-* m68hc1?-*-* mcore-*-* mn10300-*-* xstormy16-*-* v850*-*-* vax-*-* xtensa*-*-* } || { arm*-*-* && { ! arm32 } } } } } */
/* { dg-do run { xfail { { arc-*-* avr-*-* cris-*-* crisv32-*-* h8300-*-* hppa*64*-*-* m32r-*-* m68hc1?-*-* mcore-*-* mn10300-*-* xstormy16-*-* v850*-*-* vax-*-* xtensa*-*-* } || { arm*-*-* && { ! arm32 } } } } } */
/* -mlongcall disables sibcall patterns.  */
/* -mlongcall disables sibcall patterns.  */
/* { dg-skip-if "" { powerpc*-*-* } { "-mlongcall" } { "" } } */
/* { dg-skip-if "" { powerpc*-*-* } { "-mlongcall" } { "" } } */
/* { dg-options "-O2 -foptimize-sibling-calls" } */
/* { dg-options "-O2 -foptimize-sibling-calls" } */
 
 
/* The option -foptimize-sibling-calls is the default, but serves as
/* The option -foptimize-sibling-calls is the default, but serves as
   marker.  This test is xfailed on targets without sibcall patterns
   marker.  This test is xfailed on targets without sibcall patterns
   (except targets where the test does not work due to the return address
   (except targets where the test does not work due to the return address
   not saved on the regular stack).  */
   not saved on the regular stack).  */
 
 
extern void abort (void);
extern void abort (void);
extern void exit (int);
extern void exit (int);
 
 
/* Sibcalls are not supported in MIPS16 mode, which has direct calls but
/* Sibcalls are not supported in MIPS16 mode, which has direct calls but
   not direct jumps.  */
   not direct jumps.  */
#ifdef __mips
#ifdef __mips
#define ATTR __attribute__((nomips16))
#define ATTR __attribute__((nomips16))
#else
#else
#define ATTR
#define ATTR
#endif
#endif
 
 
static ATTR void recurser_void1 (void);
static ATTR void recurser_void1 (void);
static ATTR void recurser_void2 (void);
static ATTR void recurser_void2 (void);
extern void track (void);
extern void track (void);
 
 
int n = 0;
int n = 0;
int main ()
int main ()
{
{
  recurser_void1 ();
  recurser_void1 ();
  exit (0);
  exit (0);
}
}
 
 
/* The functions should get the same stack-frame, and best way to make it
/* The functions should get the same stack-frame, and best way to make it
   reasonably sure is to make them have the same contents (regarding the
   reasonably sure is to make them have the same contents (regarding the
   n tests).  */
   n tests).  */
 
 
static void __attribute__((noinline)) ATTR
static void __attribute__((noinline)) ATTR
recurser_void1 (void)
recurser_void1 (void)
{
{
  if (n == 0 || n == 7 || n == 8)
  if (n == 0 || n == 7 || n == 8)
    track ();
    track ();
 
 
  if (n == 10)
  if (n == 10)
    return;
    return;
  n++;
  n++;
  recurser_void2 ();
  recurser_void2 ();
}
}
 
 
static void __attribute__((noinline)) ATTR
static void __attribute__((noinline)) ATTR
recurser_void2 (void)
recurser_void2 (void)
{
{
  if (n == 0 || n == 7 || n == 8)
  if (n == 0 || n == 7 || n == 8)
    track ();
    track ();
 
 
  if (n == 10)
  if (n == 10)
    return;
    return;
  n++;
  n++;
  recurser_void1 ();
  recurser_void1 ();
}
}
 
 
void *trackpoint;
void *trackpoint;
 
 
void __attribute__ ((noinline))
void __attribute__ ((noinline))
track ()
track ()
{
{
  char stackpos[1];
  char stackpos[1];
 
 
  if (n == 0)
  if (n == 0)
    trackpoint = stackpos;
    trackpoint = stackpos;
  else if ((n != 7 && n != 8) || trackpoint != stackpos)
  else if ((n != 7 && n != 8) || trackpoint != stackpos)
    abort ();
    abort ();
}
}
 
 

powered by: WebSVN 2.1.0

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