1 /* $NetBSD: testFunction.c,v 1.5 2008/04/01 19:20:43 drochner Exp $ */
3 /* This is a derivative work. */
6 * Copyright (c) 2001 The NetBSD Foundation, Inc.
9 * This code is derived from software contributed to The NetBSD Foundation
12 * Redistribution and use in source and binary forms, with or without
13 * modification, are permitted provided that the following conditions
15 * 1. Redistributions of source code must retain the above copyright
16 * notice, this list of conditions and the following disclaimer.
17 * 2. Redistributions in binary form must reproduce the above copyright
18 * notice, this list of conditions and the following disclaimer in the
19 * documentation and/or other materials provided with the distribution.
21 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
22 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
23 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
24 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
25 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31 * POSSIBILITY OF SUCH DAMAGE.
35 ===============================================================================
37 This C source file is part of TestFloat, Release 2a, a package of programs
38 for testing the correctness of floating-point arithmetic complying to the
39 IEC/IEEE Standard for Floating-Point.
41 Written by John R. Hauser. More information is available through the Web
42 page `http://HTTP.CS.Berkeley.EDU/~jhauser/arithmetic/TestFloat.html'.
44 THIS SOFTWARE IS DISTRIBUTED AS IS, FOR FREE. Although reasonable effort
45 has been made to avoid it, THIS SOFTWARE MAY CONTAIN FAULTS THAT WILL AT
46 TIMES RESULT IN INCORRECT BEHAVIOR. USE OF THIS SOFTWARE IS RESTRICTED TO
47 PERSONS AND ORGANIZATIONS WHO CAN AND WILL TAKE FULL RESPONSIBILITY FOR ANY
48 AND ALL LOSSES, COSTS, OR OTHER PROBLEMS ARISING FROM ITS USE.
50 Derivative works are acceptable, even for commercial purposes, so long as
51 (1) they include prominent notice that the work is derivative, and (2) they
52 include prominent notice akin to these four paragraphs for those parts of
53 this code that are retained.
55 ===============================================================================
59 #include "softfloat.h"
60 #include "testCases.h"
61 #include "testLoops.h"
62 #include "systmodes.h"
63 #include "systflags.h"
64 #include "systfloat.h"
65 #include "testFunction.h"
67 const functionT functions
[ NUM_FUNCTIONS
] = {
69 { "int32_to_float32", 1, FALSE
, TRUE
},
70 { "int32_to_float64", 1, FALSE
, FALSE
},
71 { "int32_to_floatx80", 1, FALSE
, FALSE
},
72 { "int32_to_float128", 1, FALSE
, FALSE
},
73 { "int64_to_float32", 1, FALSE
, TRUE
},
74 { "int64_to_float64", 1, FALSE
, TRUE
},
75 { "int64_to_floatx80", 1, FALSE
, FALSE
},
76 { "int64_to_float128", 1, FALSE
, FALSE
},
77 { "float32_to_int32", 1, FALSE
, TRUE
},
78 { "float32_to_int32_round_to_zero", 1, FALSE
, FALSE
},
79 { "float32_to_int64", 1, FALSE
, TRUE
},
80 { "float32_to_int64_round_to_zero", 1, FALSE
, FALSE
},
81 { "float32_to_float64", 1, FALSE
, FALSE
},
82 { "float32_to_floatx80", 1, FALSE
, FALSE
},
83 { "float32_to_float128", 1, FALSE
, FALSE
},
84 { "float32_round_to_int", 1, FALSE
, TRUE
},
85 { "float32_add", 2, FALSE
, TRUE
},
86 { "float32_sub", 2, FALSE
, TRUE
},
87 { "float32_mul", 2, FALSE
, TRUE
},
88 { "float32_div", 2, FALSE
, TRUE
},
89 { "float32_rem", 2, FALSE
, FALSE
},
90 { "float32_sqrt", 1, FALSE
, TRUE
},
91 { "float32_eq", 2, FALSE
, FALSE
},
92 { "float32_le", 2, FALSE
, FALSE
},
93 { "float32_lt", 2, FALSE
, FALSE
},
94 { "float32_eq_signaling", 2, FALSE
, FALSE
},
95 { "float32_le_quiet", 2, FALSE
, FALSE
},
96 { "float32_lt_quiet", 2, FALSE
, FALSE
},
97 { "float64_to_int32", 1, FALSE
, TRUE
},
98 { "float64_to_int32_round_to_zero", 1, FALSE
, FALSE
},
99 { "float64_to_int64", 1, FALSE
, TRUE
},
100 { "float64_to_int64_round_to_zero", 1, FALSE
, FALSE
},
101 { "float64_to_float32", 1, FALSE
, TRUE
},
102 { "float64_to_floatx80", 1, FALSE
, FALSE
},
103 { "float64_to_float128", 1, FALSE
, FALSE
},
104 { "float64_round_to_int", 1, FALSE
, TRUE
},
105 { "float64_add", 2, FALSE
, TRUE
},
106 { "float64_sub", 2, FALSE
, TRUE
},
107 { "float64_mul", 2, FALSE
, TRUE
},
108 { "float64_div", 2, FALSE
, TRUE
},
109 { "float64_rem", 2, FALSE
, FALSE
},
110 { "float64_sqrt", 1, FALSE
, TRUE
},
111 { "float64_eq", 2, FALSE
, FALSE
},
112 { "float64_le", 2, FALSE
, FALSE
},
113 { "float64_lt", 2, FALSE
, FALSE
},
114 { "float64_eq_signaling", 2, FALSE
, FALSE
},
115 { "float64_le_quiet", 2, FALSE
, FALSE
},
116 { "float64_lt_quiet", 2, FALSE
, FALSE
},
117 { "floatx80_to_int32", 1, FALSE
, TRUE
},
118 { "floatx80_to_int32_round_to_zero", 1, FALSE
, FALSE
},
119 { "floatx80_to_int64", 1, FALSE
, TRUE
},
120 { "floatx80_to_int64_round_to_zero", 1, FALSE
, FALSE
},
121 { "floatx80_to_float32", 1, FALSE
, TRUE
},
122 { "floatx80_to_float64", 1, FALSE
, TRUE
},
123 { "floatx80_to_float128", 1, FALSE
, FALSE
},
124 { "floatx80_round_to_int", 1, FALSE
, TRUE
},
125 { "floatx80_add", 2, TRUE
, TRUE
},
126 { "floatx80_sub", 2, TRUE
, TRUE
},
127 { "floatx80_mul", 2, TRUE
, TRUE
},
128 { "floatx80_div", 2, TRUE
, TRUE
},
129 { "floatx80_rem", 2, FALSE
, FALSE
},
130 { "floatx80_sqrt", 1, TRUE
, TRUE
},
131 { "floatx80_eq", 2, FALSE
, FALSE
},
132 { "floatx80_le", 2, FALSE
, FALSE
},
133 { "floatx80_lt", 2, FALSE
, FALSE
},
134 { "floatx80_eq_signaling", 2, FALSE
, FALSE
},
135 { "floatx80_le_quiet", 2, FALSE
, FALSE
},
136 { "floatx80_lt_quiet", 2, FALSE
, FALSE
},
137 { "float128_to_int32", 1, FALSE
, TRUE
},
138 { "float128_to_int32_round_to_zero", 1, FALSE
, FALSE
},
139 { "float128_to_int64", 1, FALSE
, TRUE
},
140 { "float128_to_int64_round_to_zero", 1, FALSE
, FALSE
},
141 { "float128_to_float32", 1, FALSE
, TRUE
},
142 { "float128_to_float64", 1, FALSE
, TRUE
},
143 { "float128_to_floatx80", 1, FALSE
, TRUE
},
144 { "float128_round_to_int", 1, FALSE
, TRUE
},
145 { "float128_add", 2, FALSE
, TRUE
},
146 { "float128_sub", 2, FALSE
, TRUE
},
147 { "float128_mul", 2, FALSE
, TRUE
},
148 { "float128_div", 2, FALSE
, TRUE
},
149 { "float128_rem", 2, FALSE
, FALSE
},
150 { "float128_sqrt", 1, FALSE
, TRUE
},
151 { "float128_eq", 2, FALSE
, FALSE
},
152 { "float128_le", 2, FALSE
, FALSE
},
153 { "float128_lt", 2, FALSE
, FALSE
},
154 { "float128_eq_signaling", 2, FALSE
, FALSE
},
155 { "float128_le_quiet", 2, FALSE
, FALSE
},
156 { "float128_lt_quiet", 2, FALSE
, FALSE
},
159 const flag functionExists
[ NUM_FUNCTIONS
] = {
161 #ifdef SYST_INT32_TO_FLOAT32
166 #ifdef SYST_INT32_TO_FLOAT64
171 #ifdef SYST_INT32_TO_FLOATX80
176 #ifdef SYST_INT32_TO_FLOAT128
181 #ifdef SYST_INT64_TO_FLOAT32
186 #ifdef SYST_INT64_TO_FLOAT64
191 #ifdef SYST_INT64_TO_FLOATX80
196 #ifdef SYST_INT64_TO_FLOAT128
201 #ifdef SYST_FLOAT32_TO_INT32
206 #ifdef SYST_FLOAT32_TO_INT32_ROUND_TO_ZERO
211 #ifdef SYST_FLOAT32_TO_INT64
216 #ifdef SYST_FLOAT32_TO_INT64_ROUND_TO_ZERO
221 #ifdef SYST_FLOAT32_TO_FLOAT64
226 #ifdef SYST_FLOAT32_TO_FLOATX80
231 #ifdef SYST_FLOAT32_TO_FLOAT128
236 #ifdef SYST_FLOAT32_ROUND_TO_INT
241 #ifdef SYST_FLOAT32_ADD
246 #ifdef SYST_FLOAT32_SUB
251 #ifdef SYST_FLOAT32_MUL
256 #ifdef SYST_FLOAT32_DIV
261 #ifdef SYST_FLOAT32_REM
266 #ifdef SYST_FLOAT32_SQRT
271 #ifdef SYST_FLOAT32_EQ
276 #ifdef SYST_FLOAT32_LE
281 #ifdef SYST_FLOAT32_LT
286 #ifdef SYST_FLOAT32_EQ_SIGNALING
291 #ifdef SYST_FLOAT32_LE_QUIET
296 #ifdef SYST_FLOAT32_LT_QUIET
301 #ifdef SYST_FLOAT64_TO_INT32
306 #ifdef SYST_FLOAT64_TO_INT32_ROUND_TO_ZERO
311 #ifdef SYST_FLOAT64_TO_INT64
316 #ifdef SYST_FLOAT64_TO_INT64_ROUND_TO_ZERO
321 #ifdef SYST_FLOAT64_TO_FLOAT32
326 #ifdef SYST_FLOAT64_TO_FLOATX80
331 #ifdef SYST_FLOAT64_TO_FLOAT128
336 #ifdef SYST_FLOAT64_ROUND_TO_INT
341 #ifdef SYST_FLOAT64_ADD
346 #ifdef SYST_FLOAT64_SUB
351 #ifdef SYST_FLOAT64_MUL
356 #ifdef SYST_FLOAT64_DIV
361 #ifdef SYST_FLOAT64_REM
366 #ifdef SYST_FLOAT64_SQRT
371 #ifdef SYST_FLOAT64_EQ
376 #ifdef SYST_FLOAT64_LE
381 #ifdef SYST_FLOAT64_LT
386 #ifdef SYST_FLOAT64_EQ_SIGNALING
391 #ifdef SYST_FLOAT64_LE_QUIET
396 #ifdef SYST_FLOAT64_LT_QUIET
401 #ifdef SYST_FLOATX80_TO_INT32
406 #ifdef SYST_FLOATX80_TO_INT32_ROUND_TO_ZERO
411 #ifdef SYST_FLOATX80_TO_INT64
416 #ifdef SYST_FLOATX80_TO_INT64_ROUND_TO_ZERO
421 #ifdef SYST_FLOATX80_TO_FLOAT32
426 #ifdef SYST_FLOATX80_TO_FLOAT64
431 #ifdef SYST_FLOATX80_TO_FLOAT128
436 #ifdef SYST_FLOATX80_ROUND_TO_INT
441 #ifdef SYST_FLOATX80_ADD
446 #ifdef SYST_FLOATX80_SUB
451 #ifdef SYST_FLOATX80_MUL
456 #ifdef SYST_FLOATX80_DIV
461 #ifdef SYST_FLOATX80_REM
466 #ifdef SYST_FLOATX80_SQRT
471 #ifdef SYST_FLOATX80_EQ
476 #ifdef SYST_FLOATX80_LE
481 #ifdef SYST_FLOATX80_LT
486 #ifdef SYST_FLOATX80_EQ_SIGNALING
491 #ifdef SYST_FLOATX80_LE_QUIET
496 #ifdef SYST_FLOATX80_LT_QUIET
501 #ifdef SYST_FLOAT128_TO_INT32
506 #ifdef SYST_FLOAT128_TO_INT32_ROUND_TO_ZERO
511 #ifdef SYST_FLOAT128_TO_INT64
516 #ifdef SYST_FLOAT128_TO_INT64_ROUND_TO_ZERO
521 #ifdef SYST_FLOAT128_TO_FLOAT32
526 #ifdef SYST_FLOAT128_TO_FLOAT64
531 #ifdef SYST_FLOAT128_TO_FLOATX80
536 #ifdef SYST_FLOAT128_ROUND_TO_INT
541 #ifdef SYST_FLOAT128_ADD
546 #ifdef SYST_FLOAT128_SUB
551 #ifdef SYST_FLOAT128_MUL
556 #ifdef SYST_FLOAT128_DIV
561 #ifdef SYST_FLOAT128_REM
566 #ifdef SYST_FLOAT128_SQRT
571 #ifdef SYST_FLOAT128_EQ
576 #ifdef SYST_FLOAT128_LE
581 #ifdef SYST_FLOAT128_LT
586 #ifdef SYST_FLOAT128_EQ_SIGNALING
591 #ifdef SYST_FLOAT128_LE_QUIET
596 #ifdef SYST_FLOAT128_LT_QUIET
605 uint8 functionCode
, int8 roundingPrecision
, int8 roundingMode
)
609 functionName
= functions
[ functionCode
].name
;
611 if ( roundingPrecision
== 32 ) {
612 roundingPrecisionName
= "32";
614 else if ( roundingPrecision
== 64 ) {
615 roundingPrecisionName
= "64";
617 else if ( roundingPrecision
== 80 ) {
618 roundingPrecisionName
= "80";
621 roundingPrecision
= 80;
622 roundingPrecisionName
= 0;
624 floatx80_rounding_precision
= roundingPrecision
;
625 syst_float_set_rounding_precision( roundingPrecision
);
627 switch ( roundingMode
) {
629 roundingModeName
= 0;
630 roundingCode
= float_round_nearest_even
;
632 case ROUND_NEAREST_EVEN
:
633 roundingModeName
= "nearest_even";
634 roundingCode
= float_round_nearest_even
;
637 roundingModeName
= "to_zero";
638 roundingCode
= float_round_to_zero
;
641 roundingModeName
= "down";
642 roundingCode
= float_round_down
;
645 roundingModeName
= "up";
646 roundingCode
= float_round_up
;
651 float_rounding_mode
= roundingCode
;
652 syst_float_set_rounding_mode( roundingCode
);
653 fputs( "Testing ", stderr
);
654 writeFunctionName( stderr
);
655 fputs( ".\n", stderr
);
656 switch ( functionCode
) {
657 #ifdef SYST_INT32_TO_FLOAT32
658 case INT32_TO_FLOAT32
:
659 test_a_int32_z_float32( int32_to_float32
, syst_int32_to_float32
);
662 #ifdef SYST_INT32_TO_FLOAT64
663 case INT32_TO_FLOAT64
:
664 test_a_int32_z_float64( int32_to_float64
, syst_int32_to_float64
);
667 #ifdef SYST_INT32_TO_FLOATX80
668 case INT32_TO_FLOATX80
:
669 test_a_int32_z_floatx80( int32_to_floatx80
, syst_int32_to_floatx80
);
672 #ifdef SYST_INT32_TO_FLOAT128
673 case INT32_TO_FLOAT128
:
674 test_a_int32_z_float128( int32_to_float128
, syst_int32_to_float128
);
677 #ifdef SYST_INT64_TO_FLOAT32
678 case INT64_TO_FLOAT32
:
679 test_a_int64_z_float32( int64_to_float32
, syst_int64_to_float32
);
682 #ifdef SYST_INT64_TO_FLOAT64
683 case INT64_TO_FLOAT64
:
684 test_a_int64_z_float64( int64_to_float64
, syst_int64_to_float64
);
687 #ifdef SYST_INT64_TO_FLOATX80
688 case INT64_TO_FLOATX80
:
689 test_a_int64_z_floatx80( int64_to_floatx80
, syst_int64_to_floatx80
);
692 #ifdef SYST_INT64_TO_FLOAT128
693 case INT64_TO_FLOAT128
:
694 test_a_int64_z_float128( int64_to_float128
, syst_int64_to_float128
);
697 #ifdef SYST_FLOAT32_TO_INT32
698 case FLOAT32_TO_INT32
:
699 test_a_float32_z_int32( float32_to_int32
, syst_float32_to_int32
);
702 #ifdef SYST_FLOAT32_TO_INT32_ROUND_TO_ZERO
703 case FLOAT32_TO_INT32_ROUND_TO_ZERO
:
704 test_a_float32_z_int32(
705 float32_to_int32_round_to_zero
,
706 syst_float32_to_int32_round_to_zero
710 #ifdef SYST_FLOAT32_TO_INT64
711 case FLOAT32_TO_INT64
:
712 test_a_float32_z_int64( float32_to_int64
, syst_float32_to_int64
);
715 #ifdef SYST_FLOAT32_TO_INT64_ROUND_TO_ZERO
716 case FLOAT32_TO_INT64_ROUND_TO_ZERO
:
717 test_a_float32_z_int64(
718 float32_to_int64_round_to_zero
,
719 syst_float32_to_int64_round_to_zero
723 #ifdef SYST_FLOAT32_TO_FLOAT64
724 case FLOAT32_TO_FLOAT64
:
725 test_a_float32_z_float64(
726 float32_to_float64
, syst_float32_to_float64
);
729 #ifdef SYST_FLOAT32_TO_FLOATX80
730 case FLOAT32_TO_FLOATX80
:
731 test_a_float32_z_floatx80(
732 float32_to_floatx80
, syst_float32_to_floatx80
);
735 #ifdef SYST_FLOAT32_TO_FLOAT128
736 case FLOAT32_TO_FLOAT128
:
737 test_a_float32_z_float128(
738 float32_to_float128
, syst_float32_to_float128
);
741 #ifdef SYST_FLOAT32_ROUND_TO_INT
742 case FLOAT32_ROUND_TO_INT
:
743 test_az_float32( float32_round_to_int
, syst_float32_round_to_int
);
746 #ifdef SYST_FLOAT32_ADD
748 test_abz_float32( float32_add
, syst_float32_add
);
751 #ifdef SYST_FLOAT32_SUB
753 test_abz_float32( float32_sub
, syst_float32_sub
);
756 #ifdef SYST_FLOAT32_MUL
758 test_abz_float32( float32_mul
, syst_float32_mul
);
761 #ifdef SYST_FLOAT32_DIV
763 test_abz_float32( float32_div
, syst_float32_div
);
766 #ifdef SYST_FLOAT32_REM
768 test_abz_float32( float32_rem
, syst_float32_rem
);
771 #ifdef SYST_FLOAT32_SQRT
773 test_az_float32( float32_sqrt
, syst_float32_sqrt
);
776 #ifdef SYST_FLOAT32_EQ
778 test_ab_float32_z_flag( float32_eq
, syst_float32_eq
);
781 #ifdef SYST_FLOAT32_LE
783 test_ab_float32_z_flag( float32_le
, syst_float32_le
);
786 #ifdef SYST_FLOAT32_LT
788 test_ab_float32_z_flag( float32_lt
, syst_float32_lt
);
791 #ifdef SYST_FLOAT32_EQ_SIGNALING
792 case FLOAT32_EQ_SIGNALING
:
793 test_ab_float32_z_flag(
794 float32_eq_signaling
, syst_float32_eq_signaling
);
797 #ifdef SYST_FLOAT32_LE_QUIET
798 case FLOAT32_LE_QUIET
:
799 test_ab_float32_z_flag( float32_le_quiet
, syst_float32_le_quiet
);
802 #ifdef SYST_FLOAT32_LT_QUIET
803 case FLOAT32_LT_QUIET
:
804 test_ab_float32_z_flag( float32_lt_quiet
, syst_float32_lt_quiet
);
807 #ifdef SYST_FLOAT64_TO_INT32
808 case FLOAT64_TO_INT32
:
809 test_a_float64_z_int32( float64_to_int32
, syst_float64_to_int32
);
812 #ifdef SYST_FLOAT64_TO_INT32_ROUND_TO_ZERO
813 case FLOAT64_TO_INT32_ROUND_TO_ZERO
:
814 test_a_float64_z_int32(
815 float64_to_int32_round_to_zero
,
816 syst_float64_to_int32_round_to_zero
820 #ifdef SYST_FLOAT64_TO_INT64
821 case FLOAT64_TO_INT64
:
822 test_a_float64_z_int64( float64_to_int64
, syst_float64_to_int64
);
825 #ifdef SYST_FLOAT64_TO_INT64_ROUND_TO_ZERO
826 case FLOAT64_TO_INT64_ROUND_TO_ZERO
:
827 test_a_float64_z_int64(
828 float64_to_int64_round_to_zero
,
829 syst_float64_to_int64_round_to_zero
833 #ifdef SYST_FLOAT64_TO_FLOAT32
834 case FLOAT64_TO_FLOAT32
:
835 test_a_float64_z_float32(
836 float64_to_float32
, syst_float64_to_float32
);
839 #ifdef SYST_FLOAT64_TO_FLOATX80
840 case FLOAT64_TO_FLOATX80
:
841 test_a_float64_z_floatx80(
842 float64_to_floatx80
, syst_float64_to_floatx80
);
845 #ifdef SYST_FLOAT64_TO_FLOAT128
846 case FLOAT64_TO_FLOAT128
:
847 test_a_float64_z_float128(
848 float64_to_float128
, syst_float64_to_float128
);
851 #ifdef SYST_FLOAT64_ROUND_TO_INT
852 case FLOAT64_ROUND_TO_INT
:
853 test_az_float64( float64_round_to_int
, syst_float64_round_to_int
);
856 #ifdef SYST_FLOAT64_ADD
858 test_abz_float64( float64_add
, syst_float64_add
);
861 #ifdef SYST_FLOAT64_SUB
863 test_abz_float64( float64_sub
, syst_float64_sub
);
866 #ifdef SYST_FLOAT64_MUL
868 test_abz_float64( float64_mul
, syst_float64_mul
);
871 #ifdef SYST_FLOAT64_DIV
873 test_abz_float64( float64_div
, syst_float64_div
);
876 #ifdef SYST_FLOAT64_REM
878 test_abz_float64( float64_rem
, syst_float64_rem
);
881 #ifdef SYST_FLOAT64_SQRT
883 test_az_float64( float64_sqrt
, syst_float64_sqrt
);
886 #ifdef SYST_FLOAT64_EQ
888 test_ab_float64_z_flag( float64_eq
, syst_float64_eq
);
891 #ifdef SYST_FLOAT64_LE
893 test_ab_float64_z_flag( float64_le
, syst_float64_le
);
896 #ifdef SYST_FLOAT64_LT
898 test_ab_float64_z_flag( float64_lt
, syst_float64_lt
);
901 #ifdef SYST_FLOAT64_EQ_SIGNALING
902 case FLOAT64_EQ_SIGNALING
:
903 test_ab_float64_z_flag(
904 float64_eq_signaling
, syst_float64_eq_signaling
);
907 #ifdef SYST_FLOAT64_LE_QUIET
908 case FLOAT64_LE_QUIET
:
909 test_ab_float64_z_flag( float64_le_quiet
, syst_float64_le_quiet
);
912 #ifdef SYST_FLOAT64_LT_QUIET
913 case FLOAT64_LT_QUIET
:
914 test_ab_float64_z_flag( float64_lt_quiet
, syst_float64_lt_quiet
);
917 #ifdef SYST_FLOATX80_TO_INT32
918 case FLOATX80_TO_INT32
:
919 test_a_floatx80_z_int32( floatx80_to_int32
, syst_floatx80_to_int32
);
922 #ifdef SYST_FLOATX80_TO_INT32_ROUND_TO_ZERO
923 case FLOATX80_TO_INT32_ROUND_TO_ZERO
:
924 test_a_floatx80_z_int32(
925 floatx80_to_int32_round_to_zero
,
926 syst_floatx80_to_int32_round_to_zero
930 #ifdef SYST_FLOATX80_TO_INT64
931 case FLOATX80_TO_INT64
:
932 test_a_floatx80_z_int64( floatx80_to_int64
, syst_floatx80_to_int64
);
935 #ifdef SYST_FLOATX80_TO_INT64_ROUND_TO_ZERO
936 case FLOATX80_TO_INT64_ROUND_TO_ZERO
:
937 test_a_floatx80_z_int64(
938 floatx80_to_int64_round_to_zero
,
939 syst_floatx80_to_int64_round_to_zero
943 #ifdef SYST_FLOATX80_TO_FLOAT32
944 case FLOATX80_TO_FLOAT32
:
945 test_a_floatx80_z_float32(
946 floatx80_to_float32
, syst_floatx80_to_float32
);
949 #ifdef SYST_FLOATX80_TO_FLOAT64
950 case FLOATX80_TO_FLOAT64
:
951 test_a_floatx80_z_float64(
952 floatx80_to_float64
, syst_floatx80_to_float64
);
955 #ifdef SYST_FLOATX80_TO_FLOAT128
956 case FLOATX80_TO_FLOAT128
:
957 test_a_floatx80_z_float128(
958 floatx80_to_float128
, syst_floatx80_to_float128
);
961 #ifdef SYST_FLOATX80_ROUND_TO_INT
962 case FLOATX80_ROUND_TO_INT
:
963 test_az_floatx80( floatx80_round_to_int
, syst_floatx80_round_to_int
);
966 #ifdef SYST_FLOATX80_ADD
968 test_abz_floatx80( floatx80_add
, syst_floatx80_add
);
971 #ifdef SYST_FLOATX80_SUB
973 test_abz_floatx80( floatx80_sub
, syst_floatx80_sub
);
976 #ifdef SYST_FLOATX80_MUL
978 test_abz_floatx80( floatx80_mul
, syst_floatx80_mul
);
981 #ifdef SYST_FLOATX80_DIV
983 test_abz_floatx80( floatx80_div
, syst_floatx80_div
);
986 #ifdef SYST_FLOATX80_REM
988 test_abz_floatx80( floatx80_rem
, syst_floatx80_rem
);
991 #ifdef SYST_FLOATX80_SQRT
993 test_az_floatx80( floatx80_sqrt
, syst_floatx80_sqrt
);
996 #ifdef SYST_FLOATX80_EQ
998 test_ab_floatx80_z_flag( floatx80_eq
, syst_floatx80_eq
);
1001 #ifdef SYST_FLOATX80_LE
1003 test_ab_floatx80_z_flag( floatx80_le
, syst_floatx80_le
);
1006 #ifdef SYST_FLOATX80_LT
1008 test_ab_floatx80_z_flag( floatx80_lt
, syst_floatx80_lt
);
1011 #ifdef SYST_FLOATX80_EQ_SIGNALING
1012 case FLOATX80_EQ_SIGNALING
:
1013 test_ab_floatx80_z_flag(
1014 floatx80_eq_signaling
, syst_floatx80_eq_signaling
);
1017 #ifdef SYST_FLOATX80_LE_QUIET
1018 case FLOATX80_LE_QUIET
:
1019 test_ab_floatx80_z_flag( floatx80_le_quiet
, syst_floatx80_le_quiet
);
1022 #ifdef SYST_FLOATX80_LT_QUIET
1023 case FLOATX80_LT_QUIET
:
1024 test_ab_floatx80_z_flag( floatx80_lt_quiet
, syst_floatx80_lt_quiet
);
1027 #ifdef SYST_FLOAT128_TO_INT32
1028 case FLOAT128_TO_INT32
:
1029 test_a_float128_z_int32( float128_to_int32
, syst_float128_to_int32
);
1032 #ifdef SYST_FLOAT128_TO_INT32_ROUND_TO_ZERO
1033 case FLOAT128_TO_INT32_ROUND_TO_ZERO
:
1034 test_a_float128_z_int32(
1035 float128_to_int32_round_to_zero
,
1036 syst_float128_to_int32_round_to_zero
1040 #ifdef SYST_FLOAT128_TO_INT64
1041 case FLOAT128_TO_INT64
:
1042 test_a_float128_z_int64( float128_to_int64
, syst_float128_to_int64
);
1045 #ifdef SYST_FLOAT128_TO_INT64_ROUND_TO_ZERO
1046 case FLOAT128_TO_INT64_ROUND_TO_ZERO
:
1047 test_a_float128_z_int64(
1048 float128_to_int64_round_to_zero
,
1049 syst_float128_to_int64_round_to_zero
1053 #ifdef SYST_FLOAT128_TO_FLOAT32
1054 case FLOAT128_TO_FLOAT32
:
1055 test_a_float128_z_float32(
1056 float128_to_float32
, syst_float128_to_float32
);
1059 #ifdef SYST_FLOAT128_TO_FLOAT64
1060 case FLOAT128_TO_FLOAT64
:
1061 test_a_float128_z_float64(
1062 float128_to_float64
, syst_float128_to_float64
);
1065 #ifdef SYST_FLOAT128_TO_FLOATX80
1066 case FLOAT128_TO_FLOATX80
:
1067 test_a_float128_z_floatx80(
1068 float128_to_floatx80
, syst_float128_to_floatx80
);
1071 #ifdef SYST_FLOAT128_ROUND_TO_INT
1072 case FLOAT128_ROUND_TO_INT
:
1073 test_az_float128( float128_round_to_int
, syst_float128_round_to_int
);
1076 #ifdef SYST_FLOAT128_ADD
1078 test_abz_float128( float128_add
, syst_float128_add
);
1081 #ifdef SYST_FLOAT128_SUB
1083 test_abz_float128( float128_sub
, syst_float128_sub
);
1086 #ifdef SYST_FLOAT128_MUL
1088 test_abz_float128( float128_mul
, syst_float128_mul
);
1091 #ifdef SYST_FLOAT128_DIV
1093 test_abz_float128( float128_div
, syst_float128_div
);
1096 #ifdef SYST_FLOAT128_REM
1098 test_abz_float128( float128_rem
, syst_float128_rem
);
1101 #ifdef SYST_FLOAT128_SQRT
1103 test_az_float128( float128_sqrt
, syst_float128_sqrt
);
1106 #ifdef SYST_FLOAT128_EQ
1108 test_ab_float128_z_flag( float128_eq
, syst_float128_eq
);
1111 #ifdef SYST_FLOAT128_LE
1113 test_ab_float128_z_flag( float128_le
, syst_float128_le
);
1116 #ifdef SYST_FLOAT128_LT
1118 test_ab_float128_z_flag( float128_lt
, syst_float128_lt
);
1121 #ifdef SYST_FLOAT128_EQ_SIGNALING
1122 case FLOAT128_EQ_SIGNALING
:
1123 test_ab_float128_z_flag(
1124 float128_eq_signaling
, syst_float128_eq_signaling
);
1127 #ifdef SYST_FLOAT128_LE_QUIET
1128 case FLOAT128_LE_QUIET
:
1129 test_ab_float128_z_flag( float128_le_quiet
, syst_float128_le_quiet
);
1132 #ifdef SYST_FLOAT128_LT_QUIET
1133 case FLOAT128_LT_QUIET
:
1134 test_ab_float128_z_flag( float128_lt_quiet
, syst_float128_lt_quiet
);
1138 if ( ( errorStop
&& anyErrors
) || stop
) exitWithStatus();
1144 uint8 functionCode
, int8 roundingPrecisionIn
, int8 roundingModeIn
)
1146 int8 roundingPrecision
, roundingMode
;
1148 roundingPrecision
= 32;
1150 if ( ! functions
[ functionCode
].roundingPrecision
) {
1151 roundingPrecision
= 0;
1153 else if ( roundingPrecisionIn
) {
1154 roundingPrecision
= roundingPrecisionIn
;
1156 for ( roundingMode
= 1;
1157 roundingMode
< NUM_ROUNDINGMODES
;
1160 if ( ! functions
[ functionCode
].roundingMode
) {
1163 else if ( roundingModeIn
) {
1164 roundingMode
= roundingModeIn
;
1166 testFunctionVariety(
1167 functionCode
, roundingPrecision
, roundingMode
);
1168 if ( roundingModeIn
|| ! roundingMode
) break;
1170 if ( roundingPrecisionIn
|| ! roundingPrecision
) break;
1171 if ( roundingPrecision
== 80 ) {
1174 else if ( roundingPrecision
== 64 ) {
1175 roundingPrecision
= 80;
1177 else if ( roundingPrecision
== 32 ) {
1178 roundingPrecision
= 64;