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-6.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 (floats) builtin functions */
5
#include <stdlib.h>
6
#include <stdio.h>
7
 
8
NOMIPS16 int test0 (float a, float b);
9
NOMIPS16 int test1 (float a, float b);
10
NOMIPS16 int test2 (float a, float b);
11
NOMIPS16 int test3 (float a, float b);
12
NOMIPS16 int test4 (float a, float b);
13
NOMIPS16 int test5 (float a, float b);
14
NOMIPS16 int test6 (float a, float b);
15
NOMIPS16 int test7 (float a, float b);
16
NOMIPS16 int test8 (float a, float b);
17
NOMIPS16 int test9 (float a, float b);
18
NOMIPS16 int test10 (float a, float b);
19
NOMIPS16 int test11 (float a, float b);
20
NOMIPS16 int test12 (float a, float b);
21
NOMIPS16 int test13 (float a, float b);
22
NOMIPS16 int test14 (float a, float b);
23
NOMIPS16 int test15 (float a, float b);
24
 
25
NOMIPS16 int main ()
26
{
27
  float a, b;
28
  int i;
29
 
30
  /* cabs.eq.s */
31
  a = 12;
32
  b = -56;
33
  i = 0;
34
  if (__builtin_mips_cabs_eq_s(a, b) != i)
35
     abort ();
36
 
37
  /* cabs.eq.s */
38
  a = 12;
39
  b = -12;
40
  i = 1;
41
  if (__builtin_mips_cabs_eq_s(a, b) != i)
42
     abort ();
43
 
44
  /* Test all comparisons */
45
  a = 10.58;
46
  b = 567.345;
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 != 0)
56
    abort ();
57
  i = test3 (a, b);
58
  if (i != 0)
59
    abort ();
60
  i = test4 (a, b);
61
  if (i != 1)
62
    abort ();
63
  i = test5 (a, b);
64
  if (i != 1)
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 != 0)
80
    abort ();
81
  i = test11 (a, b);
82
  if (i != 0)
83
    abort ();
84
  i = test12 (a, b);
85
  if (i != 1)
86
    abort ();
87
  i = test13 (a, b);
88
  if (i != 1)
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
  /* Reversed 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 != 0)
106
    abort ();
107
  i = test3 (b, a);
108
  if (i != 0)
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 != 0)
118
    abort ();
119
  i = test7 (b, a);
120
  if (i != 0)
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 != 0)
130
    abort ();
131
  i = test11 (b, a);
132
  if (i != 0)
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 != 0)
142
    abort ();
143
  i = test15 (b, a);
144
  if (i != 0)
145
    abort ();
146
 
147
#ifndef __FAST_MATH__
148
  /* Test all comparisons */
149
  a = 1.0f/0.0f - 1.0f/0.0f; // QNaN
150
  b = 567.345;
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 (float a, float b)
207
{
208
  return __builtin_mips_cabs_f_s (a, b);
209
}
210
 
211
NOMIPS16 int test1 (float a, float b)
212
{
213
  return __builtin_mips_cabs_un_s (a, b);
214
}
215
 
216
NOMIPS16 int test2 (float a, float b)
217
{
218
  return __builtin_mips_cabs_eq_s (a, b);
219
}
220
 
221
NOMIPS16 int test3 (float a, float b)
222
{
223
  return __builtin_mips_cabs_ueq_s (a, b);
224
}
225
 
226
NOMIPS16 int test4 (float a, float b)
227
{
228
  return __builtin_mips_cabs_olt_s (a, b);
229
}
230
 
231
NOMIPS16 int test5 (float a, float b)
232
{
233
  return __builtin_mips_cabs_ult_s (a, b);
234
}
235
 
236
NOMIPS16 int test6 (float a, float b)
237
{
238
  return __builtin_mips_cabs_ole_s (a, b);
239
}
240
 
241
NOMIPS16 int test7 (float a, float b)
242
{
243
  return __builtin_mips_cabs_ule_s (a, b);
244
}
245
 
246
NOMIPS16 int test8 (float a, float b)
247
{
248
  return __builtin_mips_cabs_sf_s (a, b);
249
}
250
 
251
NOMIPS16 int test9 (float a, float b)
252
{
253
  return __builtin_mips_cabs_ngle_s (a, b);
254
}
255
 
256
NOMIPS16 int test10 (float a, float b)
257
{
258
  return __builtin_mips_cabs_seq_s (a, b);
259
}
260
 
261
NOMIPS16 int test11 (float a, float b)
262
{
263
  return __builtin_mips_cabs_ngl_s (a, b);
264
}
265
 
266
NOMIPS16 int test12 (float a, float b)
267
{
268
  return __builtin_mips_cabs_lt_s (a, b);
269
}
270
 
271
NOMIPS16 int test13 (float a, float b)
272
{
273
  return __builtin_mips_cabs_nge_s (a, b);
274
}
275
 
276
NOMIPS16 int test14 (float a, float b)
277
{
278
  return __builtin_mips_cabs_le_s (a, b);
279
}
280
 
281
NOMIPS16 int test15 (float a, float b)
282
{
283
  return __builtin_mips_cabs_ngt_s (a, b);
284
}

powered by: WebSVN 2.1.0

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