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