Next:Routines for decimal floating point emulation, Previous:Routines for integer arithmetic, Up:The GCC low-level runtime library [Contents][Index]
The software floating point library is used on machines which do nothave hardware support for floating point. It is also used whenever-msoft-float is used to disable generation of floating pointinstructions. (Not all targets support this switch.)
For compatibility with other compilers, the floating point emulationroutines can be renamed with theDECLARE_LIBRARY_RENAMES macro(seeImplicit Calls to Library Routines). In this section, the default names are used.
Presently the library does not supportXFmode, which is usedforlong double on some architectures.
float__addsf3(floata, floatb) ¶double__adddf3(doublea, doubleb) ¶long double__addtf3(long doublea, long doubleb) ¶long double__addxf3(long doublea, long doubleb) ¶These functions return the sum ofa andb.
float__subsf3(floata, floatb) ¶double__subdf3(doublea, doubleb) ¶long double__subtf3(long doublea, long doubleb) ¶long double__subxf3(long doublea, long doubleb) ¶These functions return the difference betweenb anda;that is,a -b.
float__mulsf3(floata, floatb) ¶double__muldf3(doublea, doubleb) ¶long double__multf3(long doublea, long doubleb) ¶long double__mulxf3(long doublea, long doubleb) ¶These functions return the product ofa andb.
float__divsf3(floata, floatb) ¶double__divdf3(doublea, doubleb) ¶long double__divtf3(long doublea, long doubleb) ¶long double__divxf3(long doublea, long doubleb) ¶These functions return the quotient ofa andb; that is,a /b.
float__negsf2(floata) ¶double__negdf2(doublea) ¶long double__negtf2(long doublea) ¶long double__negxf2(long doublea) ¶These functions return the negation ofa. They simply flip thesign bit, so they can produce negative zero and negative NaN.
double__extendsfdf2(floata) ¶long double__extendsftf2(floata) ¶long double__extendsfxf2(floata) ¶long double__extenddftf2(doublea) ¶long double__extenddfxf2(doublea) ¶These functions extenda to the wider mode of their returntype.
double__truncxfdf2(long doublea) ¶double__trunctfdf2(long doublea) ¶float__truncxfsf2(long doublea) ¶float__trunctfsf2(long doublea) ¶float__truncdfsf2(doublea) ¶These functions truncatea to the narrower mode of their returntype, rounding toward zero.
int__fixsfsi(floata) ¶int__fixdfsi(doublea) ¶int__fixtfsi(long doublea) ¶int__fixxfsi(long doublea) ¶These functions converta to a signed integer, rounding toward zero.
long__fixsfdi(floata) ¶long__fixdfdi(doublea) ¶long__fixtfdi(long doublea) ¶long__fixxfdi(long doublea) ¶These functions converta to a signed long, rounding toward zero.
long long__fixsfti(floata) ¶long long__fixdfti(doublea) ¶long long__fixtfti(long doublea) ¶long long__fixxfti(long doublea) ¶These functions converta to a signed long long, rounding toward zero.
unsigned int__fixunssfsi(floata) ¶unsigned int__fixunsdfsi(doublea) ¶unsigned int__fixunstfsi(long doublea) ¶unsigned int__fixunsxfsi(long doublea) ¶These functions converta to an unsigned integer, roundingtoward zero. Negative values all become zero.
unsigned long__fixunssfdi(floata) ¶unsigned long__fixunsdfdi(doublea) ¶unsigned long__fixunstfdi(long doublea) ¶unsigned long__fixunsxfdi(long doublea) ¶These functions converta to an unsigned long, roundingtoward zero. Negative values all become zero.
unsigned long long__fixunssfti(floata) ¶unsigned long long__fixunsdfti(doublea) ¶unsigned long long__fixunstfti(long doublea) ¶unsigned long long__fixunsxfti(long doublea) ¶These functions converta to an unsigned long long, roundingtoward zero. Negative values all become zero.
float__floatsisf(inti) ¶double__floatsidf(inti) ¶long double__floatsitf(inti) ¶long double__floatsixf(inti) ¶These functions converti, a signed integer, to floating point.
float__floatdisf(longi) ¶double__floatdidf(longi) ¶long double__floatditf(longi) ¶long double__floatdixf(longi) ¶These functions converti, a signed long, to floating point.
float__floattisf(long longi) ¶double__floattidf(long longi) ¶long double__floattitf(long longi) ¶long double__floattixf(long longi) ¶These functions converti, a signed long long, to floating point.
float__floatunsisf(unsigned inti) ¶double__floatunsidf(unsigned inti) ¶long double__floatunsitf(unsigned inti) ¶long double__floatunsixf(unsigned inti) ¶These functions converti, an unsigned integer, to floating point.
float__floatundisf(unsigned longi) ¶double__floatundidf(unsigned longi) ¶long double__floatunditf(unsigned longi) ¶long double__floatundixf(unsigned longi) ¶These functions converti, an unsigned long, to floating point.
float__floatuntisf(unsigned long longi) ¶double__floatuntidf(unsigned long longi) ¶long double__floatuntitf(unsigned long longi) ¶long double__floatuntixf(unsigned long longi) ¶These functions converti, an unsigned long long, to floating point.
void__fixsfbitint(UBILtype *r, int32_trprec, floata) ¶void__fixdfbitint(UBILtype *r, int32_trprec, doublea) ¶void__fixxfbitint(UBILtype *r, int32_trprec, __float80a) ¶void__fixtfbitint(UBILtype *r, int32_trprec, _Float128a) ¶These functions converta to bit-precise integerr, rounding toward zero.Ifrprec is positive, it converts to unsigned bit-precise integer andnegative values all become zero, ifrprec is negative, it convertsto signed bit-precise integer.
float__floatbitintsf(UBILtype *i, int32_tiprec) ¶double__floatbitintdf(UBILtype *i, int32_tiprec) ¶__float80__floatbitintxf(UBILtype *i, int32_tiprec) ¶_Float128__floatbitinttf(UBILtype *i, int32_tiprec) ¶_Float16__floatbitinthf(UBILtype *i, int32_tiprec) ¶__bf16__floatbitintbf(UBILtype *i, int32_tiprec) ¶These functions convert bit-precise integeri to floating point. Ifiprec is positive, it is conversion from unsigned bit-precise integer,otherwise from signed bit-precise integer.
There are two sets of basic comparison functions.
CMPtype__cmpsf2(floata, floatb) ¶CMPtype__cmpdf2(doublea, doubleb) ¶CMPtype__cmptf2(long doublea, long doubleb) ¶These functions calculatea <=> b. That is, ifa is lessthanb, they return −1; ifa is greater thanb, theyreturn 1; and ifa andb are equal they return 0. Ifeither argument is NaN they return 1, but you should not rely on this;if NaN is a possibility, use one of the higher-level comparisonfunctions.
CMPtype__unordsf2(floata, floatb) ¶CMPtype__unorddf2(doublea, doubleb) ¶CMPtype__unordtf2(long doublea, long doubleb) ¶These functions return a nonzero value if either argument is NaN, otherwise 0.
There is also a complete group of higher level functions whichcorrespond directly to comparison operators. They implement the ISO Csemantics for floating-point comparisons, taking NaN into account.Pay careful attention to the return values defined for each set.Under the hood, all of these routines are implemented as
if (__unordXf2 (a, b)) returnE; return __cmpXf2 (a, b);
whereE is a constant chosen to give the proper behavior forNaN. Thus, the meaning of the return value is different for each set.Do not rely on this implementation; only the semantics documentedbelow are guaranteed.
CMPtype__eqsf2(floata, floatb) ¶CMPtype__eqdf2(doublea, doubleb) ¶CMPtype__eqtf2(long doublea, long doubleb) ¶These functions return zero if neither argument is NaN, anda andb are equal.
CMPtype__nesf2(floata, floatb) ¶CMPtype__nedf2(doublea, doubleb) ¶CMPtype__netf2(long doublea, long doubleb) ¶These functions return a nonzero value if either argument is NaN, orifa andb are unequal.
CMPtype__gesf2(floata, floatb) ¶CMPtype__gedf2(doublea, doubleb) ¶CMPtype__getf2(long doublea, long doubleb) ¶These functions return a value greater than or equal to zero ifneither argument is NaN, anda is greater than or equal tob.
CMPtype__ltsf2(floata, floatb) ¶CMPtype__ltdf2(doublea, doubleb) ¶CMPtype__lttf2(long doublea, long doubleb) ¶These functions return a value less than zero if neither argument isNaN, anda is strictly less thanb.
CMPtype__lesf2(floata, floatb) ¶CMPtype__ledf2(doublea, doubleb) ¶CMPtype__letf2(long doublea, long doubleb) ¶These functions return a value less than or equal to zero if neitherargument is NaN, anda is less than or equal tob.
CMPtype__gtsf2(floata, floatb) ¶CMPtype__gtdf2(doublea, doubleb) ¶CMPtype__gttf2(long doublea, long doubleb) ¶These functions return a value greater than zero if neither argumentis NaN, anda is strictly greater thanb.
Comparison functions return aCMPtype which is a signed integer oftarget-dependent size. TypicallyCMPtype will be word-sized, butother backends may override this with theTARGET_LIBGCC_CMP_RETURN_MODEhook. Of note, AArch64 uses an single-int as the return type, and AVR usesa quarter-int.
float__powisf2(floata, intb) ¶double__powidf2(doublea, intb) ¶long double__powitf2(long doublea, intb) ¶long double__powixf2(long doublea, intb) ¶These functions convert raisea to the powerb.
complex float__mulsc3(floata, floatb, floatc, floatd) ¶complex double__muldc3(doublea, doubleb, doublec, doubled) ¶complex long double__multc3(long doublea, long doubleb, long doublec, long doubled) ¶complex long double__mulxc3(long doublea, long doubleb, long doublec, long doubled) ¶These functions return the product ofa + ib andc + id, following the rules of C99 Annex G.
complex float__divsc3(floata, floatb, floatc, floatd) ¶complex double__divdc3(doublea, doubleb, doublec, doubled) ¶complex long double__divtc3(long doublea, long doubleb, long doublec, long doubled) ¶complex long double__divxc3(long doublea, long doubleb, long doublec, long doubled) ¶These functions return the quotient ofa + ib andc + id (i.e.,(a + ib) / (c+ id)), following the rules of C99 Annex G.
Next:Routines for decimal floating point emulation, Previous:Routines for integer arithmetic, Up:The GCC low-level runtime library [Contents][Index]