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

Subversion Repositories openrisc

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

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

Line No. Rev Author Line
1 688 jeremybenn
#include <limits.h>
2
 
3
#define F 140
4
#define T 13
5
 
6
feq (float x, float y)
7
{
8
  if (x == y)
9
    return T;
10
  else
11
    return F;
12
}
13
 
14
fne (float x, float y)
15
{
16
  if (x != y)
17
    return T;
18
  else
19
    return F;
20
}
21
 
22
flt (float x, float y)
23
{
24
  if (x < y)
25
    return T;
26
  else
27
    return F;
28
}
29
 
30
fge (float x, float y)
31
{
32
  if (x >= y)
33
    return T;
34
  else
35
    return F;
36
}
37
 
38
fgt (float x, float y)
39
{
40
  if (x > y)
41
    return T;
42
  else
43
    return F;
44
}
45
 
46
fle (float x, float y)
47
{
48
  if (x <= y)
49
    return T;
50
  else
51
    return F;
52
}
53
 
54
float args[] =
55
{
56
  0.0F,
57
  1.0F,
58
  -1.0F,
59
  __FLT_MAX__,
60
  __FLT_MIN__,
61
  0.0000000000001F,
62
  123456789.0F,
63
  -987654321.0F
64
};
65
 
66
int correct_results[] =
67
{
68
 T, F, F, T, F, T,
69
 F, T, T, F, F, T,
70
 F, T, F, T, T, F,
71
 F, T, T, F, F, T,
72
 F, T, T, F, F, T,
73
 F, T, T, F, F, T,
74
 F, T, T, F, F, T,
75
 F, T, F, T, T, F,
76
 F, T, F, T, T, F,
77
 T, F, F, T, F, T,
78
 F, T, F, T, T, F,
79
 F, T, T, F, F, T,
80
 F, T, F, T, T, F,
81
 F, T, F, T, T, F,
82
 F, T, T, F, F, T,
83
 F, T, F, T, T, F,
84
 F, T, T, F, F, T,
85
 F, T, T, F, F, T,
86
 T, F, F, T, F, T,
87
 F, T, T, F, F, T,
88
 F, T, T, F, F, T,
89
 F, T, T, F, F, T,
90
 F, T, T, F, F, T,
91
 F, T, F, T, T, F,
92
 F, T, F, T, T, F,
93
 F, T, F, T, T, F,
94
 F, T, F, T, T, F,
95
 T, F, F, T, F, T,
96
 F, T, F, T, T, F,
97
 F, T, F, T, T, F,
98
 F, T, F, T, T, F,
99
 F, T, F, T, T, F,
100
 F, T, F, T, T, F,
101
 F, T, T, F, F, T,
102
 F, T, F, T, T, F,
103
 F, T, T, F, F, T,
104
 T, F, F, T, F, T,
105
 F, T, T, F, F, T,
106
 F, T, T, F, F, T,
107
 F, T, F, T, T, F,
108
 F, T, F, T, T, F,
109
 F, T, T, F, F, T,
110
 F, T, F, T, T, F,
111
 F, T, T, F, F, T,
112
 F, T, F, T, T, F,
113
 T, F, F, T, F, T,
114
 F, T, T, F, F, T,
115
 F, T, F, T, T, F,
116
 F, T, F, T, T, F,
117
 F, T, F, T, T, F,
118
 F, T, F, T, T, F,
119
 F, T, T, F, F, T,
120
 F, T, F, T, T, F,
121
 F, T, F, T, T, F,
122
 T, F, F, T, F, T,
123
 F, T, F, T, T, F,
124
 F, T, T, F, F, T,
125
 F, T, T, F, F, T,
126
 F, T, T, F, F, T,
127
 F, T, T, F, F, T,
128
 F, T, T, F, F, T,
129
 F, T, T, F, F, T,
130
 F, T, T, F, F, T,
131
 T, F, F, T, F, T,
132
};
133
 
134
int
135
main (void)
136
{
137
  int i, j, *res = correct_results;
138
 
139
  for (i = 0; i < 8; i++)
140
    {
141
      float arg0 = args[i];
142
      for (j = 0; j < 8; j++)
143
        {
144
          float arg1 = args[j];
145
 
146
          if (feq (arg0, arg1) != *res++)
147
            abort ();
148
          if (fne (arg0, arg1) != *res++)
149
            abort ();
150
          if (flt (arg0, arg1) != *res++)
151
            abort ();
152
          if (fge (arg0, arg1) != *res++)
153
            abort ();
154
          if (fgt (arg0, arg1) != *res++)
155
            abort ();
156
          if (fle (arg0, arg1) != *res++)
157
            abort ();
158
        }
159
    }
160
  exit (0);
161
}

powered by: WebSVN 2.1.0

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