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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [gcc.c-torture/] [execute/] [compare-1.c] - Blame information for rev 711

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

Line No. Rev Author Line
1 688 jeremybenn
/* Copyright (C) 2002 Free Software Foundation.
2
 
3
   Test for correctness of composite comparisons.
4
 
5
   Written by Roger Sayle, 3rd June 2002.  */
6
 
7
extern void abort (void);
8
 
9
int ieq (int x, int y, int ok)
10
{
11
  if ((x<=y) && (x>=y))
12
    {
13
      if (!ok) abort ();
14
    }
15
  else
16
    if (ok) abort ();
17
 
18
  if ((x<=y) && (x==y))
19
    {
20
      if (!ok) abort ();
21
    }
22
  else
23
    if (ok) abort ();
24
 
25
  if ((x<=y) && (y<=x))
26
    {
27
      if (!ok) abort ();
28
    }
29
  else
30
    if (ok) abort ();
31
 
32
  if ((y==x) && (x<=y))
33
    {
34
      if (!ok) abort ();
35
    }
36
  else
37
    if (ok) abort ();
38
}
39
 
40
int ine (int x, int y, int ok)
41
{
42
  if ((x<y) || (x>y))
43
    {
44
      if (!ok) abort ();
45
    }
46
  else
47
    if (ok) abort ();
48
}
49
 
50
int ilt (int x, int y, int ok)
51
{
52
  if ((x<y) && (x!=y))
53
    {
54
      if (!ok) abort ();
55
    }
56
  else
57
    if (ok) abort ();
58
}
59
 
60
int ile (int x, int y, int ok)
61
{
62
  if ((x<y) || (x==y))
63
    {
64
      if (!ok) abort ();
65
    }
66
  else
67
    if (ok) abort ();
68
}
69
 
70
int igt (int x, int y, int ok)
71
{
72
  if ((x>y) && (x!=y))
73
    {
74
      if (!ok) abort ();
75
    }
76
  else
77
    if (ok) abort ();
78
}
79
 
80
int ige (int x, int y, int ok)
81
{
82
  if ((x>y) || (x==y))
83
    {
84
      if (!ok) abort ();
85
    }
86
  else
87
    if (ok) abort ();
88
}
89
 
90
int
91
main ()
92
{
93
  ieq (1, 4, 0);
94
  ieq (3, 3, 1);
95
  ieq (5, 2, 0);
96
 
97
  ine (1, 4, 1);
98
  ine (3, 3, 0);
99
  ine (5, 2, 1);
100
 
101
  ilt (1, 4, 1);
102
  ilt (3, 3, 0);
103
  ilt (5, 2, 0);
104
 
105
  ile (1, 4, 1);
106
  ile (3, 3, 1);
107
  ile (5, 2, 0);
108
 
109
  igt (1, 4, 0);
110
  igt (3, 3, 0);
111
  igt (5, 2, 1);
112
 
113
  ige (1, 4, 0);
114
  ige (3, 3, 1);
115
  ige (5, 2, 1);
116
 
117
  return 0;
118
}
119
 

powered by: WebSVN 2.1.0

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