OSDN Git Service

* config/i386/i386.c (register_move_cost): Remove accidentally comitted
[pf3gnuchains/gcc-fork.git] / gcc / config / dfp-bit.h
1 /* Header file for dfp-bit.c.
2    Copyright (C) 2005, 2006, 2007 Free Software Foundation, Inc.
3
4 This file is part of GCC.
5
6 GCC is free software; you can redistribute it and/or modify it under
7 the terms of the GNU General Public License as published by the Free
8 Software Foundation; either version 2, or (at your option) any later
9 version.
10
11 In addition to the permissions in the GNU General Public License, the
12 Free Software Foundation gives you unlimited permission to link the
13 compiled version of this file into combinations with other programs,
14 and to distribute those combinations without any restriction coming
15 from the use of this file.  (The General Public License restrictions
16 do apply in other respects; for example, they cover modification of
17 the file, and distribution when not linked into a combine
18 executable.)
19
20 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
21 WARRANTY; without even the implied warranty of MERCHANTABILITY or
22 FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
23 for more details.
24
25 You should have received a copy of the GNU General Public License
26 along with GCC; see the file COPYING.  If not, write to the Free
27 Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
28 02110-1301, USA.  */
29
30 #ifndef _DFPBIT_H
31 #define _DFPBIT_H
32
33 #include <fenv.h>
34 #include <decRound.h>
35 #include <decExcept.h>
36 #include "tconfig.h"
37 #include "coretypes.h"
38 #include "tm.h"
39
40 #ifndef LIBGCC2_WORDS_BIG_ENDIAN
41 #define LIBGCC2_WORDS_BIG_ENDIAN WORDS_BIG_ENDIAN
42 #endif
43
44 #ifndef LIBGCC2_FLOAT_WORDS_BIG_ENDIAN
45 #define LIBGCC2_FLOAT_WORDS_BIG_ENDIAN LIBGCC2_WORDS_BIG_ENDIAN
46 #endif
47
48 #ifndef LIBGCC2_LONG_DOUBLE_TYPE_SIZE
49 #define LIBGCC2_LONG_DOUBLE_TYPE_SIZE LONG_DOUBLE_TYPE_SIZE
50 #endif
51
52 #ifndef LIBGCC2_HAS_XF_MODE
53 #define LIBGCC2_HAS_XF_MODE \
54   (BITS_PER_UNIT == 8 && LIBGCC2_LONG_DOUBLE_TYPE_SIZE == 80)
55 #endif
56
57 /* Depending on WIDTH, define a number of macros:
58
59    DFP_C_TYPE: type of the arguments to the libgcc functions;
60         (eg _Decimal32)
61
62    IEEE_TYPE: the corresponding (encoded) IEEE754R type;
63         (eg decimal32)
64    
65    TO_INTERNAL: the name of the decNumber function to convert an
66    encoded value into the decNumber internal representation;
67
68    TO_ENCODED: the name of the decNumber function to convert an
69    internally represented decNumber into the encoded
70    representation.
71
72    FROM_STRING: the name of the decNumber function to read an
73    encoded value from a string.
74
75    TO_STRING: the name of the decNumber function to write an
76    encoded value to a string.  */
77
78 #if WIDTH == 32
79 #define DFP_C_TYPE      _Decimal32
80 #define IEEE_TYPE       decimal32
81 #define HOST_TO_IEEE    __host_to_ieee_32
82 #define IEEE_TO_HOST    __ieee_to_host_32
83 #define TO_INTERNAL     __decimal32ToNumber
84 #define TO_ENCODED      __decimal32FromNumber
85 #define FROM_STRING     __decimal32FromString
86 #define TO_STRING       __decimal32ToString
87 #elif WIDTH == 64
88 #define DFP_C_TYPE      _Decimal64
89 #define IEEE_TYPE       decimal64
90 #define HOST_TO_IEEE    __host_to_ieee_64
91 #define IEEE_TO_HOST    __ieee_to_host_64
92 #define TO_INTERNAL     __decimal64ToNumber
93 #define TO_ENCODED      __decimal64FromNumber
94 #define FROM_STRING     __decimal64FromString
95 #define TO_STRING       __decimal64ToString
96 #elif WIDTH == 128
97 #define DFP_C_TYPE      _Decimal128
98 #define IEEE_TYPE       decimal128
99 #define HOST_TO_IEEE    __host_to_ieee_128
100 #define IEEE_TO_HOST    __ieee_to_host_128
101 #define TO_INTERNAL     __decimal128ToNumber
102 #define TO_ENCODED      __decimal128FromNumber
103 #define FROM_STRING     __decimal128FromString
104 #define TO_STRING       __decimal128ToString
105 #else
106 #error invalid decimal float word width
107 #endif
108
109 /* We define __DEC_EVAL_METHOD__ to 2, saying that we evaluate all
110    operations and constants to the range and precision of the _Decimal128
111    type.  Make it so.  */
112 #if WIDTH == 32
113 #define CONTEXT_INIT DEC_INIT_DECIMAL32
114 #elif WIDTH == 64
115 #define CONTEXT_INIT DEC_INIT_DECIMAL64
116 #elif WIDTH == 128
117 #define CONTEXT_INIT DEC_INIT_DECIMAL128
118 #endif
119
120 #ifndef DFP_INIT_ROUNDMODE
121 #define DFP_INIT_ROUNDMODE(A) A = DEC_ROUND_HALF_EVEN
122 #endif
123
124 #ifdef DFP_EXCEPTIONS_ENABLED
125 /* Return IEEE exception flags based on decNumber status flags.  */
126 #define DFP_IEEE_FLAGS(DEC_FLAGS) __extension__                 \
127 ({int _fe_flags = 0;                                            \
128   if ((dec_flags & DEC_IEEE_854_Division_by_zero) != 0)         \
129     _fe_flags |= FE_DIVBYZERO;                                  \
130   if ((dec_flags & DEC_IEEE_854_Inexact) != 0)                  \
131     _fe_flags |= FE_INEXACT;                                    \
132   if ((dec_flags & DEC_IEEE_854_Invalid_operation) != 0)        \
133     _fe_flags |= FE_INVALID;                                    \
134   if ((dec_flags & DEC_IEEE_854_Overflow) != 0)                 \
135     _fe_flags |= FE_OVERFLOW;                                   \
136   if ((dec_flags & DEC_IEEE_854_Underflow) != 0)                \
137     _fe_flags |= FE_UNDERFLOW;                                  \
138   _fe_flags; })
139 #else
140 #define DFP_EXCEPTIONS_ENABLED 0
141 #define DFP_IEEE_FLAGS(A) 0
142 #define DFP_HANDLE_EXCEPTIONS(A) do {} while (0)
143 #endif
144
145 /* Conversions between different decimal float types use WIDTH_TO to
146    determine additional macros to define.  */
147
148 #if defined (L_dd_to_sd) || defined (L_td_to_sd)
149 #define WIDTH_TO 32
150 #elif defined (L_sd_to_dd) || defined (L_td_to_dd)
151 #define WIDTH_TO 64
152 #elif defined (L_sd_to_td) || defined (L_dd_to_td)
153 #define WIDTH_TO 128
154 #endif
155
156 /* If WIDTH_TO is defined, define additional macros:
157
158    DFP_C_TYPE_TO: type of the result of dfp to dfp conversion.
159
160    IEEE_TYPE_TO: the corresponding (encoded) IEEE754R type.
161
162    TO_ENCODED_TO: the name of the decNumber function to convert an
163    internally represented decNumber into the encoded representation
164    for the destination.  */
165
166 #if WIDTH_TO == 32
167 #define DFP_C_TYPE_TO   _Decimal32
168 #define IEEE_TYPE_TO    decimal32
169 #define TO_ENCODED_TO   __decimal32FromNumber
170 #define IEEE_TO_HOST_TO __ieee_to_host_32
171 #elif WIDTH_TO == 64
172 #define DFP_C_TYPE_TO   _Decimal64
173 #define IEEE_TYPE_TO    decimal64
174 #define TO_ENCODED_TO   __decimal64FromNumber
175 #define IEEE_TO_HOST_TO __ieee_to_host_64
176 #elif WIDTH_TO == 128
177 #define DFP_C_TYPE_TO   _Decimal128
178 #define IEEE_TYPE_TO    decimal128
179 #define TO_ENCODED_TO   __decimal128FromNumber
180 #define IEEE_TO_HOST_TO __ieee_to_host_128
181 #endif
182
183 /* Conversions between decimal float types and integral types use INT_KIND
184    to determine the data type and C functions to use.  */
185
186 #if defined (L_sd_to_si) || defined (L_dd_to_si) || defined (L_td_to_si)  \
187    || defined (L_si_to_sd) || defined (L_si_to_dd) || defined (L_si_to_td)
188 #define INT_KIND 1
189 #elif defined (L_sd_to_di) || defined (L_dd_to_di) || defined (L_td_to_di) \
190    || defined (L_di_to_sd) || defined (L_di_to_dd) || defined (L_di_to_td)
191 #define INT_KIND 2
192 #elif defined (L_sd_to_usi) || defined (L_dd_to_usi) || defined (L_td_to_usi) \
193    || defined (L_usi_to_sd) || defined (L_usi_to_dd) || defined (L_usi_to_td)
194 #define INT_KIND 3
195 #elif defined (L_sd_to_udi) || defined (L_dd_to_udi) || defined (L_td_to_udi) \
196    || defined (L_udi_to_sd) || defined (L_udi_to_dd) || defined (L_udi_to_td)
197 #define INT_KIND 4
198 #endif
199
200 /*  If INT_KIND is defined, define additional macros:
201
202     INT_TYPE: The integer data type.
203
204     INT_FMT: The format string for writing the integer to a string.
205
206     CAST_FOR_FMT: Cast variable of INT_KIND to C type for sprintf.
207     This works for ILP32 and LP64, won't for other type size systems.
208
209     STR_TO_INT: The function to read the integer from a string.  */
210
211 #if INT_KIND == 1
212 #define INT_TYPE SItype
213 #define INT_FMT "%d"
214 #define CAST_FOR_FMT(A) (int)A
215 #define STR_TO_INT strtol
216 #elif INT_KIND == 2
217 #define INT_TYPE DItype
218 #define INT_FMT "%lld"
219 #define CAST_FOR_FMT(A) (long long)A
220 #define STR_TO_INT strtoll
221 #elif INT_KIND == 3
222 #define INT_TYPE USItype
223 #define INT_FMT "%u"
224 #define CAST_FOR_FMT(A) (unsigned int)A
225 #define STR_TO_INT strtoul
226 #elif INT_KIND == 4
227 #define INT_TYPE UDItype
228 #define INT_FMT "%llu"
229 #define CAST_FOR_FMT(A) (unsigned long long)A
230 #define STR_TO_INT strtoull
231 #endif
232
233 /* Conversions between decimal float types and binary float types use
234    BFP_KIND to determine the data type and C functions to use.  */
235
236 #if defined (L_sd_to_sf) || defined (L_dd_to_sf) || defined (L_td_to_sf) \
237  || defined (L_sf_to_sd) || defined (L_sf_to_dd) || defined (L_sf_to_td)
238 #define BFP_KIND 1
239 #elif defined (L_sd_to_df) || defined (L_dd_to_df ) || defined (L_td_to_df) \
240  ||   defined (L_df_to_sd) || defined (L_df_to_dd) || defined (L_df_to_td)
241 #define BFP_KIND 2
242 #elif defined (L_sd_to_xf) || defined (L_dd_to_xf ) || defined (L_td_to_xf) \
243  ||   defined (L_xf_to_sd) || defined (L_xf_to_dd) || defined (L_xf_to_td)
244 #define BFP_KIND 3
245 #endif
246
247 /*  If BFP_KIND is defined, define additional macros:
248
249     BFP_TYPE: The binary floating point data type.
250
251     BFP_FMT: The format string for writing the value to a string.
252
253     STR_TO_BFP: The function to read the value from a string.  */
254
255 #if BFP_KIND == 1
256 /* strtof is declared in <stdlib.h> only for C99.  */
257 extern float strtof (const char *, char **);
258 #define BFP_TYPE SFtype
259 #define BFP_FMT "%e"
260 #define STR_TO_BFP strtof
261
262 #elif BFP_KIND == 2
263 #define BFP_TYPE DFtype
264 #define BFP_FMT "%e"
265 #define STR_TO_BFP strtod
266
267 #elif BFP_KIND == 3
268 #if LIBGCC2_HAS_XF_MODE
269 /* These aren't used if XF mode is not supported.  */
270 #define BFP_TYPE XFtype
271 #define BFP_FMT "%e"
272 #define BFP_VIA_TYPE double
273 #define STR_TO_BFP strtod
274 #endif
275
276 #endif /* BFP_KIND */
277
278 #if WIDTH == 128 || WIDTH_TO == 128
279 #include "decimal128.h"
280 #endif
281 #if WIDTH == 64 || WIDTH_TO == 64
282 #include "decimal64.h"
283 #endif
284 #if WIDTH == 32 || WIDTH_TO == 32
285 #include "decimal32.h"
286 #endif
287 #include "decNumber.h"
288
289 /* Names of arithmetic functions.  */
290
291 #if ENABLE_DECIMAL_BID_FORMAT
292 #define DPD_BID_NAME(DPD,BID) BID
293 #else
294 #define DPD_BID_NAME(DPD,BID) DPD
295 #endif
296
297 #if WIDTH == 32
298 #define DFP_ADD         DPD_BID_NAME(__dpd_addsd3,__bid_addsd3)
299 #define DFP_SUB         DPD_BID_NAME(__dpd_subsd3,__bid_subsd3)
300 #define DFP_MULTIPLY    DPD_BID_NAME(__dpd_mulsd3,__bid_mulsd3)
301 #define DFP_DIVIDE      DPD_BID_NAME(__dpd_divsd3,__bid_divsd3)
302 #define DFP_EQ          DPD_BID_NAME(__dpd_eqsd2,__bid_eqsd2)
303 #define DFP_NE          DPD_BID_NAME(__dpd_nesd2,__bid_nesd2)
304 #define DFP_LT          DPD_BID_NAME(__dpd_ltsd2,__bid_ltsd2)
305 #define DFP_GT          DPD_BID_NAME(__dpd_gtsd2,__bid_gtsd2)
306 #define DFP_LE          DPD_BID_NAME(__dpd_lesd2,__bid_lesd2)
307 #define DFP_GE          DPD_BID_NAME(__dpd_gesd2,__bid_gesd2)
308 #define DFP_UNORD       DPD_BID_NAME(__dpd_unordsd2,__bid_unordsd2)
309 #elif WIDTH == 64
310 #define DFP_ADD         DPD_BID_NAME(__dpd_adddd3,__bid_adddd3)
311 #define DFP_SUB         DPD_BID_NAME(__dpd_subdd3,__bid_subdd3)
312 #define DFP_MULTIPLY    DPD_BID_NAME(__dpd_muldd3,__bid_muldd3)
313 #define DFP_DIVIDE      DPD_BID_NAME(__dpd_divdd3,__bid_divdd3)
314 #define DFP_EQ          DPD_BID_NAME(__dpd_eqdd2,__bid_eqdd2)
315 #define DFP_NE          DPD_BID_NAME(__dpd_nedd2,__bid_nedd2)
316 #define DFP_LT          DPD_BID_NAME(__dpd_ltdd2,__bid_ltdd2)
317 #define DFP_GT          DPD_BID_NAME(__dpd_gtdd2,__bid_gtdd2)
318 #define DFP_LE          DPD_BID_NAME(__dpd_ledd2,__bid_ledd2)
319 #define DFP_GE          DPD_BID_NAME(__dpd_gedd2,__bid_gedd2)
320 #define DFP_UNORD       DPD_BID_NAME(__dpd_unorddd2,__bid_unorddd2)
321 #elif WIDTH == 128
322 #define DFP_ADD         DPD_BID_NAME(__dpd_addtd3,__bid_addtd3)
323 #define DFP_SUB         DPD_BID_NAME(__dpd_subtd3,__bid_subtd3)
324 #define DFP_MULTIPLY    DPD_BID_NAME(__dpd_multd3,__bid_multd3)
325 #define DFP_DIVIDE      DPD_BID_NAME(__dpd_divtd3,__bid_divtd3)
326 #define DFP_EQ          DPD_BID_NAME(__dpd_eqtd2,__bid_eqtd2)
327 #define DFP_NE          DPD_BID_NAME(__dpd_netd2,__bid_netd2)
328 #define DFP_LT          DPD_BID_NAME(__dpd_lttd2,__bid_lttd2)
329 #define DFP_GT          DPD_BID_NAME(__dpd_gttd2,__bid_gttd2)
330 #define DFP_LE          DPD_BID_NAME(__dpd_letd2,__bid_letd2)
331 #define DFP_GE          DPD_BID_NAME(__dpd_getd2,__bid_getd2)
332 #define DFP_UNORD       DPD_BID_NAME(__dpd_unordtd2,__bid_unordtd2)
333 #endif
334
335 /* Names of functions to convert between different decimal float types.  */
336
337 #if WIDTH == 32
338 #if WIDTH_TO == 64
339 #define DFP_TO_DFP      DPD_BID_NAME(__dpd_extendsddd2,__bid_extendsddd2)
340 #elif WIDTH_TO == 128
341 #define DFP_TO_DFP      DPD_BID_NAME(__dpd_extendsdtd2,__bid_extendsdtd2)
342 #endif
343 #elif WIDTH == 64       
344 #if WIDTH_TO == 32
345 #define DFP_TO_DFP      DPD_BID_NAME(__dpd_truncddsd2,__bid_truncddsd2)
346 #elif WIDTH_TO == 128
347 #define DFP_TO_DFP      DPD_BID_NAME(__dpd_extendddtd2,__bid_extendddtd2)
348 #endif
349 #elif WIDTH == 128
350 #if WIDTH_TO == 32
351 #define DFP_TO_DFP      DPD_BID_NAME(__dpd_trunctdsd2,__bid_trunctdsd2)
352 #elif WIDTH_TO == 64
353 #define DFP_TO_DFP      DPD_BID_NAME(__dpd_trunctddd2,__bid_trunctddd2)
354 #endif
355 #endif
356
357 /* Names of functions to convert between decimal float and integers.  */
358
359 #if WIDTH == 32
360 #if INT_KIND == 1
361 #define INT_TO_DFP      DPD_BID_NAME(__dpd_floatsisd,__bid_floatsisd)
362 #define DFP_TO_INT      DPD_BID_NAME(__dpd_fixsdsi,__bid_fixsdsi)
363 #elif INT_KIND == 2
364 #define INT_TO_DFP      DPD_BID_NAME(__dpd_floatdisd,__bid_floatdisd)
365 #define DFP_TO_INT      DPD_BID_NAME(__dpd_fixsddi,__bid_fixsddi)
366 #elif INT_KIND == 3
367 #define INT_TO_DFP      DPD_BID_NAME(__dpd_floatunssisd,__bid_floatunssisd)
368 #define DFP_TO_INT      DPD_BID_NAME(__dpd_fixunssdsi,__bid_fixunssdsi)
369 #elif INT_KIND == 4
370 #define INT_TO_DFP      DPD_BID_NAME(__dpd_floatunsdisd,__bid_floatunsdisd)
371 #define DFP_TO_INT      DPD_BID_NAME(__dpd_fixunssddi,__bid_fixunssddi)
372 #endif
373 #elif WIDTH == 64
374 #if INT_KIND == 1
375 #define INT_TO_DFP      DPD_BID_NAME(__dpd_floatsidd,__bid_floatsidd)
376 #define DFP_TO_INT      DPD_BID_NAME(__dpd_fixddsi,__bid_fixddsi)
377 #elif INT_KIND == 2
378 #define INT_TO_DFP      DPD_BID_NAME(__dpd_floatdidd,__bid_floatdidd)
379 #define DFP_TO_INT      DPD_BID_NAME(__dpd_fixdddi,__bid_fixdddi)
380 #elif INT_KIND == 3
381 #define INT_TO_DFP      DPD_BID_NAME(__dpd_floatunssidd,__bid_floatunssidd)
382 #define DFP_TO_INT      DPD_BID_NAME(__dpd_fixunsddsi,__bid_fixunsddsi)
383 #elif INT_KIND == 4
384 #define INT_TO_DFP      DPD_BID_NAME(__dpd_floatunsdidd,__bid_floatunsdidd)
385 #define DFP_TO_INT      DPD_BID_NAME(__dpd_fixunsdddi,__bid_fixunsdddi)
386 #endif
387 #elif WIDTH == 128
388 #if INT_KIND == 1
389 #define INT_TO_DFP      DPD_BID_NAME(__dpd_floatsitd,__bid_floatsitd)
390 #define DFP_TO_INT      DPD_BID_NAME(__dpd_fixtdsi,__bid_fixtdsi)
391 #elif INT_KIND == 2
392 #define INT_TO_DFP      DPD_BID_NAME(__dpd_floatditd,__bid_floatditd)
393 #define DFP_TO_INT      DPD_BID_NAME(__dpd_fixtddi,__bid_fixtddi)
394 #elif INT_KIND == 3
395 #define INT_TO_DFP      DPD_BID_NAME(__dpd_floatunssitd,__bid_floatunssitd)
396 #define DFP_TO_INT      DPD_BID_NAME(__dpd_fixunstdsi,__bid_fixunstdsi)
397 #elif INT_KIND == 4
398 #define INT_TO_DFP      DPD_BID_NAME(__dpd_floatunsditd,__bid_floatunsditd)
399 #define DFP_TO_INT      DPD_BID_NAME(__dpd_fixunstddi,__bid_fixunstddi)
400 #endif
401 #endif
402
403 /* Names of functions to convert between decimal float and binary float.  */
404
405 #if WIDTH == 32
406 #if BFP_KIND == 1
407 #define BFP_TO_DFP      DPD_BID_NAME(__dpd_extendsfsd,__bid_extendsfsd)
408 #define DFP_TO_BFP      DPD_BID_NAME(__dpd_truncsdsf,__bid_truncsdsf)
409 #elif BFP_KIND == 2
410 #define BFP_TO_DFP      DPD_BID_NAME(__dpd_truncdfsd,__bid_truncdfsd)
411 #define DFP_TO_BFP      DPD_BID_NAME(__dpd_extendsddf,__bid_extendsddf)
412 #elif BFP_KIND == 3
413 #define BFP_TO_DFP      DPD_BID_NAME(__dpd_truncxfsd,__bid_truncxfsd)
414 #define DFP_TO_BFP      DPD_BID_NAME(__dpd_extendsdxf,__bid_extendsdxf)
415 #endif /* BFP_KIND */
416
417 #elif WIDTH == 64
418 #if BFP_KIND == 1
419 #define BFP_TO_DFP      DPD_BID_NAME(__dpd_extendsfdd,__bid_extendsfdd)
420 #define DFP_TO_BFP      DPD_BID_NAME(__dpd_truncddsf,__bid_truncddsf)
421 #elif BFP_KIND == 2
422 #define BFP_TO_DFP      DPD_BID_NAME(__dpd_extenddfdd,__bid_extenddfdd)
423 #define DFP_TO_BFP      DPD_BID_NAME(__dpd_truncdddf,__bid_truncdddf)
424 #elif BFP_KIND == 3
425 #define BFP_TO_DFP      DPD_BID_NAME(__dpd_truncxfdd,__bid_truncxfdd)
426 #define DFP_TO_BFP      DPD_BID_NAME(__dpd_extendddxf,__bid_extendddxf)
427 #endif /* BFP_KIND */
428
429 #elif WIDTH == 128
430 #if BFP_KIND == 1
431 #define BFP_TO_DFP      DPD_BID_NAME(__dpd_extendsftd,__bid_extendsftd)
432 #define DFP_TO_BFP      DPD_BID_NAME(__dpd_trunctdsf,__bid_trunctdsf)
433 #elif BFP_KIND == 2
434 #define BFP_TO_DFP      DPD_BID_NAME(__dpd_extenddftd,__bid_extenddftd)
435 #define DFP_TO_BFP      DPD_BID_NAME(__dpd_trunctddf,__bid_trunctddf)
436 #elif BFP_KIND == 3
437 #define BFP_TO_DFP      DPD_BID_NAME(__dpd_extendxftd,__bid_extendxftd)
438 #define DFP_TO_BFP      DPD_BID_NAME(__dpd_trunctdxf,__bid_trunctdxf)
439 #endif /* BFP_KIND */
440
441 #endif /* WIDTH */
442
443 /* Some handy typedefs.  */
444
445 typedef float SFtype __attribute__ ((mode (SF)));
446 typedef float DFtype __attribute__ ((mode (DF)));
447 #if LIBGCC2_HAS_XF_MODE
448 typedef float XFtype __attribute__ ((mode (XF)));
449 #endif /* LIBGCC2_HAS_XF_MODE */
450
451 typedef int SItype __attribute__ ((mode (SI)));
452 typedef int DItype __attribute__ ((mode (DI)));
453 typedef unsigned int USItype __attribute__ ((mode (SI)));
454 typedef unsigned int UDItype __attribute__ ((mode (DI)));
455
456 /* The type of the result of a decimal float comparison.  This must
457    match `word_mode' in GCC for the target.  */
458
459 typedef int CMPtype __attribute__ ((mode (word)));
460
461 /* Prototypes.  */
462
463 #if defined (L_mul_sd) || defined (L_mul_dd) || defined (L_mul_td)
464 extern DFP_C_TYPE DFP_MULTIPLY (DFP_C_TYPE, DFP_C_TYPE);
465 #endif
466
467 #if defined (L_div_sd) || defined (L_div_dd) || defined (L_div_td)
468 extern DFP_C_TYPE DFP_DIVIDE (DFP_C_TYPE, DFP_C_TYPE);
469 #endif
470
471 #if defined (L_addsub_sd) || defined (L_addsub_dd) || defined (L_addsub_td)
472 extern DFP_C_TYPE DFP_ADD (DFP_C_TYPE, DFP_C_TYPE);
473 extern DFP_C_TYPE DFP_SUB (DFP_C_TYPE, DFP_C_TYPE);
474 #endif
475
476 #if defined (L_eq_sd) || defined (L_eq_dd) || defined (L_eq_td)
477 extern CMPtype DFP_EQ (DFP_C_TYPE, DFP_C_TYPE);
478 #endif
479
480 #if defined (L_ne_sd) || defined (L_ne_dd) || defined (L_ne_td)
481 extern CMPtype DFP_NE (DFP_C_TYPE, DFP_C_TYPE);
482 #endif
483
484 #if defined (L_lt_sd) || defined (L_lt_dd) || defined (L_lt_td)
485 extern CMPtype DFP_LT (DFP_C_TYPE, DFP_C_TYPE);
486 #endif
487
488 #if defined (L_gt_sd) || defined (L_gt_dd) || defined (L_gt_td)
489 extern CMPtype DFP_GT (DFP_C_TYPE, DFP_C_TYPE);
490 #endif
491
492 #if defined (L_le_sd) || defined (L_le_dd) || defined (L_le_td)
493 extern CMPtype DFP_LE (DFP_C_TYPE, DFP_C_TYPE);
494 #endif
495
496 #if defined (L_ge_sd) || defined (L_ge_dd) || defined (L_ge_td)
497 extern CMPtype DFP_GE (DFP_C_TYPE, DFP_C_TYPE);
498 #endif
499
500 #if defined (L_unord_sd) || defined (L_unord_dd) || defined (L_unord_td)
501 extern CMPtype DFP_UNORD (DFP_C_TYPE, DFP_C_TYPE);
502 #endif
503
504 #if defined (L_sd_to_dd) || defined (L_sd_to_td) || defined (L_dd_to_sd) \
505  || defined (L_dd_to_td) || defined (L_td_to_sd) || defined (L_td_to_dd)
506 extern DFP_C_TYPE_TO DFP_TO_DFP (DFP_C_TYPE);
507 #endif
508
509 #if defined (L_sd_to_si) || defined (L_dd_to_si) || defined (L_td_to_si) \
510  || defined (L_sd_to_di) || defined (L_dd_to_di) || defined (L_td_to_di) \
511  || defined (L_sd_to_usi) || defined (L_dd_to_usi) || defined (L_td_to_usi) \
512  || defined (L_sd_to_udi) || defined (L_dd_to_udi) || defined (L_td_to_udi)
513 extern INT_TYPE DFP_TO_INT (DFP_C_TYPE);
514 #endif
515
516 #if defined (L_si_to_sd) || defined (L_si_to_dd) || defined (L_si_to_td) \
517  || defined (L_di_to_sd) || defined (L_di_to_dd) || defined (L_di_to_td) \
518  || defined (L_usi_to_sd) || defined (L_usi_to_dd) || defined (L_usi_to_td) \
519  || defined (L_udi_to_sd) || defined (L_udi_to_dd) || defined (L_udi_to_td)
520 extern DFP_C_TYPE INT_TO_DFP (INT_TYPE);
521 #endif
522
523 #if defined (L_sd_to_sf) || defined (L_dd_to_sf) || defined (L_td_to_sf) \
524  || defined (L_sd_to_df) || defined (L_dd_to_df) || defined (L_td_to_df) \
525  || ((defined (L_sd_to_xf) || defined (L_dd_to_xf) || defined (L_td_to_xf)) \
526      && LIBGCC2_HAS_XF_MODE)
527 extern BFP_TYPE DFP_TO_BFP (DFP_C_TYPE);
528 #endif
529
530 #if defined (L_sf_to_sd) || defined (L_sf_to_dd) || defined (L_sf_to_td) \
531  || defined (L_df_to_sd) || defined (L_df_to_dd) || defined (L_df_to_td) \
532  || ((defined (L_xf_to_sd) || defined (L_xf_to_dd) || defined (L_xf_to_td)) \
533      && LIBGCC2_HAS_XF_MODE)
534 extern DFP_C_TYPE BFP_TO_DFP (BFP_TYPE);
535 #endif
536
537 #endif /* _DFPBIT_H */