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

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 149 jeremybenn
f1 (a)
2
     long a;
3
{
4
  int i;
5
  for (i = 0; i < 10; i++)
6
    {
7
      if (--a == -1)
8
        return i;
9
    }
10
  return -1;
11
}
12
 
13
f2 (a)
14
     long a;
15
{
16
  int i;
17
  for (i = 0; i < 10; i++)
18
    {
19
      if (--a != -1)
20
        return i;
21
    }
22
  return -1;
23
}
24
 
25
f3 (a)
26
     long a;
27
{
28
  int i;
29
  for (i = 0; i < 10; i++)
30
    {
31
      if (--a == 0)
32
        return i;
33
    }
34
  return -1;
35
}
36
 
37
f4 (a)
38
     long a;
39
{
40
  int i;
41
  for (i = 0; i < 10; i++)
42
    {
43
      if (--a != 0)
44
        return i;
45
    }
46
  return -1;
47
}
48
 
49
f5 (a)
50
     long a;
51
{
52
  int i;
53
  for (i = 0; i < 10; i++)
54
    {
55
      if (++a == 0)
56
        return i;
57
    }
58
  return -1;
59
}
60
 
61
f6 (a)
62
     long a;
63
{
64
  int i;
65
  for (i = 0; i < 10; i++)
66
    {
67
      if (++a != 0)
68
        return i;
69
    }
70
  return -1;
71
}
72
 
73
 
74
main()
75
{
76
  if (f1 (5L) != 5)
77
    abort ();
78
  if (f2 (1L) != 0)
79
    abort ();
80
  if (f2 (0L) != 1)
81
    abort ();
82
  if (f3 (5L) != 4)
83
    abort ();
84
  if (f4 (1L) != 1)
85
    abort ();
86
  if (f4 (0L) != 0)
87
    abort ();
88
  if (f5 (-5L) != 4)
89
    abort ();
90
  if (f6 (-1L) != 1)
91
    abort ();
92
  if (f6 (0L) != 0)
93
    abort ();
94
  exit (0);
95
}

powered by: WebSVN 2.1.0

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