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

Subversion Repositories scarts

[/] [scarts/] [trunk/] [toolchain/] [scarts-gcc/] [gcc-4.1.1/] [gcc/] [testsuite/] [gcc.target/] [mips/] [mips-3d-2.c] - Blame information for rev 12

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 12 jlechner
/* { dg-do run { target mipsisa64*-*-* } } */
2
/* { dg-mips-options "-mips64 -O2 -mips3d -mhard-float -mgp64" } */
3
 
4
/* Test MIPS-3D branch-if-any-two builtin functions */
5
#include <stdlib.h>
6
#include <stdio.h>
7
 
8
typedef float v2sf __attribute__ ((vector_size(8)));
9
 
10
int test0 (v2sf a, v2sf b);
11
int test1 (v2sf a, v2sf b);
12
int test2 (v2sf a, v2sf b);
13
int test3 (v2sf a, v2sf b);
14
int test4 (v2sf a, v2sf b);
15
int test5 (v2sf a, v2sf b);
16
int test6 (v2sf a, v2sf b);
17
int test7 (v2sf a, v2sf b);
18
int test8 (v2sf a, v2sf b);
19
int test9 (v2sf a, v2sf b);
20
int test10 (v2sf a, v2sf b);
21
int test11 (v2sf a, v2sf b);
22
int test12 (v2sf a, v2sf b);
23
int test13 (v2sf a, v2sf b);
24
int test14 (v2sf a, v2sf b);
25
int test15 (v2sf a, v2sf b);
26
int test16 (v2sf a, v2sf b);
27
int test17 (v2sf a, v2sf b);
28
int test18 (v2sf a, v2sf b);
29
int test19 (v2sf a, v2sf b);
30
int test20 (v2sf a, v2sf b);
31
int test21 (v2sf a, v2sf b);
32
int test22 (v2sf a, v2sf b);
33
int test23 (v2sf a, v2sf b);
34
int test24 (v2sf a, v2sf b);
35
int test25 (v2sf a, v2sf b);
36
int test26 (v2sf a, v2sf b);
37
int test27 (v2sf a, v2sf b);
38
int test28 (v2sf a, v2sf b);
39
int test29 (v2sf a, v2sf b);
40
int test30 (v2sf a, v2sf b);
41
int test31 (v2sf a, v2sf b);
42
 
43
float qnan = 1.0f/0.0f - 1.0f/0.0f;
44
 
45
int main ()
46
{
47
  v2sf a, b, c, d;
48
  int i, j;
49
 
50
  /* c.eq.ps */
51
  a = (v2sf) {12, 34};
52
  b = (v2sf) {56, 78};
53
  i = 0;
54
  j = 0;
55
  if (__builtin_mips_any_c_eq_ps(a, b) != i)
56
     abort ();
57
  if (__builtin_mips_all_c_eq_ps(a, b) != j)
58
     abort ();
59
 
60
  /* c.eq.ps */
61
  a = (v2sf) {12, 34};
62
  b = (v2sf) {12, 78};
63
  i = 1;
64
  j = 0;
65
  if (__builtin_mips_any_c_eq_ps(a, b) != i)
66
     abort ();
67
  if (__builtin_mips_all_c_eq_ps(a, b) != j)
68
     abort ();
69
 
70
  /* c.eq.ps */
71
  a = (v2sf) {12, 34};
72
  b = (v2sf) {56, 34};
73
  i = 1;
74
  j = 0;
75
  if (__builtin_mips_any_c_eq_ps(a, b) != i)
76
     abort ();
77
  if (__builtin_mips_all_c_eq_ps(a, b) != j)
78
     abort ();
79
 
80
  /* c.eq.ps */
81
  a = (v2sf) {12, 34};
82
  b = (v2sf) {12, 34};
83
  i = 1;
84
  j = 1;
85
  if (__builtin_mips_any_c_eq_ps(a, b) != i)
86
     abort ();
87
  if (__builtin_mips_all_c_eq_ps(a, b) != j)
88
     abort ();
89
 
90
  /* Test with 16 operators */
91
  a = (v2sf) {10.58, 1984.0};
92
  b = (v2sf) {567.345, 1984.0};
93
 
94
  i = test0 (a, b);
95
  if (i != 0)
96
    abort ();
97
  i = test1 (a, b);
98
  if (i != 0)
99
    abort ();
100
  i = test2 (a, b);
101
  if (i != 0)
102
    abort ();
103
  i = test3 (a, b);
104
  if (i != 0)
105
    abort ();
106
  i = test4 (a, b);
107
  if (i != 1)
108
    abort ();
109
  i = test5 (a, b);
110
  if (i != 0)
111
    abort ();
112
  i = test6 (a, b);
113
  if (i != 1)
114
    abort ();
115
  i = test7 (a, b);
116
  if (i != 0)
117
    abort ();
118
  i = test8 (a, b);
119
  if (i != 1)
120
    abort ();
121
  i = test9 (a, b);
122
  if (i != 0)
123
    abort ();
124
  i = test10 (a, b);
125
  if (i != 1)
126
    abort ();
127
  i = test11 (a, b);
128
  if (i != 0)
129
    abort ();
130
  i = test12 (a, b);
131
  if (i != 1)
132
    abort ();
133
  i = test13 (a, b);
134
  if (i != 1)
135
    abort ();
136
  i = test14 (a, b);
137
  if (i != 1)
138
    abort ();
139
  i = test15 (a, b);
140
  if (i != 1)
141
    abort ();
142
  i = test16 (a, b);
143
  if (i != 0)
144
    abort ();
145
  i = test17 (a, b);
146
  if (i != 0)
147
    abort ();
148
  i = test18 (a, b);
149
  if (i != 0)
150
    abort ();
151
  i = test19 (a, b);
152
  if (i != 0)
153
    abort ();
154
  i = test20 (a, b);
155
  if (i != 1)
156
    abort ();
157
  i = test21 (a, b);
158
  if (i != 0)
159
    abort ();
160
  i = test22 (a, b);
161
  if (i != 1)
162
    abort ();
163
  i = test23 (a, b);
164
  if (i != 0)
165
    abort ();
166
  i = test24 (a, b);
167
  if (i != 1)
168
    abort ();
169
  i = test25 (a, b);
170
  if (i != 0)
171
    abort ();
172
  i = test26 (a, b);
173
  if (i != 1)
174
    abort ();
175
  i = test27 (a, b);
176
  if (i != 0)
177
    abort ();
178
  i = test28 (a, b);
179
  if (i != 1)
180
    abort ();
181
  i = test29 (a, b);
182
  if (i != 1)
183
    abort ();
184
  i = test30 (a, b);
185
  if (i != 1)
186
    abort ();
187
  i = test31 (a, b);
188
  if (i != 1)
189
    abort ();
190
 
191
  /* Reverse arguments */
192
  i = test0 (b, a);
193
  if (i != 0)
194
    abort ();
195
  i = test1 (b, a);
196
  if (i != 0)
197
    abort ();
198
  i = test2 (b, a);
199
  if (i != 0)
200
    abort ();
201
  i = test3 (b, a);
202
  if (i != 0)
203
    abort ();
204
  i = test4 (b, a);
205
  if (i != 1)
206
    abort ();
207
  i = test5 (b, a);
208
  if (i != 0)
209
    abort ();
210
  i = test6 (b, a);
211
  if (i != 1)
212
    abort ();
213
  i = test7 (b, a);
214
  if (i != 0)
215
    abort ();
216
  i = test8 (b, a);
217
  if (i != 0)
218
    abort ();
219
  i = test9 (b, a);
220
  if (i != 0)
221
    abort ();
222
  i = test10 (b, a);
223
  if (i != 0)
224
    abort ();
225
  i = test11 (b, a);
226
  if (i != 0)
227
    abort ();
228
  i = test12 (b, a);
229
  if (i != 1)
230
    abort ();
231
  i = test13 (b, a);
232
  if (i != 0)
233
    abort ();
234
  i = test14 (b, a);
235
  if (i != 1)
236
    abort ();
237
  i = test15 (b, a);
238
  if (i != 0)
239
    abort ();
240
  i = test16 (b, a);
241
  if (i != 0)
242
    abort ();
243
  i = test17 (b, a);
244
  if (i != 0)
245
    abort ();
246
  i = test18 (b, a);
247
  if (i != 0)
248
    abort ();
249
  i = test19 (b, a);
250
  if (i != 0)
251
    abort ();
252
  i = test20 (b, a);
253
  if (i != 1)
254
    abort ();
255
  i = test21 (b, a);
256
  if (i != 0)
257
    abort ();
258
  i = test22 (b, a);
259
  if (i != 1)
260
    abort ();
261
  i = test23 (b, a);
262
  if (i != 0)
263
    abort ();
264
  i = test24 (b, a);
265
  if (i != 0)
266
    abort ();
267
  i = test25 (b, a);
268
  if (i != 0)
269
    abort ();
270
  i = test26 (b, a);
271
  if (i != 0)
272
    abort ();
273
  i = test27 (b, a);
274
  if (i != 0)
275
    abort ();
276
  i = test28 (b, a);
277
  if (i != 1)
278
    abort ();
279
  i = test29 (b, a);
280
  if (i != 0)
281
    abort ();
282
  i = test30 (b, a);
283
  if (i != 1)
284
    abort ();
285
  i = test31 (b, a);
286
  if (i != 0)
287
    abort ();
288
 
289
#ifndef __FAST_MATH__
290
  /* Test with 16 operators */
291
  a = (v2sf) {qnan, qnan};
292
  b = (v2sf) {567.345, 1984.0};
293
 
294
  i = test0 (a, b);
295
  if (i != 0)
296
    abort ();
297
  i = test1 (a, b);
298
  if (i != 0)
299
    abort ();
300
  i = test2 (a, b);
301
  if (i != 1)
302
    abort ();
303
  i = test3 (a, b);
304
  if (i != 1)
305
    abort ();
306
  i = test4 (a, b);
307
  if (i != 0)
308
    abort ();
309
  i = test5 (a, b);
310
  if (i != 0)
311
    abort ();
312
  i = test6 (a, b);
313
  if (i != 1)
314
    abort ();
315
  i = test7 (a, b);
316
  if (i != 1)
317
    abort ();
318
  i = test8 (a, b);
319
  if (i != 0)
320
    abort ();
321
  i = test9 (a, b);
322
  if (i != 0)
323
    abort ();
324
  i = test10 (a, b);
325
  if (i != 1)
326
    abort ();
327
  i = test11 (a, b);
328
  if (i != 1)
329
    abort ();
330
  i = test12 (a, b);
331
  if (i != 0)
332
    abort ();
333
  i = test13 (a, b);
334
  if (i != 0)
335
    abort ();
336
  i = test14 (a, b);
337
  if (i != 1)
338
    abort ();
339
  i = test15 (a, b);
340
  if (i != 1)
341
    abort ();
342
  i = test16 (a, b);
343
  if (i != 0)
344
    abort ();
345
  i = test17 (a, b);
346
  if (i != 0)
347
    abort ();
348
  i = test18 (a, b);
349
  if (i != 1)
350
    abort ();
351
  i = test19 (a, b);
352
  if (i != 1)
353
    abort ();
354
  i = test20 (a, b);
355
  if (i != 0)
356
    abort ();
357
  i = test21 (a, b);
358
  if (i != 0)
359
    abort ();
360
  i = test22 (a, b);
361
  if (i != 1)
362
    abort ();
363
  i = test23 (a, b);
364
  if (i != 1)
365
    abort ();
366
  i = test24 (a, b);
367
  if (i != 0)
368
    abort ();
369
  i = test25 (a, b);
370
  if (i != 0)
371
    abort ();
372
  i = test26 (a, b);
373
  if (i != 1)
374
    abort ();
375
  i = test27 (a, b);
376
  if (i != 1)
377
    abort ();
378
  i = test28 (a, b);
379
  if (i != 0)
380
    abort ();
381
  i = test29 (a, b);
382
  if (i != 0)
383
    abort ();
384
  i = test30 (a, b);
385
  if (i != 1)
386
    abort ();
387
  i = test31 (a, b);
388
  if (i != 1)
389
    abort ();
390
#endif
391
 
392
  printf ("Test Passes\n");
393
  exit (0);
394
}
395
 
396
int test0 (v2sf a, v2sf b)
397
{
398
  return __builtin_mips_any_c_f_ps (a, b);
399
}
400
 
401
int test1 (v2sf a, v2sf b)
402
{
403
  return __builtin_mips_all_c_f_ps (a, b);
404
}
405
 
406
int test2 (v2sf a, v2sf b)
407
{
408
  return __builtin_mips_any_c_un_ps (a, b);
409
}
410
 
411
int test3 (v2sf a, v2sf b)
412
{
413
  return __builtin_mips_all_c_un_ps (a, b);
414
}
415
 
416
int test4 (v2sf a, v2sf b)
417
{
418
  return __builtin_mips_any_c_eq_ps (a, b);
419
}
420
 
421
int test5 (v2sf a, v2sf b)
422
{
423
  return __builtin_mips_all_c_eq_ps (a, b);
424
}
425
 
426
int test6 (v2sf a, v2sf b)
427
{
428
  return __builtin_mips_any_c_ueq_ps (a, b);
429
}
430
 
431
int test7 (v2sf a, v2sf b)
432
{
433
  return __builtin_mips_all_c_ueq_ps (a, b);
434
}
435
 
436
int test8 (v2sf a, v2sf b)
437
{
438
  return __builtin_mips_any_c_olt_ps (a, b);
439
}
440
 
441
int test9 (v2sf a, v2sf b)
442
{
443
  return __builtin_mips_all_c_olt_ps (a, b);
444
}
445
 
446
int test10 (v2sf a, v2sf b)
447
{
448
  return __builtin_mips_any_c_ult_ps (a, b);
449
}
450
 
451
int test11 (v2sf a, v2sf b)
452
{
453
  return __builtin_mips_all_c_ult_ps (a, b);
454
}
455
 
456
int test12 (v2sf a, v2sf b)
457
{
458
  return __builtin_mips_any_c_ole_ps (a, b);
459
}
460
 
461
int test13 (v2sf a, v2sf b)
462
{
463
  return __builtin_mips_all_c_ole_ps (a, b);
464
}
465
 
466
int test14 (v2sf a, v2sf b)
467
{
468
  return __builtin_mips_any_c_ule_ps (a, b);
469
}
470
 
471
int test15 (v2sf a, v2sf b)
472
{
473
  return __builtin_mips_all_c_ule_ps (a, b);
474
}
475
 
476
int test16 (v2sf a, v2sf b)
477
{
478
  return __builtin_mips_any_c_sf_ps (a, b);
479
}
480
 
481
int test17 (v2sf a, v2sf b)
482
{
483
  return __builtin_mips_all_c_sf_ps (a, b);
484
}
485
 
486
int test18 (v2sf a, v2sf b)
487
{
488
  return __builtin_mips_any_c_ngle_ps (a, b);
489
}
490
 
491
int test19 (v2sf a, v2sf b)
492
{
493
  return __builtin_mips_all_c_ngle_ps (a, b);
494
}
495
 
496
int test20 (v2sf a, v2sf b)
497
{
498
  return __builtin_mips_any_c_seq_ps (a, b);
499
}
500
 
501
int test21 (v2sf a, v2sf b)
502
{
503
  return __builtin_mips_all_c_seq_ps (a, b);
504
}
505
 
506
int test22 (v2sf a, v2sf b)
507
{
508
  return __builtin_mips_any_c_ngl_ps (a, b);
509
}
510
 
511
int test23 (v2sf a, v2sf b)
512
{
513
  return __builtin_mips_all_c_ngl_ps (a, b);
514
}
515
 
516
int test24 (v2sf a, v2sf b)
517
{
518
  return __builtin_mips_any_c_lt_ps (a, b);
519
}
520
 
521
int test25 (v2sf a, v2sf b)
522
{
523
  return __builtin_mips_all_c_lt_ps (a, b);
524
}
525
 
526
int test26 (v2sf a, v2sf b)
527
{
528
  return __builtin_mips_any_c_nge_ps (a, b);
529
}
530
 
531
int test27 (v2sf a, v2sf b)
532
{
533
  return __builtin_mips_all_c_nge_ps (a, b);
534
}
535
 
536
int test28 (v2sf a, v2sf b)
537
{
538
  return __builtin_mips_any_c_le_ps (a, b);
539
}
540
 
541
int test29 (v2sf a, v2sf b)
542
{
543
  return __builtin_mips_all_c_le_ps (a, b);
544
}
545
 
546
int test30 (v2sf a, v2sf b)
547
{
548
  return __builtin_mips_any_c_ngt_ps (a, b);
549
}
550
 
551
int test31 (v2sf a, v2sf b)
552
{
553
  return __builtin_mips_all_c_ngt_ps (a, b);
554
}

powered by: WebSVN 2.1.0

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