annotate libgcc/fp-bit.h @ 111:04ced10e8804

gcc 7
author kono
date Fri, 27 Oct 2017 22:46:09 +0900
parents
children 84e7813d76e9
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
111
kono
parents:
diff changeset
1 /* Header file for fp-bit.c. */
kono
parents:
diff changeset
2 /* Copyright (C) 2000-2017 Free Software Foundation, Inc.
kono
parents:
diff changeset
3
kono
parents:
diff changeset
4 This file is part of GCC.
kono
parents:
diff changeset
5
kono
parents:
diff changeset
6 GCC is free software; you can redistribute it and/or modify it under
kono
parents:
diff changeset
7 the terms of the GNU General Public License as published by the Free
kono
parents:
diff changeset
8 Software Foundation; either version 3, or (at your option) any later
kono
parents:
diff changeset
9 version.
kono
parents:
diff changeset
10
kono
parents:
diff changeset
11 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
kono
parents:
diff changeset
12 WARRANTY; without even the implied warranty of MERCHANTABILITY or
kono
parents:
diff changeset
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
kono
parents:
diff changeset
14 for more details.
kono
parents:
diff changeset
15
kono
parents:
diff changeset
16 Under Section 7 of GPL version 3, you are granted additional
kono
parents:
diff changeset
17 permissions described in the GCC Runtime Library Exception, version
kono
parents:
diff changeset
18 3.1, as published by the Free Software Foundation.
kono
parents:
diff changeset
19
kono
parents:
diff changeset
20 You should have received a copy of the GNU General Public License and
kono
parents:
diff changeset
21 a copy of the GCC Runtime Library Exception along with this program;
kono
parents:
diff changeset
22 see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
kono
parents:
diff changeset
23 <http://www.gnu.org/licenses/>. */
kono
parents:
diff changeset
24
kono
parents:
diff changeset
25 #ifndef GCC_FP_BIT_H
kono
parents:
diff changeset
26 #define GCC_FP_BIT_H
kono
parents:
diff changeset
27
kono
parents:
diff changeset
28 /* Defining FINE_GRAINED_LIBRARIES allows one to select which routines
kono
parents:
diff changeset
29 from this file are compiled via additional -D options.
kono
parents:
diff changeset
30
kono
parents:
diff changeset
31 This avoids the need to pull in the entire fp emulation library
kono
parents:
diff changeset
32 when only a small number of functions are needed.
kono
parents:
diff changeset
33
kono
parents:
diff changeset
34 If FINE_GRAINED_LIBRARIES is not defined, then compile every
kono
parents:
diff changeset
35 suitable routine. */
kono
parents:
diff changeset
36 #ifndef FINE_GRAINED_LIBRARIES
kono
parents:
diff changeset
37 #define L_pack_df
kono
parents:
diff changeset
38 #define L_unpack_df
kono
parents:
diff changeset
39 #define L_pack_sf
kono
parents:
diff changeset
40 #define L_unpack_sf
kono
parents:
diff changeset
41 #define L_addsub_sf
kono
parents:
diff changeset
42 #define L_addsub_df
kono
parents:
diff changeset
43 #define L_mul_sf
kono
parents:
diff changeset
44 #define L_mul_df
kono
parents:
diff changeset
45 #define L_div_sf
kono
parents:
diff changeset
46 #define L_div_df
kono
parents:
diff changeset
47 #define L_fpcmp_parts_sf
kono
parents:
diff changeset
48 #define L_fpcmp_parts_df
kono
parents:
diff changeset
49 #define L_compare_sf
kono
parents:
diff changeset
50 #define L_compare_df
kono
parents:
diff changeset
51 #define L_eq_sf
kono
parents:
diff changeset
52 #define L_eq_df
kono
parents:
diff changeset
53 #define L_ne_sf
kono
parents:
diff changeset
54 #define L_ne_df
kono
parents:
diff changeset
55 #define L_gt_sf
kono
parents:
diff changeset
56 #define L_gt_df
kono
parents:
diff changeset
57 #define L_ge_sf
kono
parents:
diff changeset
58 #define L_ge_df
kono
parents:
diff changeset
59 #define L_lt_sf
kono
parents:
diff changeset
60 #define L_lt_df
kono
parents:
diff changeset
61 #define L_le_sf
kono
parents:
diff changeset
62 #define L_le_df
kono
parents:
diff changeset
63 #define L_unord_sf
kono
parents:
diff changeset
64 #define L_unord_df
kono
parents:
diff changeset
65 #define L_usi_to_sf
kono
parents:
diff changeset
66 #define L_usi_to_df
kono
parents:
diff changeset
67 #define L_si_to_sf
kono
parents:
diff changeset
68 #define L_si_to_df
kono
parents:
diff changeset
69 #define L_sf_to_si
kono
parents:
diff changeset
70 #define L_df_to_si
kono
parents:
diff changeset
71 #define L_f_to_usi
kono
parents:
diff changeset
72 #define L_df_to_usi
kono
parents:
diff changeset
73 #define L_negate_sf
kono
parents:
diff changeset
74 #define L_negate_df
kono
parents:
diff changeset
75 #define L_make_sf
kono
parents:
diff changeset
76 #define L_make_df
kono
parents:
diff changeset
77 #define L_sf_to_df
kono
parents:
diff changeset
78 #define L_df_to_sf
kono
parents:
diff changeset
79 #ifdef FLOAT
kono
parents:
diff changeset
80 #define L_thenan_sf
kono
parents:
diff changeset
81 #else
kono
parents:
diff changeset
82 #define L_thenan_df
kono
parents:
diff changeset
83 #endif
kono
parents:
diff changeset
84 #endif /* ! FINE_GRAINED_LIBRARIES */
kono
parents:
diff changeset
85
kono
parents:
diff changeset
86 #if __LDBL_MANT_DIG__ == 113 || __LDBL_MANT_DIG__ == 106
kono
parents:
diff changeset
87 # if defined(TFLOAT) || defined(L_sf_to_tf) || defined(L_df_to_tf)
kono
parents:
diff changeset
88 # define TMODES
kono
parents:
diff changeset
89 # endif
kono
parents:
diff changeset
90 #endif
kono
parents:
diff changeset
91
kono
parents:
diff changeset
92 typedef float SFtype __attribute__ ((mode (SF)));
kono
parents:
diff changeset
93 typedef float DFtype __attribute__ ((mode (DF)));
kono
parents:
diff changeset
94 #ifdef TMODES
kono
parents:
diff changeset
95 typedef float TFtype __attribute__ ((mode (TF)));
kono
parents:
diff changeset
96 #endif
kono
parents:
diff changeset
97
kono
parents:
diff changeset
98 typedef int HItype __attribute__ ((mode (HI)));
kono
parents:
diff changeset
99 typedef int SItype __attribute__ ((mode (SI)));
kono
parents:
diff changeset
100 typedef int DItype __attribute__ ((mode (DI)));
kono
parents:
diff changeset
101 #ifdef TMODES
kono
parents:
diff changeset
102 typedef int TItype __attribute__ ((mode (TI)));
kono
parents:
diff changeset
103 #endif
kono
parents:
diff changeset
104
kono
parents:
diff changeset
105 /* The type of the result of a floating point comparison. This must
kono
parents:
diff changeset
106 match `__libgcc_cmp_return__' in GCC for the target. */
kono
parents:
diff changeset
107 #ifndef CMPtype
kono
parents:
diff changeset
108 typedef int CMPtype __attribute__ ((mode (__libgcc_cmp_return__)));
kono
parents:
diff changeset
109 #endif
kono
parents:
diff changeset
110
kono
parents:
diff changeset
111 typedef unsigned int UHItype __attribute__ ((mode (HI)));
kono
parents:
diff changeset
112 typedef unsigned int USItype __attribute__ ((mode (SI)));
kono
parents:
diff changeset
113 typedef unsigned int UDItype __attribute__ ((mode (DI)));
kono
parents:
diff changeset
114 #ifdef TMODES
kono
parents:
diff changeset
115 typedef unsigned int UTItype __attribute__ ((mode (TI)));
kono
parents:
diff changeset
116 #endif
kono
parents:
diff changeset
117
kono
parents:
diff changeset
118 #define MAX_USI_INT (~(USItype)0)
kono
parents:
diff changeset
119 #define MAX_SI_INT ((SItype) (MAX_USI_INT >> 1))
kono
parents:
diff changeset
120 #define BITS_PER_SI (4 * __CHAR_BIT__)
kono
parents:
diff changeset
121 #ifdef TMODES
kono
parents:
diff changeset
122 #define MAX_UDI_INT (~(UDItype)0)
kono
parents:
diff changeset
123 #define MAX_DI_INT ((DItype) (MAX_UDI_INT >> 1))
kono
parents:
diff changeset
124 #define BITS_PER_DI (8 * __CHAR_BIT__)
kono
parents:
diff changeset
125 #endif
kono
parents:
diff changeset
126
kono
parents:
diff changeset
127 #ifdef FLOAT_ONLY
kono
parents:
diff changeset
128 #define NO_DI_MODE
kono
parents:
diff changeset
129 #endif
kono
parents:
diff changeset
130
kono
parents:
diff changeset
131 #if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
kono
parents:
diff changeset
132 #define FLOAT_BIT_ORDER_MISMATCH
kono
parents:
diff changeset
133 #endif
kono
parents:
diff changeset
134
kono
parents:
diff changeset
135 #if __BYTE_ORDER__ != __FLOAT_WORD_ORDER__
kono
parents:
diff changeset
136 #define FLOAT_WORD_ORDER_MISMATCH
kono
parents:
diff changeset
137 #endif
kono
parents:
diff changeset
138
kono
parents:
diff changeset
139 #ifdef TFLOAT
kono
parents:
diff changeset
140 # ifndef TMODES
kono
parents:
diff changeset
141 # error "TFLOAT requires long double to have 113 bits of mantissa"
kono
parents:
diff changeset
142 # endif
kono
parents:
diff changeset
143
kono
parents:
diff changeset
144 # define PREFIXFPDP tp
kono
parents:
diff changeset
145 # define PREFIXSFDF tf
kono
parents:
diff changeset
146 # define NGARDS 10L /* Is this right? */
kono
parents:
diff changeset
147 # define GARDROUND 0x1ff
kono
parents:
diff changeset
148 # define GARDMASK 0x3ff
kono
parents:
diff changeset
149 # define GARDMSB 0x200
kono
parents:
diff changeset
150 # define FRAC_NBITS 128
kono
parents:
diff changeset
151
kono
parents:
diff changeset
152 # if __LDBL_MANT_DIG__ == 113 /* IEEE quad */
kono
parents:
diff changeset
153 # define EXPBITS 15
kono
parents:
diff changeset
154 # define EXPBIAS 16383
kono
parents:
diff changeset
155 # define EXPMAX (0x7fff)
kono
parents:
diff changeset
156 # define QUIET_NAN ((TItype)0x8 << 108)
kono
parents:
diff changeset
157 # define FRACHIGH ((TItype)0x8 << 124)
kono
parents:
diff changeset
158 # define FRACHIGH2 ((TItype)0xc << 124)
kono
parents:
diff changeset
159 # define FRACBITS 112
kono
parents:
diff changeset
160 # endif
kono
parents:
diff changeset
161
kono
parents:
diff changeset
162 # if __LDBL_MANT_DIG__ == 106 /* IBM extended (double+double) */
kono
parents:
diff changeset
163 # define EXPBITS 11
kono
parents:
diff changeset
164 # define EXPBIAS 1023
kono
parents:
diff changeset
165 # define EXPMAX (0x7ff)
kono
parents:
diff changeset
166 # define QUIET_NAN ((TItype)0x8 << (48 + 64))
kono
parents:
diff changeset
167 # define FRACHIGH ((TItype)0x8 << 124)
kono
parents:
diff changeset
168 # define FRACHIGH2 ((TItype)0xc << 124)
kono
parents:
diff changeset
169 # define FRACBITS 105
kono
parents:
diff changeset
170 # define HALFFRACBITS 52
kono
parents:
diff changeset
171 # define HALFSHIFT 64
kono
parents:
diff changeset
172 # endif
kono
parents:
diff changeset
173
kono
parents:
diff changeset
174 # define pack_d __pack_t
kono
parents:
diff changeset
175 # define unpack_d __unpack_t
kono
parents:
diff changeset
176 # define __fpcmp_parts __fpcmp_parts_t
kono
parents:
diff changeset
177 typedef UTItype fractype;
kono
parents:
diff changeset
178 typedef UDItype halffractype;
kono
parents:
diff changeset
179 typedef USItype qrtrfractype;
kono
parents:
diff changeset
180 #define qrtrfractype qrtrfractype
kono
parents:
diff changeset
181 typedef TFtype FLO_type;
kono
parents:
diff changeset
182 typedef TItype intfrac;
kono
parents:
diff changeset
183 #elif defined FLOAT
kono
parents:
diff changeset
184 # define NGARDS 7L
kono
parents:
diff changeset
185 # define GARDROUND 0x3f
kono
parents:
diff changeset
186 # define GARDMASK 0x7f
kono
parents:
diff changeset
187 # define GARDMSB 0x40
kono
parents:
diff changeset
188 # define EXPBITS 8
kono
parents:
diff changeset
189 # define EXPBIAS 127
kono
parents:
diff changeset
190 # define FRACBITS 23
kono
parents:
diff changeset
191 # define EXPMAX (0xff)
kono
parents:
diff changeset
192 # define QUIET_NAN 0x400000L
kono
parents:
diff changeset
193 # define FRAC_NBITS 32
kono
parents:
diff changeset
194 # define FRACHIGH 0x80000000L
kono
parents:
diff changeset
195 # define FRACHIGH2 0xc0000000L
kono
parents:
diff changeset
196 # define pack_d __pack_f
kono
parents:
diff changeset
197 # define unpack_d __unpack_f
kono
parents:
diff changeset
198 # define __fpcmp_parts __fpcmp_parts_f
kono
parents:
diff changeset
199 typedef USItype fractype;
kono
parents:
diff changeset
200 typedef UHItype halffractype;
kono
parents:
diff changeset
201 typedef SFtype FLO_type;
kono
parents:
diff changeset
202 typedef SItype intfrac;
kono
parents:
diff changeset
203
kono
parents:
diff changeset
204 #else
kono
parents:
diff changeset
205 # define PREFIXFPDP dp
kono
parents:
diff changeset
206 # define PREFIXSFDF df
kono
parents:
diff changeset
207 # define NGARDS 8L
kono
parents:
diff changeset
208 # define GARDROUND 0x7f
kono
parents:
diff changeset
209 # define GARDMASK 0xff
kono
parents:
diff changeset
210 # define GARDMSB 0x80
kono
parents:
diff changeset
211 # define EXPBITS 11
kono
parents:
diff changeset
212 # define EXPBIAS 1023
kono
parents:
diff changeset
213 # define FRACBITS 52
kono
parents:
diff changeset
214 # define EXPMAX (0x7ff)
kono
parents:
diff changeset
215 # define QUIET_NAN 0x8000000000000LL
kono
parents:
diff changeset
216 # define FRAC_NBITS 64
kono
parents:
diff changeset
217 # define FRACHIGH 0x8000000000000000LL
kono
parents:
diff changeset
218 # define FRACHIGH2 0xc000000000000000LL
kono
parents:
diff changeset
219 # define pack_d __pack_d
kono
parents:
diff changeset
220 # define unpack_d __unpack_d
kono
parents:
diff changeset
221 # define __fpcmp_parts __fpcmp_parts_d
kono
parents:
diff changeset
222 typedef UDItype fractype;
kono
parents:
diff changeset
223 typedef USItype halffractype;
kono
parents:
diff changeset
224 typedef DFtype FLO_type;
kono
parents:
diff changeset
225 typedef DItype intfrac;
kono
parents:
diff changeset
226 #endif /* FLOAT */
kono
parents:
diff changeset
227
kono
parents:
diff changeset
228 #ifdef TFLOAT
kono
parents:
diff changeset
229 # define add __addtf3
kono
parents:
diff changeset
230 # define sub __subtf3
kono
parents:
diff changeset
231 # define multiply __multf3
kono
parents:
diff changeset
232 # define divide __divtf3
kono
parents:
diff changeset
233 # define compare __cmptf2
kono
parents:
diff changeset
234 # define _eq_f2 __eqtf2
kono
parents:
diff changeset
235 # define _ne_f2 __netf2
kono
parents:
diff changeset
236 # define _gt_f2 __gttf2
kono
parents:
diff changeset
237 # define _ge_f2 __getf2
kono
parents:
diff changeset
238 # define _lt_f2 __lttf2
kono
parents:
diff changeset
239 # define _le_f2 __letf2
kono
parents:
diff changeset
240 # define _unord_f2 __unordtf2
kono
parents:
diff changeset
241 # define usi_to_float __floatunsitf
kono
parents:
diff changeset
242 # define si_to_float __floatsitf
kono
parents:
diff changeset
243 # define float_to_si __fixtfsi
kono
parents:
diff changeset
244 # define float_to_usi __fixunstfsi
kono
parents:
diff changeset
245 # define negate __negtf2
kono
parents:
diff changeset
246 # define tf_to_sf __trunctfsf2
kono
parents:
diff changeset
247 # define tf_to_df __trunctfdf2
kono
parents:
diff changeset
248 #elif defined FLOAT
kono
parents:
diff changeset
249 # define add __addsf3
kono
parents:
diff changeset
250 # define sub __subsf3
kono
parents:
diff changeset
251 # define multiply __mulsf3
kono
parents:
diff changeset
252 # define divide __divsf3
kono
parents:
diff changeset
253 # define compare __cmpsf2
kono
parents:
diff changeset
254 # define _eq_f2 __eqsf2
kono
parents:
diff changeset
255 # define _ne_f2 __nesf2
kono
parents:
diff changeset
256 # define _gt_f2 __gtsf2
kono
parents:
diff changeset
257 # define _ge_f2 __gesf2
kono
parents:
diff changeset
258 # define _lt_f2 __ltsf2
kono
parents:
diff changeset
259 # define _le_f2 __lesf2
kono
parents:
diff changeset
260 # define _unord_f2 __unordsf2
kono
parents:
diff changeset
261 # define usi_to_float __floatunsisf
kono
parents:
diff changeset
262 # define si_to_float __floatsisf
kono
parents:
diff changeset
263 # define float_to_si __fixsfsi
kono
parents:
diff changeset
264 # define float_to_usi __fixunssfsi
kono
parents:
diff changeset
265 # define negate __negsf2
kono
parents:
diff changeset
266 # define sf_to_df __extendsfdf2
kono
parents:
diff changeset
267 # define sf_to_tf __extendsftf2
kono
parents:
diff changeset
268 #else
kono
parents:
diff changeset
269 # define add __adddf3
kono
parents:
diff changeset
270 # define sub __subdf3
kono
parents:
diff changeset
271 # define multiply __muldf3
kono
parents:
diff changeset
272 # define divide __divdf3
kono
parents:
diff changeset
273 # define compare __cmpdf2
kono
parents:
diff changeset
274 # define _eq_f2 __eqdf2
kono
parents:
diff changeset
275 # define _ne_f2 __nedf2
kono
parents:
diff changeset
276 # define _gt_f2 __gtdf2
kono
parents:
diff changeset
277 # define _ge_f2 __gedf2
kono
parents:
diff changeset
278 # define _lt_f2 __ltdf2
kono
parents:
diff changeset
279 # define _le_f2 __ledf2
kono
parents:
diff changeset
280 # define _unord_f2 __unorddf2
kono
parents:
diff changeset
281 # define usi_to_float __floatunsidf
kono
parents:
diff changeset
282 # define si_to_float __floatsidf
kono
parents:
diff changeset
283 # define float_to_si __fixdfsi
kono
parents:
diff changeset
284 # define float_to_usi __fixunsdfsi
kono
parents:
diff changeset
285 # define negate __negdf2
kono
parents:
diff changeset
286 # define df_to_sf __truncdfsf2
kono
parents:
diff changeset
287 # define df_to_tf __extenddftf2
kono
parents:
diff changeset
288 #endif /* FLOAT */
kono
parents:
diff changeset
289
kono
parents:
diff changeset
290 #ifndef INLINE
kono
parents:
diff changeset
291 #define INLINE __inline__
kono
parents:
diff changeset
292 #endif
kono
parents:
diff changeset
293
kono
parents:
diff changeset
294 /* Preserve the sticky-bit when shifting fractions to the right. */
kono
parents:
diff changeset
295 #define LSHIFT(a, s) { a = (a >> s) | !!(a & (((fractype) 1 << s) - 1)); }
kono
parents:
diff changeset
296
kono
parents:
diff changeset
297 /* numeric parameters */
kono
parents:
diff changeset
298 /* F_D_BITOFF is the number of bits offset between the MSB of the mantissa
kono
parents:
diff changeset
299 of a float and of a double. Assumes there are only two float types.
kono
parents:
diff changeset
300 (double::FRAC_BITS+double::NGARDS-(float::FRAC_BITS+float::NGARDS))
kono
parents:
diff changeset
301 */
kono
parents:
diff changeset
302 #define F_D_BITOFF (52+8-(23+7))
kono
parents:
diff changeset
303
kono
parents:
diff changeset
304 #ifdef TMODES
kono
parents:
diff changeset
305 # define F_T_BITOFF (__LDBL_MANT_DIG__-1+10-(23+7))
kono
parents:
diff changeset
306 # define D_T_BITOFF (__LDBL_MANT_DIG__-1+10-(52+8))
kono
parents:
diff changeset
307 #endif
kono
parents:
diff changeset
308
kono
parents:
diff changeset
309
kono
parents:
diff changeset
310 #define NORMAL_EXPMIN (-(EXPBIAS)+1)
kono
parents:
diff changeset
311 #define IMPLICIT_1 ((fractype)1<<(FRACBITS+NGARDS))
kono
parents:
diff changeset
312 #define IMPLICIT_2 ((fractype)1<<(FRACBITS+1+NGARDS))
kono
parents:
diff changeset
313
kono
parents:
diff changeset
314 /* common types */
kono
parents:
diff changeset
315
kono
parents:
diff changeset
316 typedef enum
kono
parents:
diff changeset
317 {
kono
parents:
diff changeset
318 CLASS_SNAN,
kono
parents:
diff changeset
319 CLASS_QNAN,
kono
parents:
diff changeset
320 CLASS_ZERO,
kono
parents:
diff changeset
321 CLASS_NUMBER,
kono
parents:
diff changeset
322 CLASS_INFINITY
kono
parents:
diff changeset
323 } fp_class_type;
kono
parents:
diff changeset
324
kono
parents:
diff changeset
325 typedef struct
kono
parents:
diff changeset
326 {
kono
parents:
diff changeset
327 #ifdef SMALL_MACHINE
kono
parents:
diff changeset
328 char class;
kono
parents:
diff changeset
329 unsigned char sign;
kono
parents:
diff changeset
330 short normal_exp;
kono
parents:
diff changeset
331 #else
kono
parents:
diff changeset
332 fp_class_type class;
kono
parents:
diff changeset
333 unsigned int sign;
kono
parents:
diff changeset
334 int normal_exp;
kono
parents:
diff changeset
335 #endif
kono
parents:
diff changeset
336
kono
parents:
diff changeset
337 union
kono
parents:
diff changeset
338 {
kono
parents:
diff changeset
339 fractype ll;
kono
parents:
diff changeset
340 halffractype l[2];
kono
parents:
diff changeset
341 } fraction;
kono
parents:
diff changeset
342 } fp_number_type;
kono
parents:
diff changeset
343
kono
parents:
diff changeset
344 typedef union
kono
parents:
diff changeset
345 {
kono
parents:
diff changeset
346 FLO_type value;
kono
parents:
diff changeset
347 fractype value_raw;
kono
parents:
diff changeset
348
kono
parents:
diff changeset
349 #ifndef FLOAT
kono
parents:
diff changeset
350 # ifdef qrtrfractype
kono
parents:
diff changeset
351 qrtrfractype qwords[4];
kono
parents:
diff changeset
352 # else
kono
parents:
diff changeset
353 halffractype words[2];
kono
parents:
diff changeset
354 # endif
kono
parents:
diff changeset
355 #endif
kono
parents:
diff changeset
356
kono
parents:
diff changeset
357 #ifdef FLOAT_BIT_ORDER_MISMATCH
kono
parents:
diff changeset
358 struct
kono
parents:
diff changeset
359 {
kono
parents:
diff changeset
360 fractype fraction:FRACBITS __attribute__ ((packed));
kono
parents:
diff changeset
361 unsigned int exp:EXPBITS __attribute__ ((packed));
kono
parents:
diff changeset
362 unsigned int sign:1 __attribute__ ((packed));
kono
parents:
diff changeset
363 }
kono
parents:
diff changeset
364 bits;
kono
parents:
diff changeset
365 #endif
kono
parents:
diff changeset
366
kono
parents:
diff changeset
367 #ifdef _DEBUG_BITFLOAT
kono
parents:
diff changeset
368 struct
kono
parents:
diff changeset
369 {
kono
parents:
diff changeset
370 unsigned int sign:1 __attribute__ ((packed));
kono
parents:
diff changeset
371 unsigned int exp:EXPBITS __attribute__ ((packed));
kono
parents:
diff changeset
372 fractype fraction:FRACBITS __attribute__ ((packed));
kono
parents:
diff changeset
373 }
kono
parents:
diff changeset
374 bits_big_endian;
kono
parents:
diff changeset
375
kono
parents:
diff changeset
376 struct
kono
parents:
diff changeset
377 {
kono
parents:
diff changeset
378 fractype fraction:FRACBITS __attribute__ ((packed));
kono
parents:
diff changeset
379 unsigned int exp:EXPBITS __attribute__ ((packed));
kono
parents:
diff changeset
380 unsigned int sign:1 __attribute__ ((packed));
kono
parents:
diff changeset
381 }
kono
parents:
diff changeset
382 bits_little_endian;
kono
parents:
diff changeset
383 #endif
kono
parents:
diff changeset
384 }
kono
parents:
diff changeset
385 FLO_union_type;
kono
parents:
diff changeset
386
kono
parents:
diff changeset
387 /* Prototypes. */
kono
parents:
diff changeset
388
kono
parents:
diff changeset
389 #if defined(L_pack_df) || defined(L_pack_sf) || defined(L_pack_tf)
kono
parents:
diff changeset
390 extern FLO_type pack_d (const fp_number_type *);
kono
parents:
diff changeset
391 #endif
kono
parents:
diff changeset
392
kono
parents:
diff changeset
393 extern void unpack_d (FLO_union_type *, fp_number_type *);
kono
parents:
diff changeset
394
kono
parents:
diff changeset
395 #if defined(L_addsub_sf) || defined(L_addsub_df) || defined(L_addsub_tf)
kono
parents:
diff changeset
396 extern FLO_type add (FLO_type, FLO_type);
kono
parents:
diff changeset
397 extern FLO_type sub (FLO_type, FLO_type);
kono
parents:
diff changeset
398 #endif
kono
parents:
diff changeset
399
kono
parents:
diff changeset
400 #if defined(L_mul_sf) || defined(L_mul_df) || defined(L_mul_tf)
kono
parents:
diff changeset
401 extern FLO_type multiply (FLO_type, FLO_type);
kono
parents:
diff changeset
402 #endif
kono
parents:
diff changeset
403
kono
parents:
diff changeset
404 #if defined(L_div_sf) || defined(L_div_df) || defined(L_div_tf)
kono
parents:
diff changeset
405 extern FLO_type divide (FLO_type, FLO_type);
kono
parents:
diff changeset
406 #endif
kono
parents:
diff changeset
407
kono
parents:
diff changeset
408 extern int __fpcmp_parts (fp_number_type *, fp_number_type *);
kono
parents:
diff changeset
409
kono
parents:
diff changeset
410 #if defined(L_compare_sf) || defined(L_compare_df) || defined(L_compare_tf)
kono
parents:
diff changeset
411 extern CMPtype compare (FLO_type, FLO_type);
kono
parents:
diff changeset
412 #endif
kono
parents:
diff changeset
413
kono
parents:
diff changeset
414 #if defined(L_eq_sf) || defined(L_eq_df) || defined(L_eq_tf)
kono
parents:
diff changeset
415 extern CMPtype _eq_f2 (FLO_type, FLO_type);
kono
parents:
diff changeset
416 #endif
kono
parents:
diff changeset
417
kono
parents:
diff changeset
418 #if defined(L_ne_sf) || defined(L_ne_df) || defined(L_ne_tf)
kono
parents:
diff changeset
419 extern CMPtype _ne_f2 (FLO_type, FLO_type);
kono
parents:
diff changeset
420 #endif
kono
parents:
diff changeset
421
kono
parents:
diff changeset
422 #if defined(L_gt_sf) || defined(L_gt_df) || defined(L_gt_tf)
kono
parents:
diff changeset
423 extern CMPtype _gt_f2 (FLO_type, FLO_type);
kono
parents:
diff changeset
424 #endif
kono
parents:
diff changeset
425
kono
parents:
diff changeset
426 #if defined(L_ge_sf) || defined(L_ge_df) || defined(L_ge_tf)
kono
parents:
diff changeset
427 extern CMPtype _ge_f2 (FLO_type, FLO_type);
kono
parents:
diff changeset
428 #endif
kono
parents:
diff changeset
429
kono
parents:
diff changeset
430 #if defined(L_lt_sf) || defined(L_lt_df) || defined(L_lt_tf)
kono
parents:
diff changeset
431 extern CMPtype _lt_f2 (FLO_type, FLO_type);
kono
parents:
diff changeset
432 #endif
kono
parents:
diff changeset
433
kono
parents:
diff changeset
434 #if defined(L_le_sf) || defined(L_le_df) || defined(L_le_tf)
kono
parents:
diff changeset
435 extern CMPtype _le_f2 (FLO_type, FLO_type);
kono
parents:
diff changeset
436 #endif
kono
parents:
diff changeset
437
kono
parents:
diff changeset
438 #if defined(L_unord_sf) || defined(L_unord_df) || defined(L_unord_tf)
kono
parents:
diff changeset
439 extern CMPtype _unord_f2 (FLO_type, FLO_type);
kono
parents:
diff changeset
440 #endif
kono
parents:
diff changeset
441
kono
parents:
diff changeset
442 #if defined(L_si_to_sf) || defined(L_si_to_df) || defined(L_si_to_tf)
kono
parents:
diff changeset
443 extern FLO_type si_to_float (SItype);
kono
parents:
diff changeset
444 #endif
kono
parents:
diff changeset
445
kono
parents:
diff changeset
446 #if defined(L_sf_to_si) || defined(L_df_to_si) || defined(L_tf_to_si)
kono
parents:
diff changeset
447 extern SItype float_to_si (FLO_type);
kono
parents:
diff changeset
448 #endif
kono
parents:
diff changeset
449
kono
parents:
diff changeset
450 #if defined(L_tf_to_usi)
kono
parents:
diff changeset
451 extern USItype float_to_usi (FLO_type);
kono
parents:
diff changeset
452 #endif
kono
parents:
diff changeset
453
kono
parents:
diff changeset
454 #if defined(L_usi_to_sf) || defined(L_usi_to_df) || defined(L_usi_to_tf)
kono
parents:
diff changeset
455 extern FLO_type usi_to_float (USItype);
kono
parents:
diff changeset
456 #endif
kono
parents:
diff changeset
457
kono
parents:
diff changeset
458 #if defined(L_negate_sf) || defined(L_negate_df) || defined(L_negate_tf)
kono
parents:
diff changeset
459 extern FLO_type negate (FLO_type);
kono
parents:
diff changeset
460 #endif
kono
parents:
diff changeset
461
kono
parents:
diff changeset
462 #ifdef FLOAT
kono
parents:
diff changeset
463 #if defined(L_make_sf)
kono
parents:
diff changeset
464 extern SFtype __make_fp (fp_class_type, unsigned int, int, USItype);
kono
parents:
diff changeset
465 #endif
kono
parents:
diff changeset
466 #ifndef FLOAT_ONLY
kono
parents:
diff changeset
467 extern DFtype __make_dp (fp_class_type, unsigned int, int, UDItype);
kono
parents:
diff changeset
468 #if defined(L_sf_to_df)
kono
parents:
diff changeset
469 extern DFtype sf_to_df (SFtype);
kono
parents:
diff changeset
470 #endif
kono
parents:
diff changeset
471 #if defined(L_sf_to_tf) && defined(TMODES)
kono
parents:
diff changeset
472 extern TFtype sf_to_tf (SFtype);
kono
parents:
diff changeset
473 #endif
kono
parents:
diff changeset
474 #endif /* ! FLOAT_ONLY */
kono
parents:
diff changeset
475 #endif /* FLOAT */
kono
parents:
diff changeset
476
kono
parents:
diff changeset
477 #ifndef FLOAT
kono
parents:
diff changeset
478 extern SFtype __make_fp (fp_class_type, unsigned int, int, USItype);
kono
parents:
diff changeset
479 #if defined(L_make_df)
kono
parents:
diff changeset
480 extern DFtype __make_dp (fp_class_type, unsigned int, int, UDItype);
kono
parents:
diff changeset
481 #endif
kono
parents:
diff changeset
482 #if defined(L_df_to_sf)
kono
parents:
diff changeset
483 extern SFtype df_to_sf (DFtype);
kono
parents:
diff changeset
484 #endif
kono
parents:
diff changeset
485 #if defined(L_df_to_tf) && defined(TMODES)
kono
parents:
diff changeset
486 extern TFtype df_to_tf (DFtype);
kono
parents:
diff changeset
487 #endif
kono
parents:
diff changeset
488 #endif /* ! FLOAT */
kono
parents:
diff changeset
489
kono
parents:
diff changeset
490 #ifdef TMODES
kono
parents:
diff changeset
491 extern DFtype __make_dp (fp_class_type, unsigned int, int, UDItype);
kono
parents:
diff changeset
492 extern TFtype __make_tp (fp_class_type, unsigned int, int, UTItype);
kono
parents:
diff changeset
493 #ifdef TFLOAT
kono
parents:
diff changeset
494 #if defined(L_tf_to_sf)
kono
parents:
diff changeset
495 extern SFtype tf_to_sf (TFtype);
kono
parents:
diff changeset
496 #endif
kono
parents:
diff changeset
497 #if defined(L_tf_to_df)
kono
parents:
diff changeset
498 extern DFtype tf_to_df (TFtype);
kono
parents:
diff changeset
499 #endif
kono
parents:
diff changeset
500 #if defined(L_di_to_tf)
kono
parents:
diff changeset
501 extern TFtype di_to_df (DItype);
kono
parents:
diff changeset
502 #endif
kono
parents:
diff changeset
503 #endif /* TFLOAT */
kono
parents:
diff changeset
504 #endif /* TMODES */
kono
parents:
diff changeset
505
kono
parents:
diff changeset
506 #endif /* ! GCC_FP_BIT_H */