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/] [mips/] [mips-3d-7.c] - Blame information for rev 321

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 321 jeremybenn
/* { dg-do run } */
2
/* { dg-options "-O2 -mips3d" } */
3
 
4
/* Test MIPS-3D absolute compare (doubles) builtin functions */
5
#include <stdlib.h>
6
#include <stdio.h>
7
 
8
NOMIPS16 int test0 (double a, double b);
9
NOMIPS16 int test1 (double a, double b);
10
NOMIPS16 int test2 (double a, double b);
11
NOMIPS16 int test3 (double a, double b);
12
NOMIPS16 int test4 (double a, double b);
13
NOMIPS16 int test5 (double a, double b);
14
NOMIPS16 int test6 (double a, double b);
15
NOMIPS16 int test7 (double a, double b);
16
NOMIPS16 int test8 (double a, double b);
17
NOMIPS16 int test9 (double a, double b);
18
NOMIPS16 int test10 (double a, double b);
19
NOMIPS16 int test11 (double a, double b);
20
NOMIPS16 int test12 (double a, double b);
21
NOMIPS16 int test13 (double a, double b);
22
NOMIPS16 int test14 (double a, double b);
23
NOMIPS16 int test15 (double a, double b);
24
 
25
NOMIPS16 int main ()
26
{
27
  double a, b;
28
  int i;
29
 
30
  /* cabs.eq.d */
31
  a = 12;
32
  b = -56;
33
  i = 0;
34
  if (__builtin_mips_cabs_eq_d(a, b) != i)
35
     abort ();
36
 
37
  /* cabs.eq.d */
38
  a = 12;
39
  b = -12;
40
  i = 1;
41
  if (__builtin_mips_cabs_eq_d(a, b) != i)
42
     abort ();
43
 
44
  /* Test all operators */
45
  a = 1984.0;
46
  b = 1984.0;
47
 
48
  i = test0 (a, b);
49
  if (i != 0)
50
    abort ();
51
  i = test1 (a, b);
52
  if (i != 0)
53
    abort ();
54
  i = test2 (a, b);
55
  if (i != 1)
56
    abort ();
57
  i = test3 (a, b);
58
  if (i != 1)
59
    abort ();
60
  i = test4 (a, b);
61
  if (i != 0)
62
    abort ();
63
  i = test5 (a, b);
64
  if (i != 0)
65
    abort ();
66
  i = test6 (a, b);
67
  if (i != 1)
68
    abort ();
69
  i = test7 (a, b);
70
  if (i != 1)
71
    abort ();
72
  i = test8 (a, b);
73
  if (i != 0)
74
    abort ();
75
  i = test9 (a, b);
76
  if (i != 0)
77
    abort ();
78
  i = test10 (a, b);
79
  if (i != 1)
80
    abort ();
81
  i = test11 (a, b);
82
  if (i != 1)
83
    abort ();
84
  i = test12 (a, b);
85
  if (i != 0)
86
    abort ();
87
  i = test13 (a, b);
88
  if (i != 0)
89
    abort ();
90
  i = test14 (a, b);
91
  if (i != 1)
92
    abort ();
93
  i = test15 (a, b);
94
  if (i != 1)
95
    abort ();
96
 
97
  /* Reverse arguments */
98
  i = test0 (b, a);
99
  if (i != 0)
100
    abort ();
101
  i = test1 (b, a);
102
  if (i != 0)
103
    abort ();
104
  i = test2 (b, a);
105
  if (i != 1)
106
    abort ();
107
  i = test3 (b, a);
108
  if (i != 1)
109
    abort ();
110
  i = test4 (b, a);
111
  if (i != 0)
112
    abort ();
113
  i = test5 (b, a);
114
  if (i != 0)
115
    abort ();
116
  i = test6 (b, a);
117
  if (i != 1)
118
    abort ();
119
  i = test7 (b, a);
120
  if (i != 1)
121
    abort ();
122
  i = test8 (b, a);
123
  if (i != 0)
124
    abort ();
125
  i = test9 (b, a);
126
  if (i != 0)
127
    abort ();
128
  i = test10 (b, a);
129
  if (i != 1)
130
    abort ();
131
  i = test11 (b, a);
132
  if (i != 1)
133
    abort ();
134
  i = test12 (b, a);
135
  if (i != 0)
136
    abort ();
137
  i = test13 (b, a);
138
  if (i != 0)
139
    abort ();
140
  i = test14 (b, a);
141
  if (i != 1)
142
    abort ();
143
  i = test15 (b, a);
144
  if (i != 1)
145
    abort ();
146
 
147
#ifndef __FAST_MATH__
148
  /* Test all operators */
149
  a = 1.0/0.0 - 1.0/0.0; // QNaN
150
  b = 1.0/0.0 - 1.0/0.0; // QNaN
151
 
152
  i = test0 (a, b);
153
  if (i != 0)
154
    abort ();
155
  i = test1 (a, b);
156
  if (i != 1)
157
    abort ();
158
  i = test2 (a, b);
159
  if (i != 0)
160
    abort ();
161
  i = test3 (a, b);
162
  if (i != 1)
163
    abort ();
164
  i = test4 (a, b);
165
  if (i != 0)
166
    abort ();
167
  i = test5 (a, b);
168
  if (i != 1)
169
    abort ();
170
  i = test6 (a, b);
171
  if (i != 0)
172
    abort ();
173
  i = test7 (a, b);
174
  if (i != 1)
175
    abort ();
176
  i = test8 (a, b);
177
  if (i != 0)
178
    abort ();
179
  i = test9 (a, b);
180
  if (i != 1)
181
    abort ();
182
  i = test10 (a, b);
183
  if (i != 0)
184
    abort ();
185
  i = test11 (a, b);
186
  if (i != 1)
187
    abort ();
188
  i = test12 (a, b);
189
  if (i != 0)
190
    abort ();
191
  i = test13 (a, b);
192
  if (i != 1)
193
    abort ();
194
  i = test14 (a, b);
195
  if (i != 0)
196
    abort ();
197
  i = test15 (a, b);
198
  if (i != 1)
199
    abort ();
200
#endif
201
 
202
  printf ("Test Passes\n");
203
  exit (0);
204
}
205
 
206
NOMIPS16 int test0 (double a, double b)
207
{
208
  return __builtin_mips_cabs_f_d (a, b);
209
}
210
 
211
NOMIPS16 int test1 (double a, double b)
212
{
213
  return __builtin_mips_cabs_un_d (a, b);
214
}
215
 
216
NOMIPS16 int test2 (double a, double b)
217
{
218
  return __builtin_mips_cabs_eq_d (a, b);
219
}
220
 
221
NOMIPS16 int test3 (double a, double b)
222
{
223
  return __builtin_mips_cabs_ueq_d (a, b);
224
}
225
 
226
NOMIPS16 int test4 (double a, double b)
227
{
228
  return __builtin_mips_cabs_olt_d (a, b);
229
}
230
 
231
NOMIPS16 int test5 (double a, double b)
232
{
233
  return __builtin_mips_cabs_ult_d (a, b);
234
}
235
 
236
NOMIPS16 int test6 (double a, double b)
237
{
238
  return __builtin_mips_cabs_ole_d (a, b);
239
}
240
 
241
NOMIPS16 int test7 (double a, double b)
242
{
243
  return __builtin_mips_cabs_ule_d (a, b);
244
}
245
 
246
NOMIPS16 int test8 (double a, double b)
247
{
248
  return __builtin_mips_cabs_sf_d (a, b);
249
}
250
 
251
NOMIPS16 int test9 (double a, double b)
252
{
253
  return __builtin_mips_cabs_ngle_d (a, b);
254
}
255
 
256
NOMIPS16 int test10 (double a, double b)
257
{
258
  return __builtin_mips_cabs_seq_d (a, b);
259
}
260
 
261
NOMIPS16 int test11 (double a, double b)
262
{
263
  return __builtin_mips_cabs_ngl_d (a, b);
264
}
265
 
266
NOMIPS16 int test12 (double a, double b)
267
{
268
  return __builtin_mips_cabs_lt_d (a, b);
269
}
270
 
271
NOMIPS16 int test13 (double a, double b)
272
{
273
  return __builtin_mips_cabs_nge_d (a, b);
274
}
275
 
276
NOMIPS16 int test14 (double a, double b)
277
{
278
  return __builtin_mips_cabs_le_d (a, b);
279
}
280
 
281
NOMIPS16 int test15 (double a, double b)
282
{
283
  return __builtin_mips_cabs_ngt_d (a, b);
284
}

powered by: WebSVN 2.1.0

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