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

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.5.1/] [gcc/] [testsuite/] [gcc.target/] [i386/] [loop-1.c] - Blame information for rev 318

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 318 jeremybenn
/* PR optimization/9888 */
2
/* { dg-do run } */
3
/* { dg-require-effective-target ilp32 } */
4
/* { dg-options "-mtune=k6 -O3" } */
5
 
6
/* Verify that GCC doesn't emit out of range 'loop' instructions.  */
7
 
8
extern void abort (void);
9
extern void exit (int);
10
 
11
 
12
f1 (a)
13
     long a;
14
{
15
  int i;
16
  for (i = 0; i < 10; i++)
17
    {
18
      if (--a == -1)
19
        return i;
20
    }
21
  return -1;
22
}
23
 
24
f2 (a)
25
     long a;
26
{
27
  int i;
28
  for (i = 0; i < 10; i++)
29
    {
30
      if (--a != -1)
31
        return i;
32
    }
33
  return -1;
34
}
35
 
36
f3 (a)
37
     long a;
38
{
39
  int i;
40
  for (i = 0; i < 10; i++)
41
    {
42
      if (--a == 0)
43
        return i;
44
    }
45
  return -1;
46
}
47
 
48
f4 (a)
49
     long a;
50
{
51
  int i;
52
  for (i = 0; i < 10; i++)
53
    {
54
      if (--a != 0)
55
        return i;
56
    }
57
  return -1;
58
}
59
 
60
f5 (a)
61
     long a;
62
{
63
  int i;
64
  for (i = 0; i < 10; i++)
65
    {
66
      if (++a == 0)
67
        return i;
68
    }
69
  return -1;
70
}
71
 
72
f6 (a)
73
     long a;
74
{
75
  int i;
76
  for (i = 0; i < 10; i++)
77
    {
78
      if (++a != 0)
79
        return i;
80
    }
81
  return -1;
82
}
83
 
84
 
85
int main()
86
{
87
  if (f1 (5L) != 5)
88
    abort ();
89
  if (f2 (1L) != 0)
90
    abort ();
91
  if (f2 (0L) != 1)
92
    abort ();
93
  if (f3 (5L) != 4)
94
    abort ();
95
  if (f4 (1L) != 1)
96
    abort ();
97
  if (f4 (0L) != 0)
98
    abort ();
99
  if (f5 (-5L) != 4)
100
    abort ();
101
  if (f6 (-1L) != 1)
102
    abort ();
103
  if (f6 (0L) != 0)
104
    abort ();
105
  exit (0);
106
}

powered by: WebSVN 2.1.0

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