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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [or1ksim/] [testsuite/] [test-code-or1k/] [testfloat/] [testFunction.c] - Blame information for rev 855

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

Line No. Rev Author Line
1 234 jeremybenn
 
2
/*
3
===============================================================================
4
 
5
This C source file is part of TestFloat, Release 2a, a package of programs
6
for testing the correctness of floating-point arithmetic complying to the
7
IEC/IEEE Standard for Floating-Point.
8
 
9
Written by John R. Hauser.  More information is available through the Web
10
page `http://HTTP.CS.Berkeley.EDU/~jhauser/arithmetic/TestFloat.html'.
11
 
12
THIS SOFTWARE IS DISTRIBUTED AS IS, FOR FREE.  Although reasonable effort
13
has been made to avoid it, THIS SOFTWARE MAY CONTAIN FAULTS THAT WILL AT
14
TIMES RESULT IN INCORRECT BEHAVIOR.  USE OF THIS SOFTWARE IS RESTRICTED TO
15
PERSONS AND ORGANIZATIONS WHO CAN AND WILL TAKE FULL RESPONSIBILITY FOR ANY
16
AND ALL LOSSES, COSTS, OR OTHER PROBLEMS ARISING FROM ITS USE.
17
 
18
Derivative works are acceptable, even for commercial purposes, so long as
19
(1) they include prominent notice that the work is derivative, and (2) they
20
include prominent notice akin to these four paragraphs for those parts of
21
this code that are retained.
22
 
23
Modified for use with or1ksim's testsuite.
24
 
25
Contributor Julius Baxter <julius.baxter@orsoc.se>
26
 
27
===============================================================================
28
*/
29
#include "support.h" // OR1k support C library
30
#include "milieu.h"
31
#include "softfloat.h"
32
#include "testCases.h"
33
#include "testLoops.h"
34
#include "systmodes.h"
35
#include "systflags.h"
36
#include "systfloat.h"
37
#include "testFunction.h"
38
 
39
const functionT functions[ NUM_FUNCTIONS ] = {
40
    { 0, 0, 0, 0 },
41
    { "int32_to_float32",                1, FALSE, TRUE  },
42
    { "int32_to_float64",                1, FALSE, FALSE },
43
    { "int32_to_floatx80",               1, FALSE, FALSE },
44
    { "int32_to_float128",               1, FALSE, FALSE },
45
    { "int64_to_float32",                1, FALSE, TRUE  },
46
    { "int64_to_float64",                1, FALSE, TRUE  },
47
    { "int64_to_floatx80",               1, FALSE, FALSE },
48
    { "int64_to_float128",               1, FALSE, FALSE },
49
    { "float32_to_int32",                1, FALSE, TRUE  },
50
    { "float32_to_int32_round_to_zero",  1, FALSE, FALSE },
51
    { "float32_to_int64",                1, FALSE, TRUE  },
52
    { "float32_to_int64_round_to_zero",  1, FALSE, FALSE },
53
    { "float32_to_float64",              1, FALSE, FALSE },
54
    { "float32_to_floatx80",             1, FALSE, FALSE },
55
    { "float32_to_float128",             1, FALSE, FALSE },
56
    { "float32_round_to_int",            1, FALSE, TRUE  },
57
    { "float32_add",                     2, FALSE, TRUE  },
58
    { "float32_sub",                     2, FALSE, TRUE  },
59
    { "float32_mul",                     2, FALSE, TRUE  },
60
    { "float32_div",                     2, FALSE, TRUE  },
61
    { "float32_rem",                     2, FALSE, FALSE },
62
    { "float32_sqrt",                    1, FALSE, TRUE  },
63
    { "float32_eq",                      2, FALSE, FALSE },
64
    { "float32_le",                      2, FALSE, FALSE },
65
    { "float32_lt",                      2, FALSE, FALSE },
66
    { "float32_eq_signaling",            2, FALSE, FALSE },
67
    { "float32_le_quiet",                2, FALSE, FALSE },
68
    { "float32_lt_quiet",                2, FALSE, FALSE },
69
    { "float64_to_int32",                1, FALSE, TRUE  },
70
    { "float64_to_int32_round_to_zero",  1, FALSE, FALSE },
71
    { "float64_to_int64",                1, FALSE, TRUE  },
72
    { "float64_to_int64_round_to_zero",  1, FALSE, FALSE },
73
    { "float64_to_float32",              1, FALSE, TRUE  },
74
    { "float64_to_floatx80",             1, FALSE, FALSE },
75
    { "float64_to_float128",             1, FALSE, FALSE },
76
    { "float64_round_to_int",            1, FALSE, TRUE  },
77
    { "float64_add",                     2, FALSE, TRUE  },
78
    { "float64_sub",                     2, FALSE, TRUE  },
79
    { "float64_mul",                     2, FALSE, TRUE  },
80
    { "float64_div",                     2, FALSE, TRUE  },
81
    { "float64_rem",                     2, FALSE, FALSE },
82
    { "float64_sqrt",                    1, FALSE, TRUE  },
83
    { "float64_eq",                      2, FALSE, FALSE },
84
    { "float64_le",                      2, FALSE, FALSE },
85
    { "float64_lt",                      2, FALSE, FALSE },
86
    { "float64_eq_signaling",            2, FALSE, FALSE },
87
    { "float64_le_quiet",                2, FALSE, FALSE },
88
    { "float64_lt_quiet",                2, FALSE, FALSE },
89
    { "floatx80_to_int32",               1, FALSE, TRUE  },
90
    { "floatx80_to_int32_round_to_zero", 1, FALSE, FALSE },
91
    { "floatx80_to_int64",               1, FALSE, TRUE  },
92
    { "floatx80_to_int64_round_to_zero", 1, FALSE, FALSE },
93
    { "floatx80_to_float32",             1, FALSE, TRUE  },
94
    { "floatx80_to_float64",             1, FALSE, TRUE  },
95
    { "floatx80_to_float128",            1, FALSE, FALSE },
96
    { "floatx80_round_to_int",           1, FALSE, TRUE  },
97
    { "floatx80_add",                    2, TRUE,  TRUE  },
98
    { "floatx80_sub",                    2, TRUE,  TRUE  },
99
    { "floatx80_mul",                    2, TRUE,  TRUE  },
100
    { "floatx80_div",                    2, TRUE,  TRUE  },
101
    { "floatx80_rem",                    2, FALSE, FALSE },
102
    { "floatx80_sqrt",                   1, TRUE,  TRUE  },
103
    { "floatx80_eq",                     2, FALSE, FALSE },
104
    { "floatx80_le",                     2, FALSE, FALSE },
105
    { "floatx80_lt",                     2, FALSE, FALSE },
106
    { "floatx80_eq_signaling",           2, FALSE, FALSE },
107
    { "floatx80_le_quiet",               2, FALSE, FALSE },
108
    { "floatx80_lt_quiet",               2, FALSE, FALSE },
109
    { "float128_to_int32",               1, FALSE, TRUE  },
110
    { "float128_to_int32_round_to_zero", 1, FALSE, FALSE },
111
    { "float128_to_int64",               1, FALSE, TRUE  },
112
    { "float128_to_int64_round_to_zero", 1, FALSE, FALSE },
113
    { "float128_to_float32",             1, FALSE, TRUE  },
114
    { "float128_to_float64",             1, FALSE, TRUE  },
115
    { "float128_to_floatx80",            1, FALSE, TRUE  },
116
    { "float128_round_to_int",           1, FALSE, TRUE  },
117
    { "float128_add",                    2, FALSE, TRUE  },
118
    { "float128_sub",                    2, FALSE, TRUE  },
119
    { "float128_mul",                    2, FALSE, TRUE  },
120
    { "float128_div",                    2, FALSE, TRUE  },
121
    { "float128_rem",                    2, FALSE, FALSE },
122
    { "float128_sqrt",                   1, FALSE, TRUE  },
123
    { "float128_eq",                     2, FALSE, FALSE },
124
    { "float128_le",                     2, FALSE, FALSE },
125
    { "float128_lt",                     2, FALSE, FALSE },
126
    { "float128_eq_signaling",           2, FALSE, FALSE },
127
    { "float128_le_quiet",               2, FALSE, FALSE },
128
    { "float128_lt_quiet",               2, FALSE, FALSE },
129
};
130
 
131
const flag functionExists[ NUM_FUNCTIONS ] = {
132
    0,
133
#ifdef SYST_INT32_TO_FLOAT32
134
    1,
135
#else
136
    0,
137
#endif
138
#ifdef SYST_INT32_TO_FLOAT64
139
    1,
140
#else
141
    0,
142
#endif
143
#ifdef SYST_INT32_TO_FLOATX80
144
    1,
145
#else
146
    0,
147
#endif
148
#ifdef SYST_INT32_TO_FLOAT128
149
    1,
150
#else
151
    0,
152
#endif
153
#ifdef SYST_INT64_TO_FLOAT32
154
    1,
155
#else
156
    0,
157
#endif
158
#ifdef SYST_INT64_TO_FLOAT64
159
    1,
160
#else
161
    0,
162
#endif
163
#ifdef SYST_INT64_TO_FLOATX80
164
    1,
165
#else
166
    0,
167
#endif
168
#ifdef SYST_INT64_TO_FLOAT128
169
    1,
170
#else
171
    0,
172
#endif
173
#ifdef SYST_FLOAT32_TO_INT32
174
    1,
175
#else
176
    0,
177
#endif
178
#ifdef SYST_FLOAT32_TO_INT32_ROUND_TO_ZERO
179
    1,
180
#else
181
    0,
182
#endif
183
#ifdef SYST_FLOAT32_TO_INT64
184
    1,
185
#else
186
    0,
187
#endif
188
#ifdef SYST_FLOAT32_TO_INT64_ROUND_TO_ZERO
189
    1,
190
#else
191
    0,
192
#endif
193
#ifdef SYST_FLOAT32_TO_FLOAT64
194
    1,
195
#else
196
    0,
197
#endif
198
#ifdef SYST_FLOAT32_TO_FLOATX80
199
    1,
200
#else
201
    0,
202
#endif
203
#ifdef SYST_FLOAT32_TO_FLOAT128
204
    1,
205
#else
206
    0,
207
#endif
208
#ifdef SYST_FLOAT32_ROUND_TO_INT
209
    1,
210
#else
211
    0,
212
#endif
213
#ifdef SYST_FLOAT32_ADD
214
    1,
215
#else
216
    0,
217
#endif
218
#ifdef SYST_FLOAT32_SUB
219
    1,
220
#else
221
    0,
222
#endif
223
#ifdef SYST_FLOAT32_MUL
224
    1,
225
#else
226
    0,
227
#endif
228
#ifdef SYST_FLOAT32_DIV
229
    1,
230
#else
231
    0,
232
#endif
233
#ifdef SYST_FLOAT32_REM
234
    1,
235
#else
236
    0,
237
#endif
238
#ifdef SYST_FLOAT32_SQRT
239
    1,
240
#else
241
    0,
242
#endif
243
#ifdef SYST_FLOAT32_EQ
244
    1,
245
#else
246
    0,
247
#endif
248
#ifdef SYST_FLOAT32_LE
249
    1,
250
#else
251
    0,
252
#endif
253
#ifdef SYST_FLOAT32_LT
254
    1,
255
#else
256
    0,
257
#endif
258
#ifdef SYST_FLOAT32_EQ_SIGNALING
259
    1,
260
#else
261
    0,
262
#endif
263
#ifdef SYST_FLOAT32_LE_QUIET
264
    1,
265
#else
266
    0,
267
#endif
268
#ifdef SYST_FLOAT32_LT_QUIET
269
    1,
270
#else
271
    0,
272
#endif
273
#ifdef SYST_FLOAT64_TO_INT32
274
    1,
275
#else
276
    0,
277
#endif
278
#ifdef SYST_FLOAT64_TO_INT32_ROUND_TO_ZERO
279
    1,
280
#else
281
    0,
282
#endif
283
#ifdef SYST_FLOAT64_TO_INT64
284
    1,
285
#else
286
    0,
287
#endif
288
#ifdef SYST_FLOAT64_TO_INT64_ROUND_TO_ZERO
289
    1,
290
#else
291
    0,
292
#endif
293
#ifdef SYST_FLOAT64_TO_FLOAT32
294
    1,
295
#else
296
    0,
297
#endif
298
#ifdef SYST_FLOAT64_TO_FLOATX80
299
    1,
300
#else
301
    0,
302
#endif
303
#ifdef SYST_FLOAT64_TO_FLOAT128
304
    1,
305
#else
306
    0,
307
#endif
308
#ifdef SYST_FLOAT64_ROUND_TO_INT
309
    1,
310
#else
311
    0,
312
#endif
313
#ifdef SYST_FLOAT64_ADD
314
    1,
315
#else
316
    0,
317
#endif
318
#ifdef SYST_FLOAT64_SUB
319
    1,
320
#else
321
    0,
322
#endif
323
#ifdef SYST_FLOAT64_MUL
324
    1,
325
#else
326
    0,
327
#endif
328
#ifdef SYST_FLOAT64_DIV
329
    1,
330
#else
331
    0,
332
#endif
333
#ifdef SYST_FLOAT64_REM
334
    1,
335
#else
336
    0,
337
#endif
338
#ifdef SYST_FLOAT64_SQRT
339
    1,
340
#else
341
    0,
342
#endif
343
#ifdef SYST_FLOAT64_EQ
344
    1,
345
#else
346
    0,
347
#endif
348
#ifdef SYST_FLOAT64_LE
349
    1,
350
#else
351
    0,
352
#endif
353
#ifdef SYST_FLOAT64_LT
354
    1,
355
#else
356
    0,
357
#endif
358
#ifdef SYST_FLOAT64_EQ_SIGNALING
359
    1,
360
#else
361
    0,
362
#endif
363
#ifdef SYST_FLOAT64_LE_QUIET
364
    1,
365
#else
366
    0,
367
#endif
368
#ifdef SYST_FLOAT64_LT_QUIET
369
    1,
370
#else
371
    0,
372
#endif
373
#ifdef SYST_FLOATX80_TO_INT32
374
    1,
375
#else
376
    0,
377
#endif
378
#ifdef SYST_FLOATX80_TO_INT32_ROUND_TO_ZERO
379
    1,
380
#else
381
    0,
382
#endif
383
#ifdef SYST_FLOATX80_TO_INT64
384
    1,
385
#else
386
    0,
387
#endif
388
#ifdef SYST_FLOATX80_TO_INT64_ROUND_TO_ZERO
389
    1,
390
#else
391
    0,
392
#endif
393
#ifdef SYST_FLOATX80_TO_FLOAT32
394
    1,
395
#else
396
    0,
397
#endif
398
#ifdef SYST_FLOATX80_TO_FLOAT64
399
    1,
400
#else
401
    0,
402
#endif
403
#ifdef SYST_FLOATX80_TO_FLOAT128
404
    1,
405
#else
406
    0,
407
#endif
408
#ifdef SYST_FLOATX80_ROUND_TO_INT
409
    1,
410
#else
411
    0,
412
#endif
413
#ifdef SYST_FLOATX80_ADD
414
    1,
415
#else
416
    0,
417
#endif
418
#ifdef SYST_FLOATX80_SUB
419
    1,
420
#else
421
    0,
422
#endif
423
#ifdef SYST_FLOATX80_MUL
424
    1,
425
#else
426
    0,
427
#endif
428
#ifdef SYST_FLOATX80_DIV
429
    1,
430
#else
431
    0,
432
#endif
433
#ifdef SYST_FLOATX80_REM
434
    1,
435
#else
436
    0,
437
#endif
438
#ifdef SYST_FLOATX80_SQRT
439
    1,
440
#else
441
    0,
442
#endif
443
#ifdef SYST_FLOATX80_EQ
444
    1,
445
#else
446
    0,
447
#endif
448
#ifdef SYST_FLOATX80_LE
449
    1,
450
#else
451
    0,
452
#endif
453
#ifdef SYST_FLOATX80_LT
454
    1,
455
#else
456
    0,
457
#endif
458
#ifdef SYST_FLOATX80_EQ_SIGNALING
459
    1,
460
#else
461
    0,
462
#endif
463
#ifdef SYST_FLOATX80_LE_QUIET
464
    1,
465
#else
466
    0,
467
#endif
468
#ifdef SYST_FLOATX80_LT_QUIET
469
    1,
470
#else
471
    0,
472
#endif
473
#ifdef SYST_FLOAT128_TO_INT32
474
    1,
475
#else
476
    0,
477
#endif
478
#ifdef SYST_FLOAT128_TO_INT32_ROUND_TO_ZERO
479
    1,
480
#else
481
    0,
482
#endif
483
#ifdef SYST_FLOAT128_TO_INT64
484
    1,
485
#else
486
    0,
487
#endif
488
#ifdef SYST_FLOAT128_TO_INT64_ROUND_TO_ZERO
489
    1,
490
#else
491
    0,
492
#endif
493
#ifdef SYST_FLOAT128_TO_FLOAT32
494
    1,
495
#else
496
    0,
497
#endif
498
#ifdef SYST_FLOAT128_TO_FLOAT64
499
    1,
500
#else
501
    0,
502
#endif
503
#ifdef SYST_FLOAT128_TO_FLOATX80
504
    1,
505
#else
506
    0,
507
#endif
508
#ifdef SYST_FLOAT128_ROUND_TO_INT
509
    1,
510
#else
511
    0,
512
#endif
513
#ifdef SYST_FLOAT128_ADD
514
    1,
515
#else
516
    0,
517
#endif
518
#ifdef SYST_FLOAT128_SUB
519
    1,
520
#else
521
    0,
522
#endif
523
#ifdef SYST_FLOAT128_MUL
524
    1,
525
#else
526
    0,
527
#endif
528
#ifdef SYST_FLOAT128_DIV
529
    1,
530
#else
531
    0,
532
#endif
533
#ifdef SYST_FLOAT128_REM
534
    1,
535
#else
536
    0,
537
#endif
538
#ifdef SYST_FLOAT128_SQRT
539
    1,
540
#else
541
    0,
542
#endif
543
#ifdef SYST_FLOAT128_EQ
544
    1,
545
#else
546
    0,
547
#endif
548
#ifdef SYST_FLOAT128_LE
549
    1,
550
#else
551
    0,
552
#endif
553
#ifdef SYST_FLOAT128_LT
554
    1,
555
#else
556
    0,
557
#endif
558
#ifdef SYST_FLOAT128_EQ_SIGNALING
559
    1,
560
#else
561
    0,
562
#endif
563
#ifdef SYST_FLOAT128_LE_QUIET
564
    1,
565
#else
566
    0,
567
#endif
568
#ifdef SYST_FLOAT128_LT_QUIET
569
    1,
570
#else
571
    0,
572
#endif
573
};
574
 
575
static void
576
 testFunctionVariety(
577
     uint8 functionCode, int8 roundingPrecision, int8 roundingMode )
578
{
579
    uint8 roundingCode;
580
 
581
    functionName = functions[ functionCode ].name;
582
#ifdef FLOATX80
583
    if ( roundingPrecision == 32 ) {
584
        roundingPrecisionName = "32";
585
    }
586
    else if ( roundingPrecision == 64 ) {
587
        roundingPrecisionName = "64";
588
    }
589
    else if ( roundingPrecision == 80 ) {
590
        roundingPrecisionName = "80";
591
    }
592
    else {
593
        roundingPrecision = 80;
594
        roundingPrecisionName = 0;
595
    }
596
    floatx80_rounding_precision = roundingPrecision;
597
    syst_float_set_rounding_precision( roundingPrecision );
598
#endif
599
    switch ( roundingMode ) {
600
     case ROUND_NEAREST_EVEN:
601
        roundingModeName = "nearest_even";
602
        roundingCode = float_round_nearest_even;
603
        break;
604
     case ROUND_TO_ZERO:
605
        roundingModeName = "to_zero";
606
        roundingCode = float_round_to_zero;
607
        break;
608
     case ROUND_DOWN:
609
        roundingModeName = "down";
610
        roundingCode = float_round_down;
611
        break;
612
     case ROUND_UP:
613
        roundingModeName = "up";
614
        roundingCode = float_round_up;
615
        break;
616
    default:
617
      roundingModeName = 0;
618
      roundingCode = float_round_nearest_even;
619
      break;
620
    }
621
    float_rounding_mode = roundingCode;
622
    syst_float_set_rounding_mode( roundingCode );
623
    printf( "Testing "/*, stderr*/ );
624
    writeFunctionName( /*stderr*/ );
625
    printf( ".\n" /*, stderr*/ );
626
    switch ( functionCode ) {
627
#ifdef SYST_INT32_TO_FLOAT32
628
     case INT32_TO_FLOAT32:
629
        test_a_int32_z_float32( int32_to_float32, syst_int32_to_float32 );
630
        break;
631
#endif
632
#ifdef SYST_INT32_TO_FLOAT64
633
     case INT32_TO_FLOAT64:
634
        test_a_int32_z_float64( int32_to_float64, syst_int32_to_float64 );
635
        break;
636
#endif
637
#ifdef SYST_INT32_TO_FLOATX80
638
     case INT32_TO_FLOATX80:
639
        test_a_int32_z_floatx80( int32_to_floatx80, syst_int32_to_floatx80 );
640
        break;
641
#endif
642
#ifdef SYST_INT32_TO_FLOAT128
643
     case INT32_TO_FLOAT128:
644
        test_a_int32_z_float128( int32_to_float128, syst_int32_to_float128 );
645
        break;
646
#endif
647
#ifdef SYST_INT64_TO_FLOAT32
648
     case INT64_TO_FLOAT32:
649
        test_a_int64_z_float32( int64_to_float32, syst_int64_to_float32 );
650
        break;
651
#endif
652
#ifdef SYST_INT64_TO_FLOAT64
653
     case INT64_TO_FLOAT64:
654
        test_a_int64_z_float64( int64_to_float64, syst_int64_to_float64 );
655
        break;
656
#endif
657
#ifdef SYST_INT64_TO_FLOATX80
658
     case INT64_TO_FLOATX80:
659
        test_a_int64_z_floatx80( int64_to_floatx80, syst_int64_to_floatx80 );
660
        break;
661
#endif
662
#ifdef SYST_INT64_TO_FLOAT128
663
     case INT64_TO_FLOAT128:
664
        test_a_int64_z_float128( int64_to_float128, syst_int64_to_float128 );
665
        break;
666
#endif
667
#ifdef SYST_FLOAT32_TO_INT32
668
     case FLOAT32_TO_INT32:
669
        test_a_float32_z_int32( float32_to_int32, syst_float32_to_int32 );
670
        break;
671
#endif
672
#ifdef SYST_FLOAT32_TO_INT32_ROUND_TO_ZERO
673
     case FLOAT32_TO_INT32_ROUND_TO_ZERO:
674
       syst_float_set_rounding_mode(float_round_to_zero);
675
        test_a_float32_z_int32(
676
            float32_to_int32_round_to_zero,
677
            syst_float32_to_int32_round_to_zero
678
        );
679
        break;
680
#endif
681
#ifdef SYST_FLOAT32_TO_INT64
682
     case FLOAT32_TO_INT64:
683
        test_a_float32_z_int64( float32_to_int64, syst_float32_to_int64 );
684
        break;
685
#endif
686
#ifdef SYST_FLOAT32_TO_INT64_ROUND_TO_ZERO
687
     case FLOAT32_TO_INT64_ROUND_TO_ZERO:
688
        test_a_float32_z_int64(
689
            float32_to_int64_round_to_zero,
690
            syst_float32_to_int64_round_to_zero
691
        );
692
        break;
693
#endif
694
#ifdef SYST_FLOAT32_TO_FLOAT64
695
     case FLOAT32_TO_FLOAT64:
696
        test_a_float32_z_float64(
697
            float32_to_float64, syst_float32_to_float64 );
698
        break;
699
#endif
700
#ifdef SYST_FLOAT32_TO_FLOATX80
701
     case FLOAT32_TO_FLOATX80:
702
        test_a_float32_z_floatx80(
703
            float32_to_floatx80, syst_float32_to_floatx80 );
704
        break;
705
#endif
706
#ifdef SYST_FLOAT32_TO_FLOAT128
707
     case FLOAT32_TO_FLOAT128:
708
        test_a_float32_z_float128(
709
            float32_to_float128, syst_float32_to_float128 );
710
        break;
711
#endif
712
#ifdef SYST_FLOAT32_ROUND_TO_INT
713
     case FLOAT32_ROUND_TO_INT:
714
        test_az_float32( float32_round_to_int, syst_float32_round_to_int );
715
        break;
716
#endif
717
#ifdef SYST_FLOAT32_ADD
718
     case FLOAT32_ADD:
719
        test_abz_float32( float32_add, syst_float32_add );
720
        break;
721
#endif
722
#ifdef SYST_FLOAT32_SUB
723
     case FLOAT32_SUB:
724
        test_abz_float32( float32_sub, syst_float32_sub );
725
        break;
726
#endif
727
#ifdef SYST_FLOAT32_MUL
728
     case FLOAT32_MUL:
729
        test_abz_float32( float32_mul, syst_float32_mul );
730
        break;
731
#endif
732
#ifdef SYST_FLOAT32_DIV
733
     case FLOAT32_DIV:
734
        test_abz_float32( float32_div, syst_float32_div );
735
        break;
736
#endif
737
#ifdef SYST_FLOAT32_REM
738
     case FLOAT32_REM:
739
        test_abz_float32( float32_rem, syst_float32_rem );
740
        break;
741
#endif
742
#ifdef SYST_FLOAT32_SQRT
743
     case FLOAT32_SQRT:
744
        test_az_float32( float32_sqrt, syst_float32_sqrt );
745
        break;
746
#endif
747
#ifdef SYST_FLOAT32_EQ
748
     case FLOAT32_EQ:
749
        test_ab_float32_z_flag( float32_eq, syst_float32_eq );
750
        break;
751
#endif
752
#ifdef SYST_FLOAT32_LE
753
     case FLOAT32_LE:
754
        test_ab_float32_z_flag( float32_le, syst_float32_le );
755
        break;
756
#endif
757
#ifdef SYST_FLOAT32_LT
758
     case FLOAT32_LT:
759
        test_ab_float32_z_flag( float32_lt, syst_float32_lt );
760
        break;
761
#endif
762
#ifdef SYST_FLOAT32_EQ_SIGNALING
763
     case FLOAT32_EQ_SIGNALING:
764
        test_ab_float32_z_flag(
765
            float32_eq_signaling, syst_float32_eq_signaling );
766
        break;
767
#endif
768
#ifdef SYST_FLOAT32_LE_QUIET
769
     case FLOAT32_LE_QUIET:
770
        test_ab_float32_z_flag( float32_le_quiet, syst_float32_le_quiet );
771
        break;
772
#endif
773
#ifdef SYST_FLOAT32_LT_QUIET
774
     case FLOAT32_LT_QUIET:
775
        test_ab_float32_z_flag( float32_lt_quiet, syst_float32_lt_quiet );
776
        break;
777
#endif
778
#ifdef SYST_FLOAT64_TO_INT32
779
     case FLOAT64_TO_INT32:
780
        test_a_float64_z_int32( float64_to_int32, syst_float64_to_int32 );
781
        break;
782
#endif
783
#ifdef SYST_FLOAT64_TO_INT32_ROUND_TO_ZERO
784
     case FLOAT64_TO_INT32_ROUND_TO_ZERO:
785
        test_a_float64_z_int32(
786
            float64_to_int32_round_to_zero,
787
            syst_float64_to_int32_round_to_zero
788
        );
789
        break;
790
#endif
791
#ifdef SYST_FLOAT64_TO_INT64
792
     case FLOAT64_TO_INT64:
793
        test_a_float64_z_int64( float64_to_int64, syst_float64_to_int64 );
794
        break;
795
#endif
796
#ifdef SYST_FLOAT64_TO_INT64_ROUND_TO_ZERO
797
     case FLOAT64_TO_INT64_ROUND_TO_ZERO:
798
        test_a_float64_z_int64(
799
            float64_to_int64_round_to_zero,
800
            syst_float64_to_int64_round_to_zero
801
        );
802
        break;
803
#endif
804
#ifdef SYST_FLOAT64_TO_FLOAT32
805
     case FLOAT64_TO_FLOAT32:
806
        test_a_float64_z_float32(
807
            float64_to_float32, syst_float64_to_float32 );
808
        break;
809
#endif
810
#ifdef SYST_FLOAT64_TO_FLOATX80
811
     case FLOAT64_TO_FLOATX80:
812
        test_a_float64_z_floatx80(
813
            float64_to_floatx80, syst_float64_to_floatx80 );
814
        break;
815
#endif
816
#ifdef SYST_FLOAT64_TO_FLOAT128
817
     case FLOAT64_TO_FLOAT128:
818
        test_a_float64_z_float128(
819
            float64_to_float128, syst_float64_to_float128 );
820
        break;
821
#endif
822
#ifdef SYST_FLOAT64_ROUND_TO_INT
823
     case FLOAT64_ROUND_TO_INT:
824
        test_az_float64( float64_round_to_int, syst_float64_round_to_int );
825
        break;
826
#endif
827
#ifdef SYST_FLOAT64_ADD
828
     case FLOAT64_ADD:
829
        test_abz_float64( float64_add, syst_float64_add );
830
        break;
831
#endif
832
#ifdef SYST_FLOAT64_SUB
833
     case FLOAT64_SUB:
834
        test_abz_float64( float64_sub, syst_float64_sub );
835
        break;
836
#endif
837
#ifdef SYST_FLOAT64_MUL
838
     case FLOAT64_MUL:
839
        test_abz_float64( float64_mul, syst_float64_mul );
840
        break;
841
#endif
842
#ifdef SYST_FLOAT64_DIV
843
     case FLOAT64_DIV:
844
        test_abz_float64( float64_div, syst_float64_div );
845
        break;
846
#endif
847
#ifdef SYST_FLOAT64_REM
848
     case FLOAT64_REM:
849
        test_abz_float64( float64_rem, syst_float64_rem );
850
        break;
851
#endif
852
#ifdef SYST_FLOAT64_SQRT
853
     case FLOAT64_SQRT:
854
        test_az_float64( float64_sqrt, syst_float64_sqrt );
855
        break;
856
#endif
857
#ifdef SYST_FLOAT64_EQ
858
     case FLOAT64_EQ:
859
        test_ab_float64_z_flag( float64_eq, syst_float64_eq );
860
        break;
861
#endif
862
#ifdef SYST_FLOAT64_LE
863
     case FLOAT64_LE:
864
        test_ab_float64_z_flag( float64_le, syst_float64_le );
865
        break;
866
#endif
867
#ifdef SYST_FLOAT64_LT
868
     case FLOAT64_LT:
869
        test_ab_float64_z_flag( float64_lt, syst_float64_lt );
870
        break;
871
#endif
872
#ifdef SYST_FLOAT64_EQ_SIGNALING
873
     case FLOAT64_EQ_SIGNALING:
874
        test_ab_float64_z_flag(
875
            float64_eq_signaling, syst_float64_eq_signaling );
876
        break;
877
#endif
878
#ifdef SYST_FLOAT64_LE_QUIET
879
     case FLOAT64_LE_QUIET:
880
        test_ab_float64_z_flag( float64_le_quiet, syst_float64_le_quiet );
881
        break;
882
#endif
883
#ifdef SYST_FLOAT64_LT_QUIET
884
     case FLOAT64_LT_QUIET:
885
        test_ab_float64_z_flag( float64_lt_quiet, syst_float64_lt_quiet );
886
        break;
887
#endif
888
#ifdef SYST_FLOATX80_TO_INT32
889
     case FLOATX80_TO_INT32:
890
        test_a_floatx80_z_int32( floatx80_to_int32, syst_floatx80_to_int32 );
891
        break;
892
#endif
893
#ifdef SYST_FLOATX80_TO_INT32_ROUND_TO_ZERO
894
     case FLOATX80_TO_INT32_ROUND_TO_ZERO:
895
        test_a_floatx80_z_int32(
896
            floatx80_to_int32_round_to_zero,
897
            syst_floatx80_to_int32_round_to_zero
898
        );
899
        break;
900
#endif
901
#ifdef SYST_FLOATX80_TO_INT64
902
     case FLOATX80_TO_INT64:
903
        test_a_floatx80_z_int64( floatx80_to_int64, syst_floatx80_to_int64 );
904
        break;
905
#endif
906
#ifdef SYST_FLOATX80_TO_INT64_ROUND_TO_ZERO
907
     case FLOATX80_TO_INT64_ROUND_TO_ZERO:
908
        test_a_floatx80_z_int64(
909
            floatx80_to_int64_round_to_zero,
910
            syst_floatx80_to_int64_round_to_zero
911
        );
912
        break;
913
#endif
914
#ifdef SYST_FLOATX80_TO_FLOAT32
915
     case FLOATX80_TO_FLOAT32:
916
        test_a_floatx80_z_float32(
917
            floatx80_to_float32, syst_floatx80_to_float32 );
918
        break;
919
#endif
920
#ifdef SYST_FLOATX80_TO_FLOAT64
921
     case FLOATX80_TO_FLOAT64:
922
        test_a_floatx80_z_float64(
923
            floatx80_to_float64, syst_floatx80_to_float64 );
924
        break;
925
#endif
926
#ifdef SYST_FLOATX80_TO_FLOAT128
927
     case FLOATX80_TO_FLOAT128:
928
        test_a_floatx80_z_float128(
929
            floatx80_to_float128, syst_floatx80_to_float128 );
930
        break;
931
#endif
932
#ifdef SYST_FLOATX80_ROUND_TO_INT
933
     case FLOATX80_ROUND_TO_INT:
934
        test_az_floatx80( floatx80_round_to_int, syst_floatx80_round_to_int );
935
        break;
936
#endif
937
#ifdef SYST_FLOATX80_ADD
938
     case FLOATX80_ADD:
939
        test_abz_floatx80( floatx80_add, syst_floatx80_add );
940
        break;
941
#endif
942
#ifdef SYST_FLOATX80_SUB
943
     case FLOATX80_SUB:
944
        test_abz_floatx80( floatx80_sub, syst_floatx80_sub );
945
        break;
946
#endif
947
#ifdef SYST_FLOATX80_MUL
948
     case FLOATX80_MUL:
949
        test_abz_floatx80( floatx80_mul, syst_floatx80_mul );
950
        break;
951
#endif
952
#ifdef SYST_FLOATX80_DIV
953
     case FLOATX80_DIV:
954
        test_abz_floatx80( floatx80_div, syst_floatx80_div );
955
        break;
956
#endif
957
#ifdef SYST_FLOATX80_REM
958
     case FLOATX80_REM:
959
        test_abz_floatx80( floatx80_rem, syst_floatx80_rem );
960
        break;
961
#endif
962
#ifdef SYST_FLOATX80_SQRT
963
     case FLOATX80_SQRT:
964
        test_az_floatx80( floatx80_sqrt, syst_floatx80_sqrt );
965
        break;
966
#endif
967
#ifdef SYST_FLOATX80_EQ
968
     case FLOATX80_EQ:
969
        test_ab_floatx80_z_flag( floatx80_eq, syst_floatx80_eq );
970
        break;
971
#endif
972
#ifdef SYST_FLOATX80_LE
973
     case FLOATX80_LE:
974
        test_ab_floatx80_z_flag( floatx80_le, syst_floatx80_le );
975
        break;
976
#endif
977
#ifdef SYST_FLOATX80_LT
978
     case FLOATX80_LT:
979
        test_ab_floatx80_z_flag( floatx80_lt, syst_floatx80_lt );
980
        break;
981
#endif
982
#ifdef SYST_FLOATX80_EQ_SIGNALING
983
     case FLOATX80_EQ_SIGNALING:
984
        test_ab_floatx80_z_flag(
985
            floatx80_eq_signaling, syst_floatx80_eq_signaling );
986
        break;
987
#endif
988
#ifdef SYST_FLOATX80_LE_QUIET
989
     case FLOATX80_LE_QUIET:
990
        test_ab_floatx80_z_flag( floatx80_le_quiet, syst_floatx80_le_quiet );
991
        break;
992
#endif
993
#ifdef SYST_FLOATX80_LT_QUIET
994
     case FLOATX80_LT_QUIET:
995
        test_ab_floatx80_z_flag( floatx80_lt_quiet, syst_floatx80_lt_quiet );
996
        break;
997
#endif
998
#ifdef SYST_FLOAT128_TO_INT32
999
     case FLOAT128_TO_INT32:
1000
        test_a_float128_z_int32( float128_to_int32, syst_float128_to_int32 );
1001
        break;
1002
#endif
1003
#ifdef SYST_FLOAT128_TO_INT32_ROUND_TO_ZERO
1004
     case FLOAT128_TO_INT32_ROUND_TO_ZERO:
1005
        test_a_float128_z_int32(
1006
            float128_to_int32_round_to_zero,
1007
            syst_float128_to_int32_round_to_zero
1008
        );
1009
        break;
1010
#endif
1011
#ifdef SYST_FLOAT128_TO_INT64
1012
     case FLOAT128_TO_INT64:
1013
        test_a_float128_z_int64( float128_to_int64, syst_float128_to_int64 );
1014
        break;
1015
#endif
1016
#ifdef SYST_FLOAT128_TO_INT64_ROUND_TO_ZERO
1017
     case FLOAT128_TO_INT64_ROUND_TO_ZERO:
1018
        test_a_float128_z_int64(
1019
            float128_to_int64_round_to_zero,
1020
            syst_float128_to_int64_round_to_zero
1021
        );
1022
        break;
1023
#endif
1024
#ifdef SYST_FLOAT128_TO_FLOAT32
1025
     case FLOAT128_TO_FLOAT32:
1026
        test_a_float128_z_float32(
1027
            float128_to_float32, syst_float128_to_float32 );
1028
        break;
1029
#endif
1030
#ifdef SYST_FLOAT128_TO_FLOAT64
1031
     case FLOAT128_TO_FLOAT64:
1032
        test_a_float128_z_float64(
1033
            float128_to_float64, syst_float128_to_float64 );
1034
        break;
1035
#endif
1036
#ifdef SYST_FLOAT128_TO_FLOATX80
1037
     case FLOAT128_TO_FLOATX80:
1038
        test_a_float128_z_floatx80(
1039
            float128_to_floatx80, syst_float128_to_floatx80 );
1040
        break;
1041
#endif
1042
#ifdef SYST_FLOAT128_ROUND_TO_INT
1043
     case FLOAT128_ROUND_TO_INT:
1044
        test_az_float128( float128_round_to_int, syst_float128_round_to_int );
1045
        break;
1046
#endif
1047
#ifdef SYST_FLOAT128_ADD
1048
     case FLOAT128_ADD:
1049
        test_abz_float128( float128_add, syst_float128_add );
1050
        break;
1051
#endif
1052
#ifdef SYST_FLOAT128_SUB
1053
     case FLOAT128_SUB:
1054
        test_abz_float128( float128_sub, syst_float128_sub );
1055
        break;
1056
#endif
1057
#ifdef SYST_FLOAT128_MUL
1058
     case FLOAT128_MUL:
1059
        test_abz_float128( float128_mul, syst_float128_mul );
1060
        break;
1061
#endif
1062
#ifdef SYST_FLOAT128_DIV
1063
     case FLOAT128_DIV:
1064
        test_abz_float128( float128_div, syst_float128_div );
1065
        break;
1066
#endif
1067
#ifdef SYST_FLOAT128_REM
1068
     case FLOAT128_REM:
1069
        test_abz_float128( float128_rem, syst_float128_rem );
1070
        break;
1071
#endif
1072
#ifdef SYST_FLOAT128_SQRT
1073
     case FLOAT128_SQRT:
1074
        test_az_float128( float128_sqrt, syst_float128_sqrt );
1075
        break;
1076
#endif
1077
#ifdef SYST_FLOAT128_EQ
1078
     case FLOAT128_EQ:
1079
        test_ab_float128_z_flag( float128_eq, syst_float128_eq );
1080
        break;
1081
#endif
1082
#ifdef SYST_FLOAT128_LE
1083
     case FLOAT128_LE:
1084
        test_ab_float128_z_flag( float128_le, syst_float128_le );
1085
        break;
1086
#endif
1087
#ifdef SYST_FLOAT128_LT
1088
     case FLOAT128_LT:
1089
        test_ab_float128_z_flag( float128_lt, syst_float128_lt );
1090
        break;
1091
#endif
1092
#ifdef SYST_FLOAT128_EQ_SIGNALING
1093
     case FLOAT128_EQ_SIGNALING:
1094
        test_ab_float128_z_flag(
1095
            float128_eq_signaling, syst_float128_eq_signaling );
1096
        break;
1097
#endif
1098
#ifdef SYST_FLOAT128_LE_QUIET
1099
     case FLOAT128_LE_QUIET:
1100
        test_ab_float128_z_flag( float128_le_quiet, syst_float128_le_quiet );
1101
        break;
1102
#endif
1103
#ifdef SYST_FLOAT128_LT_QUIET
1104
     case FLOAT128_LT_QUIET:
1105
        test_ab_float128_z_flag( float128_lt_quiet, syst_float128_lt_quiet );
1106
        break;
1107
#endif
1108
    }
1109
    if ( ( errorStop && anyErrors ) || stop ) exitWithStatus();
1110
 
1111
}
1112
 
1113
void
1114
testFunction(
1115
             uint8 functionCode, int8 roundingPrecisionIn, int8 roundingModeIn )
1116
{
1117
  int8 roundingPrecision, roundingMode;
1118
 
1119
  roundingPrecision = 32;
1120
  for (;;) {
1121
 
1122
    if ( ! functions[ functionCode ].roundingPrecision ) {
1123
      roundingPrecision = 0;
1124
    }
1125
    else if ( roundingPrecisionIn ) {
1126
      roundingPrecision = roundingPrecisionIn;
1127
    }
1128
 
1129
    for ( roundingMode = 1;
1130
          roundingMode < NUM_ROUNDINGMODES;
1131
          ++roundingMode
1132
          )
1133
      {
1134
        if ( ! functions[ functionCode ].roundingMode ) {
1135
          roundingMode = 0;
1136
        }
1137
        else if ( roundingModeIn ) {
1138
          roundingMode = roundingModeIn;
1139
        }
1140
        testFunctionVariety(
1141
                            functionCode, roundingPrecision, roundingMode );
1142
 
1143
        if ( roundingModeIn || ! roundingMode )
1144
          break;
1145
      }
1146
 
1147
    if ( roundingPrecisionIn || ! roundingPrecision )
1148
      break;
1149
 
1150
    if ( roundingPrecision == 80 ) {
1151
      break;
1152
    }
1153
    else if ( roundingPrecision == 64 ) {
1154
      roundingPrecision = 80;
1155
    }
1156
    else if ( roundingPrecision == 32 ) {
1157
      roundingPrecision = 64;
1158
    }
1159
  }
1160
}
1161
 

powered by: WebSVN 2.1.0

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