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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gcc-4.2.2/] [gcc/] [testsuite/] [gcc.c-torture/] [execute/] [20061220-1.c] - Rev 816

Compare with Previous | Blame | View Log

/* PR middle-end/30262 */
extern void abort (void);
 
int
foo (void)
{
  unsigned int x = 0;
 
  void nested (void)
  {
    x = 254;
  }
 
  nested ();
  asm volatile ("" :: "r" (x));
  asm volatile ("" :: "m" (x));
  asm volatile ("" :: "mr" (x));
  asm volatile ("" : "=r" (x) : "0" (x));
  asm volatile ("" : "=m" (x) : "m" (x));
  return x;
}
 
int
bar (void)
{
  unsigned int x = 0;
 
  void nested (void)
  {
    asm volatile ("" :: "r" (x));
    asm volatile ("" :: "m" (x));
    asm volatile ("" :: "mr" (x));
    x += 4;
    asm volatile ("" : "=r" (x) : "0" (x));
    asm volatile ("" : "=m" (x) : "m" (x));
  }
 
  nested ();
  return x;
}
 
int
baz (void)
{
  unsigned int x = 0;
 
  void nested (void)
  {
    void nested2 (void)
    {
      asm volatile ("" :: "r" (x));
      asm volatile ("" :: "m" (x));
      asm volatile ("" :: "mr" (x));
      x += 4;
      asm volatile ("" : "=r" (x) : "0" (x));
      asm volatile ("" : "=m" (x) : "m" (x));
    }
    nested2 ();
    nested2 ();
  }
 
  nested ();
  return x;
}
 
int
main (void)
{
  if (foo () != 254 || bar () != 4 || baz () != 8)
    abort ();
  return 0;
}
 

Compare with Previous | Blame | View Log

powered by: WebSVN 2.1.0

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