1 /* This is a software floating point library which can be used instead of
2 the floating point routines in libgcc1.c for targets without hardware
4 Copyright (C) 1994, 1995, 1996, 1997, 1998,
5 2000 Free Software Foundation, Inc.
7 This file is free software; you can redistribute it and/or modify it
8 under the terms of the GNU General Public License as published by the
9 Free Software Foundation; either version 2, or (at your option) any
12 In addition to the permissions in the GNU General Public License, the
13 Free Software Foundation gives you unlimited permission to link the
14 compiled version of this file with other programs, and to distribute
15 those programs without any restriction coming from the use of this
16 file. (The General Public License restrictions do apply in other
17 respects; for example, they cover modification of the file, and
18 distribution when not linked into another program.)
20 This file is distributed in the hope that it will be useful, but
21 WITHOUT ANY WARRANTY; without even the implied warranty of
22 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
23 General Public License for more details.
25 You should have received a copy of the GNU General Public License
26 along with this program; see the file COPYING. If not, write to
27 the Free Software Foundation, 59 Temple Place - Suite 330,
28 Boston, MA 02111-1307, USA. */
30 /* As a special exception, if you link this library with other files,
31 some of which are compiled with GCC, to produce an executable,
32 this library does not by itself cause the resulting executable
33 to be covered by the GNU General Public License.
34 This exception does not however invalidate any other reasons why
35 the executable file might be covered by the GNU General Public License. */
37 /* This implements IEEE 754 format arithmetic, but does not provide a
38 mechanism for setting the rounding mode, or for generating or handling
41 The original code by Steve Chamberlain, hacked by Mark Eichin and Jim
42 Wilson, all of Cygnus Support. */
44 /* The intended way to use this file is to make two copies, add `#define FLOAT'
45 to one copy, then compile both copies and add them to libgcc.a. */
49 /* The following macros can be defined to change the behaviour of this file:
50 FLOAT: Implement a `float', aka SFmode, fp library. If this is not
51 defined, then this file implements a `double', aka DFmode, fp library.
52 FLOAT_ONLY: Used with FLOAT, to implement a `float' only library, i.e.
53 don't include float->double conversion which requires the double library.
54 This is useful only for machines which can't support doubles, e.g. some
56 CMPtype: Specify the type that floating point compares should return.
57 This defaults to SItype, aka int.
58 US_SOFTWARE_GOFAST: This makes all entry points use the same names as the
59 US Software goFast library. If this is not defined, the entry points use
60 the same names as libgcc1.c.
61 _DEBUG_BITFLOAT: This makes debugging the code a little easier, by adding
62 two integers to the FLO_union_type.
63 NO_DENORMALS: Disable handling of denormals.
64 NO_NANS: Disable nan and infinity handling
65 SMALL_MACHINE: Useful when operations on QIs and HIs are faster
68 /* We don't currently support extended floats (long doubles) on machines
69 without hardware to deal with them.
71 These stubs are just to keep the linker from complaining about unresolved
72 references which can be pulled in from libio & libstdc++, even if the
73 user isn't using long doubles. However, they may generate an unresolved
74 external to abort if abort is not used by the function, and the stubs
75 are referenced from within libc, since libgcc goes before and after the
78 #ifdef EXTENDED_FLOAT_STUBS
79 __truncxfsf2 (){ abort(); }
80 __extendsfxf2 (){ abort(); }
81 __addxf3 (){ abort(); }
82 __divxf3 (){ abort(); }
83 __eqxf2 (){ abort(); }
84 __extenddfxf2 (){ abort(); }
85 __gtxf2 (){ abort(); }
86 __lexf2 (){ abort(); }
87 __ltxf2 (){ abort(); }
88 __mulxf3 (){ abort(); }
89 __negxf2 (){ abort(); }
90 __nexf2 (){ abort(); }
91 __subxf3 (){ abort(); }
92 __truncxfdf2 (){ abort(); }
94 __trunctfsf2 (){ abort(); }
95 __extendsftf2 (){ abort(); }
96 __addtf3 (){ abort(); }
97 __divtf3 (){ abort(); }
98 __eqtf2 (){ abort(); }
99 __extenddftf2 (){ abort(); }
100 __gttf2 (){ abort(); }
101 __letf2 (){ abort(); }
102 __lttf2 (){ abort(); }
103 __multf3 (){ abort(); }
104 __negtf2 (){ abort(); }
105 __netf2 (){ abort(); }
106 __subtf3 (){ abort(); }
107 __trunctfdf2 (){ abort(); }
108 __gexf2 (){ abort(); }
109 __fixxfsi (){ abort(); }
110 __floatsixf (){ abort(); }
111 #else /* !EXTENDED_FLOAT_STUBS, rest of file */
113 /* IEEE "special" number predicates */
122 #if defined L_thenan_sf
123 const fp_number_type __thenan_sf = { CLASS_SNAN, 0, 0, {(fractype) 0} };
124 #elif defined L_thenan_df
125 const fp_number_type __thenan_df = { CLASS_SNAN, 0, 0, {(fractype) 0} };
127 extern const fp_number_type __thenan_sf;
129 extern const fp_number_type __thenan_df;
133 static fp_number_type *
136 /* Discard the const qualifier... */
138 return (fp_number_type *) (& __thenan_sf);
140 return (fp_number_type *) (& __thenan_df);
146 isnan ( fp_number_type * x)
148 return x->class == CLASS_SNAN || x->class == CLASS_QNAN;
153 isinf ( fp_number_type * x)
155 return x->class == CLASS_INFINITY;
162 iszero ( fp_number_type * x)
164 return x->class == CLASS_ZERO;
169 flip_sign ( fp_number_type * x)
174 extern FLO_type pack_d ( fp_number_type * );
176 #if defined(L_pack_df) || defined(L_pack_sf)
178 pack_d ( fp_number_type * src)
181 fractype fraction = src->fraction.ll; /* wasn't unsigned before? */
182 int sign = src->sign;
188 if (src->class == CLASS_QNAN || 1)
190 fraction |= QUIET_NAN;
193 else if (isinf (src))
198 else if (iszero (src))
203 else if (fraction == 0)
209 if (src->normal_exp < NORMAL_EXPMIN)
211 /* This number's exponent is too low to fit into the bits
212 available in the number, so we'll store 0 in the exponent and
213 shift the fraction to the right to make up for it. */
215 int shift = NORMAL_EXPMIN - src->normal_exp;
219 if (shift > FRAC_NBITS - NGARDS)
221 /* No point shifting, since it's more that 64 out. */
226 int lowbit = (fraction & ((1 << shift) - 1)) ? 1 : 0;
227 fraction = (fraction >> shift) | lowbit;
229 if ((fraction & GARDMASK) == GARDMSB)
231 if ((fraction & (1 << NGARDS)))
232 fraction += GARDROUND + 1;
236 /* Add to the guards to round up. */
237 fraction += GARDROUND;
239 /* Perhaps the rounding means we now need to change the
240 exponent, because the fraction is no longer denormal. */
241 if (fraction >= IMPLICIT_1)
247 else if (src->normal_exp > EXPBIAS)
254 exp = src->normal_exp + EXPBIAS;
255 /* IF the gard bits are the all zero, but the first, then we're
256 half way between two numbers, choose the one which makes the
257 lsb of the answer 0. */
258 if ((fraction & GARDMASK) == GARDMSB)
260 if (fraction & (1 << NGARDS))
261 fraction += GARDROUND + 1;
265 /* Add a one to the guards to round up */
266 fraction += GARDROUND;
268 if (fraction >= IMPLICIT_2)
277 /* We previously used bitfields to store the number, but this doesn't
278 handle little/big endian systems conveniently, so use shifts and
280 #ifdef FLOAT_BIT_ORDER_MISMATCH
281 dst.bits.fraction = fraction;
283 dst.bits.sign = sign;
285 dst.value_raw = fraction & ((((fractype)1) << FRACBITS) - (fractype)1);
286 dst.value_raw |= ((fractype) (exp & ((1 << EXPBITS) - 1))) << FRACBITS;
287 dst.value_raw |= ((fractype) (sign & 1)) << (FRACBITS | EXPBITS);
290 #if defined(FLOAT_WORD_ORDER_MISMATCH) && !defined(FLOAT)
292 halffractype tmp = dst.words[0];
293 dst.words[0] = dst.words[1];
302 #if defined(L_unpack_df) || defined(L_unpack_sf)
304 unpack_d (FLO_union_type * src, fp_number_type * dst)
306 /* We previously used bitfields to store the number, but this doesn't
307 handle little/big endian systems conveniently, so use shifts and
313 #if defined(FLOAT_WORD_ORDER_MISMATCH) && !defined(FLOAT)
314 FLO_union_type swapped;
316 swapped.words[0] = src->words[1];
317 swapped.words[1] = src->words[0];
321 #ifdef FLOAT_BIT_ORDER_MISMATCH
322 fraction = src->bits.fraction;
324 sign = src->bits.sign;
326 fraction = src->value_raw & ((((fractype)1) << FRACBITS) - (fractype)1);
327 exp = ((int)(src->value_raw >> FRACBITS)) & ((1 << EXPBITS) - 1);
328 sign = ((int)(src->value_raw >> (FRACBITS + EXPBITS))) & 1;
334 /* Hmm. Looks like 0 */
341 /* tastes like zero */
342 dst->class = CLASS_ZERO;
346 /* Zero exponent with non zero fraction - it's denormalized,
347 so there isn't a leading implicit one - we'll shift it so
349 dst->normal_exp = exp - EXPBIAS + 1;
352 dst->class = CLASS_NUMBER;
354 while (fraction < IMPLICIT_1)
360 dst->fraction.ll = fraction;
363 else if (exp == EXPMAX)
368 /* Attached to a zero fraction - means infinity */
369 dst->class = CLASS_INFINITY;
373 /* Non zero fraction, means nan */
374 if (fraction & QUIET_NAN)
376 dst->class = CLASS_QNAN;
380 dst->class = CLASS_SNAN;
382 /* Keep the fraction part as the nan number */
383 dst->fraction.ll = fraction;
388 /* Nothing strange about this number */
389 dst->normal_exp = exp - EXPBIAS;
390 dst->class = CLASS_NUMBER;
391 dst->fraction.ll = (fraction << NGARDS) | IMPLICIT_1;
394 #endif /* L_unpack_df || L_unpack_sf */
396 #if defined(L_addsub_sf) || defined(L_addsub_df)
397 static fp_number_type *
398 _fpadd_parts (fp_number_type * a,
400 fp_number_type * tmp)
404 /* Put commonly used fields in local variables. */
420 /* Adding infinities with opposite signs yields a NaN. */
421 if (isinf (b) && a->sign != b->sign)
434 tmp->sign = a->sign & b->sign;
444 /* Got two numbers. shift the smaller and increment the exponent till
449 a_normal_exp = a->normal_exp;
450 b_normal_exp = b->normal_exp;
451 a_fraction = a->fraction.ll;
452 b_fraction = b->fraction.ll;
454 diff = a_normal_exp - b_normal_exp;
458 if (diff < FRAC_NBITS)
460 /* ??? This does shifts one bit at a time. Optimize. */
461 while (a_normal_exp > b_normal_exp)
466 while (b_normal_exp > a_normal_exp)
474 /* Somethings's up.. choose the biggest */
475 if (a_normal_exp > b_normal_exp)
477 b_normal_exp = a_normal_exp;
482 a_normal_exp = b_normal_exp;
488 if (a->sign != b->sign)
492 tfraction = -a_fraction + b_fraction;
496 tfraction = a_fraction - b_fraction;
501 tmp->normal_exp = a_normal_exp;
502 tmp->fraction.ll = tfraction;
507 tmp->normal_exp = a_normal_exp;
508 tmp->fraction.ll = -tfraction;
510 /* and renormalize it */
512 while (tmp->fraction.ll < IMPLICIT_1 && tmp->fraction.ll)
514 tmp->fraction.ll <<= 1;
521 tmp->normal_exp = a_normal_exp;
522 tmp->fraction.ll = a_fraction + b_fraction;
524 tmp->class = CLASS_NUMBER;
525 /* Now the fraction is added, we have to shift down to renormalize the
528 if (tmp->fraction.ll >= IMPLICIT_2)
530 LSHIFT (tmp->fraction.ll);
538 add (FLO_type arg_a, FLO_type arg_b)
544 FLO_union_type au, bu;
552 res = _fpadd_parts (&a, &b, &tmp);
558 sub (FLO_type arg_a, FLO_type arg_b)
564 FLO_union_type au, bu;
574 res = _fpadd_parts (&a, &b, &tmp);
578 #endif /* L_addsub_sf || L_addsub_df */
580 #if defined(L_mul_sf) || defined(L_mul_df)
581 static INLINE fp_number_type *
582 _fpmul_parts ( fp_number_type * a,
584 fp_number_type * tmp)
591 a->sign = a->sign != b->sign;
596 b->sign = a->sign != b->sign;
603 a->sign = a->sign != b->sign;
612 b->sign = a->sign != b->sign;
617 a->sign = a->sign != b->sign;
622 b->sign = a->sign != b->sign;
626 /* Calculate the mantissa by multiplying both 64bit numbers to get a
629 #if defined(NO_DI_MODE)
631 fractype x = a->fraction.ll;
632 fractype ylow = b->fraction.ll;
636 /* ??? This does multiplies one bit at a time. Optimize. */
637 for (bit = 0; bit < FRAC_NBITS; bit++)
643 carry = (low += ylow) < ylow;
644 high += yhigh + carry;
657 /* Multiplying two 32 bit numbers to get a 64 bit number on
658 a machine with DI, so we're safe */
660 DItype answer = (DItype)(a->fraction.ll) * (DItype)(b->fraction.ll);
666 /* Doing a 64*64 to 128 */
668 UDItype nl = a->fraction.ll & 0xffffffff;
669 UDItype nh = a->fraction.ll >> 32;
670 UDItype ml = b->fraction.ll & 0xffffffff;
671 UDItype mh = b->fraction.ll >>32;
672 UDItype pp_ll = ml * nl;
673 UDItype pp_hl = mh * nl;
674 UDItype pp_lh = ml * nh;
675 UDItype pp_hh = mh * nh;
678 UDItype ps_hh__ = pp_hl + pp_lh;
680 res2 += 0x100000000LL;
681 pp_hl = (ps_hh__ << 32) & 0xffffffff00000000LL;
682 res0 = pp_ll + pp_hl;
685 res2 += ((ps_hh__ >> 32) & 0xffffffffL) + pp_hh;
692 tmp->normal_exp = a->normal_exp + b->normal_exp;
693 tmp->sign = a->sign != b->sign;
695 tmp->normal_exp += 2; /* ??????????????? */
697 tmp->normal_exp += 4; /* ??????????????? */
699 while (high >= IMPLICIT_2)
709 while (high < IMPLICIT_1)
718 /* rounding is tricky. if we only round if it won't make us round later. */
722 if (((high & GARDMASK) != GARDMSB)
723 && (((high + 1) & GARDMASK) == GARDMSB))
725 /* don't round, it gets done again later. */
733 if ((high & GARDMASK) == GARDMSB)
735 if (high & (1 << NGARDS))
737 /* half way, so round to even */
738 high += GARDROUND + 1;
742 /* but we really weren't half way */
743 high += GARDROUND + 1;
746 tmp->fraction.ll = high;
747 tmp->class = CLASS_NUMBER;
752 multiply (FLO_type arg_a, FLO_type arg_b)
758 FLO_union_type au, bu;
766 res = _fpmul_parts (&a, &b, &tmp);
770 #endif /* L_mul_sf || L_mul_df */
772 #if defined(L_div_sf) || defined(L_div_df)
773 static INLINE fp_number_type *
774 _fpdiv_parts (fp_number_type * a,
779 fractype denominator;
791 a->sign = a->sign ^ b->sign;
793 if (isinf (a) || iszero (a))
795 if (a->class == b->class)
808 a->class = CLASS_INFINITY;
812 /* Calculate the mantissa by multiplying both 64bit numbers to get a
816 ( numerator / denominator) * 2^(numerator exponent - denominator exponent)
819 a->normal_exp = a->normal_exp - b->normal_exp;
820 numerator = a->fraction.ll;
821 denominator = b->fraction.ll;
823 if (numerator < denominator)
825 /* Fraction will be less than 1.0 */
831 /* ??? Does divide one bit at a time. Optimize. */
834 if (numerator >= denominator)
837 numerator -= denominator;
843 if ((quotient & GARDMASK) == GARDMSB)
845 if (quotient & (1 << NGARDS))
847 /* half way, so round to even */
848 quotient += GARDROUND + 1;
852 /* but we really weren't half way, more bits exist */
853 quotient += GARDROUND + 1;
857 a->fraction.ll = quotient;
863 divide (FLO_type arg_a, FLO_type arg_b)
868 FLO_union_type au, bu;
876 res = _fpdiv_parts (&a, &b);
880 #endif /* L_div_sf || L_div_df */
882 #if defined(L_fpcmp_parts_sf) || defined(L_fpcmp_parts_df)
883 /* according to the demo, fpcmp returns a comparison with 0... thus
890 __fpcmp_parts (fp_number_type * a, fp_number_type * b)
893 /* either nan -> unordered. Must be checked outside of this routine. */
894 if (isnan (a) && isnan (b))
896 return 1; /* still unordered! */
900 if (isnan (a) || isnan (b))
902 return 1; /* how to indicate unordered compare? */
904 if (isinf (a) && isinf (b))
906 /* +inf > -inf, but +inf != +inf */
907 /* b \a| +inf(0)| -inf(1)
908 ______\+--------+--------
909 +inf(0)| a==b(0)| a<b(-1)
910 -------+--------+--------
911 -inf(1)| a>b(1) | a==b(0)
912 -------+--------+--------
913 So since unordered must be non zero, just line up the columns...
915 return b->sign - a->sign;
917 /* but not both... */
920 return a->sign ? -1 : 1;
924 return b->sign ? 1 : -1;
926 if (iszero (a) && iszero (b))
932 return b->sign ? 1 : -1;
936 return a->sign ? -1 : 1;
938 /* now both are "normal". */
939 if (a->sign != b->sign)
942 return a->sign ? -1 : 1;
944 /* same sign; exponents? */
945 if (a->normal_exp > b->normal_exp)
947 return a->sign ? -1 : 1;
949 if (a->normal_exp < b->normal_exp)
951 return a->sign ? 1 : -1;
953 /* same exponents; check size. */
954 if (a->fraction.ll > b->fraction.ll)
956 return a->sign ? -1 : 1;
958 if (a->fraction.ll < b->fraction.ll)
960 return a->sign ? 1 : -1;
962 /* after all that, they're equal. */
967 #if defined(L_compare_sf) || defined(L_compare_df)
969 compare (FLO_type arg_a, FLO_type arg_b)
973 FLO_union_type au, bu;
981 return __fpcmp_parts (&a, &b);
983 #endif /* L_compare_sf || L_compare_df */
985 #ifndef US_SOFTWARE_GOFAST
987 /* These should be optimized for their specific tasks someday. */
989 #if defined(L_eq_sf) || defined(L_eq_df)
991 _eq_f2 (FLO_type arg_a, FLO_type arg_b)
995 FLO_union_type au, bu;
1003 if (isnan (&a) || isnan (&b))
1004 return 1; /* false, truth == 0 */
1006 return __fpcmp_parts (&a, &b) ;
1008 #endif /* L_eq_sf || L_eq_df */
1010 #if defined(L_ne_sf) || defined(L_ne_df)
1012 _ne_f2 (FLO_type arg_a, FLO_type arg_b)
1016 FLO_union_type au, bu;
1024 if (isnan (&a) || isnan (&b))
1025 return 1; /* true, truth != 0 */
1027 return __fpcmp_parts (&a, &b) ;
1029 #endif /* L_ne_sf || L_ne_df */
1031 #if defined(L_gt_sf) || defined(L_gt_df)
1033 _gt_f2 (FLO_type arg_a, FLO_type arg_b)
1037 FLO_union_type au, bu;
1045 if (isnan (&a) || isnan (&b))
1046 return -1; /* false, truth > 0 */
1048 return __fpcmp_parts (&a, &b);
1050 #endif /* L_gt_sf || L_gt_df */
1052 #if defined(L_ge_sf) || defined(L_ge_df)
1054 _ge_f2 (FLO_type arg_a, FLO_type arg_b)
1058 FLO_union_type au, bu;
1066 if (isnan (&a) || isnan (&b))
1067 return -1; /* false, truth >= 0 */
1068 return __fpcmp_parts (&a, &b) ;
1070 #endif /* L_ge_sf || L_ge_df */
1072 #if defined(L_lt_sf) || defined(L_lt_df)
1074 _lt_f2 (FLO_type arg_a, FLO_type arg_b)
1078 FLO_union_type au, bu;
1086 if (isnan (&a) || isnan (&b))
1087 return 1; /* false, truth < 0 */
1089 return __fpcmp_parts (&a, &b);
1091 #endif /* L_lt_sf || L_lt_df */
1093 #if defined(L_le_sf) || defined(L_le_df)
1095 _le_f2 (FLO_type arg_a, FLO_type arg_b)
1099 FLO_union_type au, bu;
1107 if (isnan (&a) || isnan (&b))
1108 return 1; /* false, truth <= 0 */
1110 return __fpcmp_parts (&a, &b) ;
1112 #endif /* L_le_sf || L_le_df */
1114 #if defined(L_unord_sf) || defined(L_unord_df)
1116 _unord_f2 (FLO_type arg_a, FLO_type arg_b)
1120 FLO_union_type au, bu;
1128 return (isnan (&a) || isnan (&b));
1130 #endif /* L_unord_sf || L_unord_df */
1132 #endif /* ! US_SOFTWARE_GOFAST */
1134 #if defined(L_si_to_sf) || defined(L_si_to_df)
1136 si_to_float (SItype arg_a)
1140 in.class = CLASS_NUMBER;
1141 in.sign = arg_a < 0;
1144 in.class = CLASS_ZERO;
1148 in.normal_exp = FRACBITS + NGARDS;
1151 /* Special case for minint, since there is no +ve integer
1152 representation for it */
1153 if (arg_a == (SItype) 0x80000000)
1155 return -2147483648.0;
1157 in.fraction.ll = (-arg_a);
1160 in.fraction.ll = arg_a;
1162 while (in.fraction.ll < (1LL << (FRACBITS + NGARDS)))
1164 in.fraction.ll <<= 1;
1168 return pack_d (&in);
1170 #endif /* L_si_to_sf || L_si_to_df */
1172 #if defined(L_sf_to_si) || defined(L_df_to_si)
1174 float_to_si (FLO_type arg_a)
1187 /* get reasonable MAX_SI_INT... */
1189 return a.sign ? (-MAX_SI_INT)-1 : MAX_SI_INT;
1190 /* it is a number, but a small one */
1191 if (a.normal_exp < 0)
1193 if (a.normal_exp > 30)
1194 return a.sign ? (-MAX_SI_INT)-1 : MAX_SI_INT;
1195 tmp = a.fraction.ll >> ((FRACBITS + NGARDS) - a.normal_exp);
1196 return a.sign ? (-tmp) : (tmp);
1198 #endif /* L_sf_to_si || L_df_to_si */
1200 #if defined(L_sf_to_usi) || defined(L_df_to_usi)
1201 #ifdef US_SOFTWARE_GOFAST
1202 /* While libgcc2.c defines its own __fixunssfsi and __fixunsdfsi routines,
1203 we also define them for GOFAST because the ones in libgcc2.c have the
1204 wrong names and I'd rather define these here and keep GOFAST CYG-LOC's
1205 out of libgcc2.c. We can't define these here if not GOFAST because then
1206 there'd be duplicate copies. */
1209 float_to_usi (FLO_type arg_a)
1221 /* it is a negative number */
1224 /* get reasonable MAX_USI_INT... */
1227 /* it is a number, but a small one */
1228 if (a.normal_exp < 0)
1230 if (a.normal_exp > 31)
1232 else if (a.normal_exp > (FRACBITS + NGARDS))
1233 return a.fraction.ll << (a.normal_exp - (FRACBITS + NGARDS));
1235 return a.fraction.ll >> ((FRACBITS + NGARDS) - a.normal_exp);
1237 #endif /* US_SOFTWARE_GOFAST */
1238 #endif /* L_sf_to_usi || L_df_to_usi */
1240 #if defined(L_negate_sf) || defined(L_negate_df)
1242 negate (FLO_type arg_a)
1253 #endif /* L_negate_sf || L_negate_df */
1257 #if defined(L_make_sf)
1259 __make_fp(fp_class_type class,
1268 in.normal_exp = exp;
1269 in.fraction.ll = frac;
1270 return pack_d (&in);
1272 #endif /* L_make_sf */
1276 /* This enables one to build an fp library that supports float but not double.
1277 Otherwise, we would get an undefined reference to __make_dp.
1278 This is needed for some 8-bit ports that can't handle well values that
1279 are 8-bytes in size, so we just don't support double for them at all. */
1281 #if defined(L_sf_to_df)
1283 sf_to_df (SFtype arg_a)
1289 unpack_d (&au, &in);
1291 return __make_dp (in.class, in.sign, in.normal_exp,
1292 ((UDItype) in.fraction.ll) << F_D_BITOFF);
1294 #endif /* L_sf_to_df */
1296 #endif /* ! FLOAT_ONLY */
1301 extern SFtype __make_fp (fp_class_type, unsigned int, int, USItype);
1303 #if defined(L_make_df)
1305 __make_dp (fp_class_type class, unsigned int sign, int exp, UDItype frac)
1311 in.normal_exp = exp;
1312 in.fraction.ll = frac;
1313 return pack_d (&in);
1315 #endif /* L_make_df */
1317 #if defined(L_df_to_sf)
1319 df_to_sf (DFtype arg_a)
1326 unpack_d (&au, &in);
1328 sffrac = in.fraction.ll >> F_D_BITOFF;
1330 /* We set the lowest guard bit in SFFRAC if we discarded any non
1332 if ((in.fraction.ll & (((USItype) 1 << F_D_BITOFF) - 1)) != 0)
1335 return __make_fp (in.class, in.sign, in.normal_exp, sffrac);
1337 #endif /* L_df_to_sf */
1339 #endif /* ! FLOAT */
1340 #endif /* !EXTENDED_FLOAT_STUBS */