1207151Smarius
2207151Smarius/*
3207151Smarius===============================================================================
4207151Smarius
5207151SmariusThis C header file is part of TestFloat, Release 2a, a package of programs
6207151Smariusfor testing the correctness of floating-point arithmetic complying to the
7207151SmariusIEC/IEEE Standard for Floating-Point.
8207151Smarius
9207151SmariusWritten by John R. Hauser.  More information is available through the Web
10207151Smariuspage `http://HTTP.CS.Berkeley.EDU/~jhauser/arithmetic/TestFloat.html'.
11207151Smarius
12207151SmariusTHIS SOFTWARE IS DISTRIBUTED AS IS, FOR FREE.  Although reasonable effort
13207151Smariushas been made to avoid it, THIS SOFTWARE MAY CONTAIN FAULTS THAT WILL AT
14207151SmariusTIMES RESULT IN INCORRECT BEHAVIOR.  USE OF THIS SOFTWARE IS RESTRICTED TO
15207151SmariusPERSONS AND ORGANIZATIONS WHO CAN AND WILL TAKE FULL RESPONSIBILITY FOR ANY
16207151SmariusAND ALL LOSSES, COSTS, OR OTHER PROBLEMS ARISING FROM ITS USE.
17207151Smarius
18207151SmariusDerivative works are acceptable, even for commercial purposes, so long as
19207151Smarius(1) they include prominent notice that the work is derivative, and (2) they
20207151Smariusinclude prominent notice akin to these four paragraphs for those parts of
21207151Smariusthis code that are retained.
22207151Smarius
23207151Smarius===============================================================================
24207151Smarius*/
25207151Smarius
26207151Smarius/* $FreeBSD$ */
27207151Smarius
28207151Smarius#include "softfloat.h"
29207151Smarius#include "milieu.h"
30207151Smarius
31207151Smarius/*
32207151Smarius-------------------------------------------------------------------------------
33207151SmariusThe following macros are defined to indicate that the corresponding
34207151Smariusfunctions exist.
35207151Smarius-------------------------------------------------------------------------------
36207151Smarius*/
37207151Smarius#define SYST_INT32_TO_FLOAT32
38207151Smarius#define SYST_INT32_TO_FLOAT64
39207151Smarius#define SYST_INT32_TO_FLOAT128
40207151Smarius#define SYST_INT64_TO_FLOAT32
41207151Smarius#define SYST_INT64_TO_FLOAT64
42207151Smarius#define SYST_INT64_TO_FLOAT128
43207151Smarius#define SYST_FLOAT32_TO_INT32_ROUND_TO_ZERO
44207151Smarius#define SYST_FLOAT32_TO_INT64_ROUND_TO_ZERO
45207151Smarius#define SYST_FLOAT32_TO_FLOAT64
46207151Smarius#define SYST_FLOAT32_TO_FLOAT128
47207151Smarius#define SYST_FLOAT32_ADD
48207151Smarius#define SYST_FLOAT32_SUB
49207151Smarius#define SYST_FLOAT32_MUL
50207151Smarius#define SYST_FLOAT32_DIV
51207151Smarius#define SYST_FLOAT32_SQRT
52207151Smarius#define SYST_FLOAT32_EQ
53207151Smarius#define SYST_FLOAT32_LE
54207151Smarius#define SYST_FLOAT32_LT
55207151Smarius#define SYST_FLOAT32_EQ_SIGNALING
56207151Smarius#define SYST_FLOAT32_LE_QUIET
57207151Smarius#define SYST_FLOAT32_LT_QUIET
58207151Smarius#define SYST_FLOAT64_TO_INT32_ROUND_TO_ZERO
59207151Smarius#define SYST_FLOAT64_TO_INT64_ROUND_TO_ZERO
60207151Smarius#define SYST_FLOAT64_TO_FLOAT32
61207151Smarius#define SYST_FLOAT64_TO_FLOAT128
62207151Smarius#define SYST_FLOAT64_ADD
63207151Smarius#define SYST_FLOAT64_SUB
64207151Smarius#define SYST_FLOAT64_MUL
65207151Smarius#define SYST_FLOAT64_DIV
66207151Smarius#define SYST_FLOAT64_SQRT
67207151Smarius#define SYST_FLOAT64_EQ
68207151Smarius#define SYST_FLOAT64_LE
69207151Smarius#define SYST_FLOAT64_LT
70207151Smarius#define SYST_FLOAT64_EQ_SIGNALING
71207151Smarius#define SYST_FLOAT64_LE_QUIET
72207151Smarius#define SYST_FLOAT64_LT_QUIET
73207151Smarius#define SYST_FLOAT128_TO_INT32_ROUND_TO_ZERO
74207151Smarius#define SYST_FLOAT128_TO_INT64_ROUND_TO_ZERO
75207151Smarius#define SYST_FLOAT128_TO_FLOAT32
76207151Smarius#define SYST_FLOAT128_TO_FLOAT64
77207151Smarius#define SYST_FLOAT128_ADD
78207151Smarius#define SYST_FLOAT128_SUB
79207151Smarius#define SYST_FLOAT128_MUL
80207151Smarius#define SYST_FLOAT128_DIV
81207151Smarius#define SYST_FLOAT128_SQRT
82207151Smarius#define SYST_FLOAT128_EQ
83207151Smarius#define SYST_FLOAT128_LE
84207151Smarius#define SYST_FLOAT128_LT
85207151Smarius#define SYST_FLOAT128_EQ_SIGNALING
86207151Smarius#define SYST_FLOAT128_LE_QUIET
87207151Smarius#define SYST_FLOAT128_LT_QUIET
88207151Smarius
89207151Smarius/*
90207151Smarius-------------------------------------------------------------------------------
91207151SmariusSystem function declarations.  (Some of these functions may not exist.)
92207151Smarius-------------------------------------------------------------------------------
93207151Smarius*/
94207151Smariusfloat32 syst_int32_to_float32( int32 );
95207151Smariusfloat64 syst_int32_to_float64( int32 );
96207151Smarius#ifdef FLOATX80
97207151Smariusfloatx80 syst_int32_to_floatx80( int32 );
98207151Smarius#endif
99207151Smarius#ifdef FLOAT128
100207151Smariusfloat128 syst_int32_to_float128( int32 );
101207151Smarius#endif
102207151Smarius#ifdef BITS64
103207151Smariusfloat32 syst_int64_to_float32( int64 );
104207151Smariusfloat64 syst_int64_to_float64( int64 );
105207151Smarius#ifdef FLOATX80
106207151Smariusfloatx80 syst_int64_to_floatx80( int64 );
107207151Smarius#endif
108207151Smarius#ifdef FLOAT128
109207151Smariusfloat128 syst_int64_to_float128( int64 );
110207151Smarius#endif
111207151Smarius#endif
112207151Smariusint32 syst_float32_to_int32( float32 );
113207151Smariusint32 syst_float32_to_int32_round_to_zero( float32 );
114207151Smarius#ifdef BITS64
115207151Smariusint64 syst_float32_to_int64( float32 );
116207151Smariusint64 syst_float32_to_int64_round_to_zero( float32 );
117207151Smarius#endif
118207151Smariusfloat64 syst_float32_to_float64( float32 );
119207151Smarius#ifdef FLOATX80
120207151Smariusfloatx80 syst_float32_to_floatx80( float32 );
121207151Smarius#endif
122207151Smarius#ifdef FLOAT128
123207151Smariusfloat128 syst_float32_to_float128( float32 );
124207151Smarius#endif
125207151Smariusfloat32 syst_float32_round_to_int( float32 );
126207151Smariusfloat32 syst_float32_add( float32, float32 );
127207151Smariusfloat32 syst_float32_sub( float32, float32 );
128207151Smariusfloat32 syst_float32_mul( float32, float32 );
129207151Smariusfloat32 syst_float32_div( float32, float32 );
130207151Smariusfloat32 syst_float32_rem( float32, float32 );
131207151Smariusfloat32 syst_float32_sqrt( float32 );
132207151Smariusflag syst_float32_eq( float32, float32 );
133207151Smariusflag syst_float32_le( float32, float32 );
134207151Smariusflag syst_float32_lt( float32, float32 );
135207151Smariusflag syst_float32_eq_signaling( float32, float32 );
136207151Smariusflag syst_float32_le_quiet( float32, float32 );
137207151Smariusflag syst_float32_lt_quiet( float32, float32 );
138207151Smariusint32 syst_float64_to_int32( float64 );
139207151Smariusint32 syst_float64_to_int32_round_to_zero( float64 );
140207151Smarius#ifdef BITS64
141207151Smariusint64 syst_float64_to_int64( float64 );
142207151Smariusint64 syst_float64_to_int64_round_to_zero( float64 );
143207151Smarius#endif
144207151Smariusfloat32 syst_float64_to_float32( float64 );
145207151Smarius#ifdef FLOATX80
146207151Smariusfloatx80 syst_float64_to_floatx80( float64 );
147207151Smarius#endif
148207151Smarius#ifdef FLOAT128
149207151Smariusfloat128 syst_float64_to_float128( float64 );
150207151Smarius#endif
151207151Smariusfloat64 syst_float64_round_to_int( float64 );
152207151Smariusfloat64 syst_float64_add( float64, float64 );
153207151Smariusfloat64 syst_float64_sub( float64, float64 );
154207151Smariusfloat64 syst_float64_mul( float64, float64 );
155207151Smariusfloat64 syst_float64_div( float64, float64 );
156207151Smariusfloat64 syst_float64_rem( float64, float64 );
157207151Smariusfloat64 syst_float64_sqrt( float64 );
158207151Smariusflag syst_float64_eq( float64, float64 );
159207151Smariusflag syst_float64_le( float64, float64 );
160207151Smariusflag syst_float64_lt( float64, float64 );
161207151Smariusflag syst_float64_eq_signaling( float64, float64 );
162207151Smariusflag syst_float64_le_quiet( float64, float64 );
163207151Smariusflag syst_float64_lt_quiet( float64, float64 );
164207151Smarius#ifdef FLOATX80
165207151Smariusint32 syst_floatx80_to_int32( floatx80 );
166207151Smariusint32 syst_floatx80_to_int32_round_to_zero( floatx80 );
167207151Smarius#ifdef BITS64
168207151Smariusint64 syst_floatx80_to_int64( floatx80 );
169207151Smariusint64 syst_floatx80_to_int64_round_to_zero( floatx80 );
170207151Smarius#endif
171207151Smariusfloat32 syst_floatx80_to_float32( floatx80 );
172207151Smariusfloat64 syst_floatx80_to_float64( floatx80 );
173207151Smarius#ifdef FLOAT128
174207151Smariusfloat128 syst_floatx80_to_float128( floatx80 );
175207151Smarius#endif
176207151Smariusfloatx80 syst_floatx80_round_to_int( floatx80 );
177207151Smariusfloatx80 syst_floatx80_add( floatx80, floatx80 );
178207151Smariusfloatx80 syst_floatx80_sub( floatx80, floatx80 );
179207151Smariusfloatx80 syst_floatx80_mul( floatx80, floatx80 );
180207151Smariusfloatx80 syst_floatx80_div( floatx80, floatx80 );
181207151Smariusfloatx80 syst_floatx80_rem( floatx80, floatx80 );
182207151Smariusfloatx80 syst_floatx80_sqrt( floatx80 );
183207151Smariusflag syst_floatx80_eq( floatx80, floatx80 );
184207151Smariusflag syst_floatx80_le( floatx80, floatx80 );
185207151Smariusflag syst_floatx80_lt( floatx80, floatx80 );
186207151Smariusflag syst_floatx80_eq_signaling( floatx80, floatx80 );
187207151Smariusflag syst_floatx80_le_quiet( floatx80, floatx80 );
188207151Smariusflag syst_floatx80_lt_quiet( floatx80, floatx80 );
189207151Smarius#endif
190207151Smarius#ifdef FLOAT128
191207151Smariusint32 syst_float128_to_int32( float128 );
192207151Smariusint32 syst_float128_to_int32_round_to_zero( float128 );
193207151Smarius#ifdef BITS64
194207151Smariusint64 syst_float128_to_int64( float128 );
195207151Smariusint64 syst_float128_to_int64_round_to_zero( float128 );
196207151Smarius#endif
197207151Smariusfloat32 syst_float128_to_float32( float128 );
198207151Smariusfloat64 syst_float128_to_float64( float128 );
199207151Smarius#ifdef FLOATX80
200207151Smariusfloatx80 syst_float128_to_floatx80( float128 );
201207151Smarius#endif
202207151Smariusfloat128 syst_float128_round_to_int( float128 );
203207151Smariusfloat128 syst_float128_add( float128, float128 );
204207151Smariusfloat128 syst_float128_sub( float128, float128 );
205207151Smariusfloat128 syst_float128_mul( float128, float128 );
206207151Smariusfloat128 syst_float128_div( float128, float128 );
207207151Smariusfloat128 syst_float128_rem( float128, float128 );
208207151Smariusfloat128 syst_float128_sqrt( float128 );
209207151Smariusflag syst_float128_eq( float128, float128 );
210207151Smariusflag syst_float128_le( float128, float128 );
211207151Smariusflag syst_float128_lt( float128, float128 );
212207151Smariusflag syst_float128_eq_signaling( float128, float128 );
213207151Smariusflag syst_float128_le_quiet( float128, float128 );
214207151Smariusflag syst_float128_lt_quiet( float128, float128 );
215207151Smarius#endif
216207151Smarius
217