1
2/*
3===============================================================================
4
5This C header file is part of TestFloat, Release 2a, a package of programs
6for testing the correctness of floating-point arithmetic complying to the
7IEC/IEEE Standard for Floating-Point.
8
9Written by John R. Hauser.  More information is available through the Web
10page `http://HTTP.CS.Berkeley.EDU/~jhauser/arithmetic/TestFloat.html'.
11
12THIS SOFTWARE IS DISTRIBUTED AS IS, FOR FREE.  Although reasonable effort
13has been made to avoid it, THIS SOFTWARE MAY CONTAIN FAULTS THAT WILL AT
14TIMES RESULT IN INCORRECT BEHAVIOR.  USE OF THIS SOFTWARE IS RESTRICTED TO
15PERSONS AND ORGANIZATIONS WHO CAN AND WILL TAKE FULL RESPONSIBILITY FOR ANY
16AND ALL LOSSES, COSTS, OR OTHER PROBLEMS ARISING FROM ITS USE.
17
18Derivative works are acceptable, even for commercial purposes, so long as
19(1) they include prominent notice that the work is derivative, and (2) they
20include prominent notice akin to these four paragraphs for those parts of
21this code that are retained.
22
23===============================================================================
24*/
25
26/* $FreeBSD$ */
27
28#include "softfloat.h"
29#include "milieu.h"
30
31/*
32-------------------------------------------------------------------------------
33The following macros are defined to indicate that the corresponding
34functions exist.
35-------------------------------------------------------------------------------
36*/
37#define SYST_INT32_TO_FLOAT32
38#define SYST_INT32_TO_FLOAT64
39#define SYST_INT32_TO_FLOAT128
40#define SYST_INT64_TO_FLOAT32
41#define SYST_INT64_TO_FLOAT64
42#define SYST_INT64_TO_FLOAT128
43#define SYST_FLOAT32_TO_INT32_ROUND_TO_ZERO
44#define SYST_FLOAT32_TO_INT64_ROUND_TO_ZERO
45#define SYST_FLOAT32_TO_FLOAT64
46#define SYST_FLOAT32_TO_FLOAT128
47#define SYST_FLOAT32_ADD
48#define SYST_FLOAT32_SUB
49#define SYST_FLOAT32_MUL
50#define SYST_FLOAT32_DIV
51#define SYST_FLOAT32_SQRT
52#define SYST_FLOAT32_EQ
53#define SYST_FLOAT32_LE
54#define SYST_FLOAT32_LT
55#define SYST_FLOAT32_EQ_SIGNALING
56#define SYST_FLOAT32_LE_QUIET
57#define SYST_FLOAT32_LT_QUIET
58#define SYST_FLOAT64_TO_INT32_ROUND_TO_ZERO
59#define SYST_FLOAT64_TO_INT64_ROUND_TO_ZERO
60#define SYST_FLOAT64_TO_FLOAT32
61#define SYST_FLOAT64_TO_FLOAT128
62#define SYST_FLOAT64_ADD
63#define SYST_FLOAT64_SUB
64#define SYST_FLOAT64_MUL
65#define SYST_FLOAT64_DIV
66#define SYST_FLOAT64_SQRT
67#define SYST_FLOAT64_EQ
68#define SYST_FLOAT64_LE
69#define SYST_FLOAT64_LT
70#define SYST_FLOAT64_EQ_SIGNALING
71#define SYST_FLOAT64_LE_QUIET
72#define SYST_FLOAT64_LT_QUIET
73#define SYST_FLOAT128_TO_INT32_ROUND_TO_ZERO
74#define SYST_FLOAT128_TO_INT64_ROUND_TO_ZERO
75#define SYST_FLOAT128_TO_FLOAT32
76#define SYST_FLOAT128_TO_FLOAT64
77#define SYST_FLOAT128_ADD
78#define SYST_FLOAT128_SUB
79#define SYST_FLOAT128_MUL
80#define SYST_FLOAT128_DIV
81#define SYST_FLOAT128_SQRT
82#define SYST_FLOAT128_EQ
83#define SYST_FLOAT128_LE
84#define SYST_FLOAT128_LT
85#define SYST_FLOAT128_EQ_SIGNALING
86#define SYST_FLOAT128_LE_QUIET
87#define SYST_FLOAT128_LT_QUIET
88
89/*
90-------------------------------------------------------------------------------
91System function declarations.  (Some of these functions may not exist.)
92-------------------------------------------------------------------------------
93*/
94float32 syst_int32_to_float32( int32 );
95float64 syst_int32_to_float64( int32 );
96#ifdef FLOATX80
97floatx80 syst_int32_to_floatx80( int32 );
98#endif
99#ifdef FLOAT128
100float128 syst_int32_to_float128( int32 );
101#endif
102#ifdef BITS64
103float32 syst_int64_to_float32( int64 );
104float64 syst_int64_to_float64( int64 );
105#ifdef FLOATX80
106floatx80 syst_int64_to_floatx80( int64 );
107#endif
108#ifdef FLOAT128
109float128 syst_int64_to_float128( int64 );
110#endif
111#endif
112int32 syst_float32_to_int32( float32 );
113int32 syst_float32_to_int32_round_to_zero( float32 );
114#ifdef BITS64
115int64 syst_float32_to_int64( float32 );
116int64 syst_float32_to_int64_round_to_zero( float32 );
117#endif
118float64 syst_float32_to_float64( float32 );
119#ifdef FLOATX80
120floatx80 syst_float32_to_floatx80( float32 );
121#endif
122#ifdef FLOAT128
123float128 syst_float32_to_float128( float32 );
124#endif
125float32 syst_float32_round_to_int( float32 );
126float32 syst_float32_add( float32, float32 );
127float32 syst_float32_sub( float32, float32 );
128float32 syst_float32_mul( float32, float32 );
129float32 syst_float32_div( float32, float32 );
130float32 syst_float32_rem( float32, float32 );
131float32 syst_float32_sqrt( float32 );
132flag syst_float32_eq( float32, float32 );
133flag syst_float32_le( float32, float32 );
134flag syst_float32_lt( float32, float32 );
135flag syst_float32_eq_signaling( float32, float32 );
136flag syst_float32_le_quiet( float32, float32 );
137flag syst_float32_lt_quiet( float32, float32 );
138int32 syst_float64_to_int32( float64 );
139int32 syst_float64_to_int32_round_to_zero( float64 );
140#ifdef BITS64
141int64 syst_float64_to_int64( float64 );
142int64 syst_float64_to_int64_round_to_zero( float64 );
143#endif
144float32 syst_float64_to_float32( float64 );
145#ifdef FLOATX80
146floatx80 syst_float64_to_floatx80( float64 );
147#endif
148#ifdef FLOAT128
149float128 syst_float64_to_float128( float64 );
150#endif
151float64 syst_float64_round_to_int( float64 );
152float64 syst_float64_add( float64, float64 );
153float64 syst_float64_sub( float64, float64 );
154float64 syst_float64_mul( float64, float64 );
155float64 syst_float64_div( float64, float64 );
156float64 syst_float64_rem( float64, float64 );
157float64 syst_float64_sqrt( float64 );
158flag syst_float64_eq( float64, float64 );
159flag syst_float64_le( float64, float64 );
160flag syst_float64_lt( float64, float64 );
161flag syst_float64_eq_signaling( float64, float64 );
162flag syst_float64_le_quiet( float64, float64 );
163flag syst_float64_lt_quiet( float64, float64 );
164#ifdef FLOATX80
165int32 syst_floatx80_to_int32( floatx80 );
166int32 syst_floatx80_to_int32_round_to_zero( floatx80 );
167#ifdef BITS64
168int64 syst_floatx80_to_int64( floatx80 );
169int64 syst_floatx80_to_int64_round_to_zero( floatx80 );
170#endif
171float32 syst_floatx80_to_float32( floatx80 );
172float64 syst_floatx80_to_float64( floatx80 );
173#ifdef FLOAT128
174float128 syst_floatx80_to_float128( floatx80 );
175#endif
176floatx80 syst_floatx80_round_to_int( floatx80 );
177floatx80 syst_floatx80_add( floatx80, floatx80 );
178floatx80 syst_floatx80_sub( floatx80, floatx80 );
179floatx80 syst_floatx80_mul( floatx80, floatx80 );
180floatx80 syst_floatx80_div( floatx80, floatx80 );
181floatx80 syst_floatx80_rem( floatx80, floatx80 );
182floatx80 syst_floatx80_sqrt( floatx80 );
183flag syst_floatx80_eq( floatx80, floatx80 );
184flag syst_floatx80_le( floatx80, floatx80 );
185flag syst_floatx80_lt( floatx80, floatx80 );
186flag syst_floatx80_eq_signaling( floatx80, floatx80 );
187flag syst_floatx80_le_quiet( floatx80, floatx80 );
188flag syst_floatx80_lt_quiet( floatx80, floatx80 );
189#endif
190#ifdef FLOAT128
191int32 syst_float128_to_int32( float128 );
192int32 syst_float128_to_int32_round_to_zero( float128 );
193#ifdef BITS64
194int64 syst_float128_to_int64( float128 );
195int64 syst_float128_to_int64_round_to_zero( float128 );
196#endif
197float32 syst_float128_to_float32( float128 );
198float64 syst_float128_to_float64( float128 );
199#ifdef FLOATX80
200floatx80 syst_float128_to_floatx80( float128 );
201#endif
202float128 syst_float128_round_to_int( float128 );
203float128 syst_float128_add( float128, float128 );
204float128 syst_float128_sub( float128, float128 );
205float128 syst_float128_mul( float128, float128 );
206float128 syst_float128_div( float128, float128 );
207float128 syst_float128_rem( float128, float128 );
208float128 syst_float128_sqrt( float128 );
209flag syst_float128_eq( float128, float128 );
210flag syst_float128_le( float128, float128 );
211flag syst_float128_lt( float128, float128 );
212flag syst_float128_eq_signaling( float128, float128 );
213flag syst_float128_le_quiet( float128, float128 );
214flag syst_float128_lt_quiet( float128, float128 );
215#endif
216
217