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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [gcc.dg/] [c99-math.h] - Blame information for rev 689

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 689 jeremybenn
#include <math.h>
2
#include <fenv.h>
3
 
4
extern void abort(void);
5
 
6
#define C99_MATH_TESTS(nan, inf, huge, norm1, norm2, norm3, sub, zero, neg) \
7
{                                                       \
8
  if (feclearexcept (FE_ALL_EXCEPT) != 0)                \
9
    abort();                                            \
10
                                                        \
11
                                                        \
12
  if (fpclassify (nan) != FP_NAN)                       \
13
    abort ();                                           \
14
                                                        \
15
  if (fpclassify (inf) != FP_INFINITE)                  \
16
    abort ();                                           \
17
                                                        \
18
  if (fpclassify (huge) != FP_INFINITE)                 \
19
    abort ();                                           \
20
                                                        \
21
  if (fpclassify (norm1) != FP_NORMAL)                  \
22
    abort ();                                           \
23
                                                        \
24
  if (fpclassify (norm2) != FP_NORMAL)                  \
25
    abort ();                                           \
26
                                                        \
27
  if (fpclassify (norm3) != FP_NORMAL)                  \
28
    abort ();                                           \
29
                                                        \
30
  if (fpclassify (sub) != FP_SUBNORMAL)                 \
31
    abort ();                                           \
32
                                                        \
33
  if (fpclassify (zero) != FP_ZERO)                     \
34
    abort ();                                           \
35
                                                        \
36
                                                        \
37
  if (!isnan (nan))                                     \
38
    abort ();                                           \
39
                                                        \
40
  if (isnan (inf))                                      \
41
    abort ();                                           \
42
                                                        \
43
  if (isnan (huge))                                     \
44
    abort ();                                           \
45
                                                        \
46
  if (isnan (norm1))                                    \
47
    abort ();                                           \
48
                                                        \
49
  if (isnan (norm2))                                    \
50
    abort ();                                           \
51
                                                        \
52
  if (isnan (norm3))                                    \
53
    abort ();                                           \
54
                                                        \
55
  if (isnan (sub))                                      \
56
    abort ();                                           \
57
                                                        \
58
  if (isnan (zero))                                     \
59
    abort ();                                           \
60
                                                        \
61
                                                        \
62
  if (isinf (nan))                                      \
63
    abort ();                                           \
64
                                                        \
65
  if (!isinf (inf))                                     \
66
    abort ();                                           \
67
                                                        \
68
  if (!isinf (huge))                                    \
69
    abort ();                                           \
70
                                                        \
71
  if (isinf (norm1))                                    \
72
    abort ();                                           \
73
                                                        \
74
  if (isinf (norm2))                                    \
75
    abort ();                                           \
76
                                                        \
77
  if (isinf (norm3))                                    \
78
    abort ();                                           \
79
                                                        \
80
  if (isinf (sub))                                      \
81
    abort ();                                           \
82
                                                        \
83
  if (isinf (zero))                                     \
84
    abort ();                                           \
85
                                                        \
86
                                                        \
87
  if (isfinite (nan))                                   \
88
    abort ();                                           \
89
                                                        \
90
  if (isfinite (inf))                                   \
91
    abort ();                                           \
92
                                                        \
93
  if (isfinite (huge))                                  \
94
    abort ();                                           \
95
                                                        \
96
  if (!isfinite (norm1))                                \
97
    abort ();                                           \
98
                                                        \
99
  if (!isfinite (norm2))                                \
100
    abort ();                                           \
101
                                                        \
102
  if (!isfinite (norm3))                                \
103
    abort ();                                           \
104
                                                        \
105
  if (!isfinite (sub))                                  \
106
    abort ();                                           \
107
                                                        \
108
  if (!isfinite (zero))                                 \
109
    abort ();                                           \
110
                                                        \
111
                                                        \
112
  if (isnormal (nan))                                   \
113
    abort ();                                           \
114
                                                        \
115
  if (isnormal (inf))                                   \
116
    abort ();                                           \
117
                                                        \
118
  if (isnormal (huge))                                  \
119
    abort ();                                           \
120
                                                        \
121
  if (!isnormal (norm1))                                \
122
    abort ();                                           \
123
                                                        \
124
  if (!isnormal (norm2))                                \
125
    abort ();                                           \
126
                                                        \
127
  if (!isnormal (norm3))                                \
128
    abort ();                                           \
129
                                                        \
130
  if (isnormal (sub))                                   \
131
    abort ();                                           \
132
                                                        \
133
  if (isnormal (zero))                                  \
134
    abort ();                                           \
135
                                                        \
136
                                                        \
137
  if (!!signbit (nan) != neg)                           \
138
    abort ();                                           \
139
                                                        \
140
  if (!!signbit (inf) != neg)                           \
141
    abort ();                                           \
142
                                                        \
143
  if (!!signbit (huge) != neg)                          \
144
    abort ();                                           \
145
                                                        \
146
  if (!!signbit (norm1) != neg)                         \
147
    abort ();                                           \
148
                                                        \
149
  if (!!signbit (norm2) != neg)                         \
150
    abort ();                                           \
151
                                                        \
152
  if (!!signbit (norm3) != neg)                         \
153
    abort ();                                           \
154
                                                        \
155
  if (!!signbit (sub) != neg)                           \
156
    abort ();                                           \
157
                                                        \
158
  if (!!signbit (zero) != neg)                          \
159
    abort ();                                           \
160
                                                        \
161
                                                        \
162
  if (neg)                                              \
163
  {                                                     \
164
    if (!isless ((inf), (norm1)))                       \
165
      abort ();                                         \
166
                                                        \
167
    if (!isless ((inf), (norm2)))                       \
168
      abort ();                                         \
169
                                                        \
170
    if (!isless ((inf), (norm3)))                       \
171
      abort ();                                         \
172
                                                        \
173
    if (!islessequal ((inf), (huge)))                   \
174
      abort ();                                         \
175
                                                        \
176
    if (!isgreater ((norm1), (inf)))                    \
177
      abort ();                                         \
178
                                                        \
179
    if (!isgreater ((norm2), (inf)))                    \
180
      abort ();                                         \
181
                                                        \
182
    if (!isgreater ((norm3), (inf)))                    \
183
      abort ();                                         \
184
                                                        \
185
    if (!isgreaterequal ((huge), (inf)))                \
186
      abort ();                                         \
187
  }                                                     \
188
  else                                                  \
189
  {                                                     \
190
    if (!isgreater ((inf), (norm1)))                    \
191
      abort ();                                         \
192
                                                        \
193
    if (!isgreater ((inf), (norm2)))                    \
194
      abort ();                                         \
195
                                                        \
196
    if (!isgreater ((inf), (norm3)))                    \
197
      abort ();                                         \
198
                                                        \
199
    if (!isgreaterequal ((inf), (huge)))                \
200
      abort ();                                         \
201
                                                        \
202
    if (!isless ((norm1), (inf)))                       \
203
      abort ();                                         \
204
                                                        \
205
    if (!isless ((norm2), (inf)))                       \
206
      abort ();                                         \
207
                                                        \
208
    if (!isless ((norm3), (inf)))                       \
209
      abort ();                                         \
210
                                                        \
211
    if (!islessequal ((huge), (inf)))                   \
212
      abort ();                                         \
213
  }                                                     \
214
                                                        \
215
  if (!islessgreater ((inf), (norm1)))                  \
216
    abort ();                                           \
217
                                                        \
218
  if (!islessgreater ((inf), (norm2)))                  \
219
    abort ();                                           \
220
                                                        \
221
  if (!islessgreater ((inf), (norm3)))                  \
222
    abort ();                                           \
223
                                                        \
224
  if (!isunordered ((nan), (norm1)))                    \
225
    abort ();                                           \
226
                                                        \
227
  if (!isunordered ((nan), (norm2)))                    \
228
    abort ();                                           \
229
                                                        \
230
  if (!isunordered ((nan), (norm3)))                    \
231
    abort ();                                           \
232
                                                        \
233
                                                        \
234
  if (fetestexcept (FE_ALL_EXCEPT) != 0)         \
235
    abort();                                            \
236
}

powered by: WebSVN 2.1.0

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