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/] [tree-ssa/] [loop-25.c] - Diff between revs 298 and 338

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

Rev 298 Rev 338
/* { dg-do compile } */
/* { dg-do compile } */
/* { dg-options "-O1 -fdump-tree-profile" } */
/* { dg-options "-O1 -fdump-tree-profile" } */
 
 
int foo(void);
int foo(void);
void bla(void);
void bla(void);
void bar(void);
void bar(void);
 
 
void test1 (void)
void test1 (void)
{
{
  unsigned i;
  unsigned i;
 
 
  /* Only one loop should be found here.  */
  /* Only one loop should be found here.  */
  i = 0;
  i = 0;
  while (1)
  while (1)
    {
    {
      i++;
      i++;
      if (i == 100)
      if (i == 100)
        break;
        break;
 
 
      if (foo ())
      if (foo ())
        bla ();
        bla ();
      else
      else
        bar ();
        bar ();
    }
    }
}
}
 
 
void test2 (void)
void test2 (void)
{
{
  unsigned i, j;
  unsigned i, j;
 
 
  /* Two loops should be found, in this case.  */
  /* Two loops should be found, in this case.  */
  i = j = 0;
  i = j = 0;
  while (1)
  while (1)
    {
    {
      j++;
      j++;
      foo ();
      foo ();
      if (j < 100)
      if (j < 100)
        continue;
        continue;
 
 
      i++;
      i++;
      j = 0;
      j = 0;
      if (i == 100)
      if (i == 100)
        break;
        break;
    }
    }
}
}
 
 
void test3 (void)
void test3 (void)
{
{
  unsigned i, j, k;
  unsigned i, j, k;
 
 
  /* Three loops.  */
  /* Three loops.  */
  i = j = k = 0;
  i = j = k = 0;
  while (1)
  while (1)
    {
    {
      j++;
      j++;
      foo ();
      foo ();
      if (j < 100)
      if (j < 100)
        continue;
        continue;
 
 
      j = 0;
      j = 0;
      k++;
      k++;
      if (k < 100)
      if (k < 100)
        continue;
        continue;
 
 
      k = 0;
      k = 0;
      i++;
      i++;
      if (i == 100)
      if (i == 100)
        break;
        break;
    }
    }
}
}
 
 
void test4 (void)
void test4 (void)
{
{
  unsigned i, j, k;
  unsigned i, j, k;
 
 
  /* Two loops with a nested subloop.  */
  /* Two loops with a nested subloop.  */
  i = j = 0;
  i = j = 0;
  while (1)
  while (1)
    {
    {
      j++;
      j++;
      foo ();
      foo ();
      for (k = 0; k < 100; k++)
      for (k = 0; k < 100; k++)
        foo ();
        foo ();
 
 
      if (j < 100)
      if (j < 100)
        continue;
        continue;
 
 
      i++;
      i++;
      j = 0;
      j = 0;
      if (i == 100)
      if (i == 100)
        break;
        break;
    }
    }
}
}
 
 
 
 
void test5 (void)
void test5 (void)
{
{
  unsigned i, j;
  unsigned i, j;
 
 
  /* Both subloop and non-subloop back edges.  */
  /* Both subloop and non-subloop back edges.  */
  i = j = 0;
  i = j = 0;
  while (1)
  while (1)
    {
    {
      j++;
      j++;
      foo ();
      foo ();
      if (j < 100)
      if (j < 100)
        continue;
        continue;
      j = 0;
      j = 0;
 
 
      i++;
      i++;
      if (i == 100)
      if (i == 100)
        break;
        break;
 
 
      if (foo ())
      if (foo ())
        bla ();
        bla ();
      else
      else
        bar ();
        bar ();
    }
    }
}
}
 
 
/* { dg-final { scan-tree-dump-times "Disambiguating loop" 5 "profile" } } */
/* { dg-final { scan-tree-dump-times "Disambiguating loop" 5 "profile" } } */
/* For the following xfail marks, see PR35629.  */
/* For the following xfail marks, see PR35629.  */
/* { dg-final { scan-tree-dump-times "Found latch edge" 5 "profile" { xfail *-*-* } } } */
/* { dg-final { scan-tree-dump-times "Found latch edge" 5 "profile" { xfail *-*-* } } } */
/* { dg-final { scan-tree-dump-times "Merged latch edges" 2 "profile" { xfail *-*-* } } } */
/* { dg-final { scan-tree-dump-times "Merged latch edges" 2 "profile" { xfail *-*-* } } } */
/* { dg-final { scan-tree-dump-times "4 loops found" 2 "profile" { xfail *-*-* } } } */
/* { dg-final { scan-tree-dump-times "4 loops found" 2 "profile" { xfail *-*-* } } } */
/* { dg-final { scan-tree-dump-times "3 loops found" 2 "profile" { xfail *-*-* } } } */
/* { dg-final { scan-tree-dump-times "3 loops found" 2 "profile" { xfail *-*-* } } } */
/* { dg-final { scan-tree-dump-times "2 loops found" 1 "profile" { xfail *-*-* } } } */
/* { dg-final { scan-tree-dump-times "2 loops found" 1 "profile" { xfail *-*-* } } } */
 
 
/* { dg-final { cleanup-tree-dump "profile" } } */
/* { dg-final { cleanup-tree-dump "profile" } } */
 
 

powered by: WebSVN 2.1.0

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