patch: docs for soft float routines

Aldy Hernandez aldyh@redhat.com
Tue Mar 4 02:38:00 GMT 2003


This patch documents libgcc's soft-float routines.  The API has been 
around forever, no harm in documenting it ;-).

OK for mainline?

2003-03-02  Aldy Hernandez  <aldyh@redhat.com>

	* Makefile.in (TEXI_GCCINT_FILES): Add softfloat.texi.

	* doc/softfloat.texi: New file.

	* doc/interface.texi (Interface): Add menu for soft float routines.
	(Interface): Include softfloat.texi.

Index: Makefile.in
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Makefile.in,v
retrieving revision 1.1004
diff -c -p -r1.1004 Makefile.in
*** Makefile.in	26 Feb 2003 11:09:29 -0000	1.1004
--- Makefile.in	4 Mar 2003 02:28:58 -0000
*************** TEXI_GCCINT_FILES = $(docdir)/gccint.tex
*** 2584,2590 ****
   	 $(docdir)/gnu.texi $(docdir)/include/gpl.texi \
   	 $(docdir)/include/fdl.texi $(docdir)/contrib.texi \
   	 $(docdir)/languages.texi $(docdir)/sourcebuild.texi \
! 	 $(docdir)/gty.texi

   TEXI_GCCINSTALL_FILES = $(docdir)/install.texi 
$(docdir)/install-old.texi \
   	 $(docdir)/include/fdl.texi
--- 2584,2590 ----
   	 $(docdir)/gnu.texi $(docdir)/include/gpl.texi \
   	 $(docdir)/include/fdl.texi $(docdir)/contrib.texi \
   	 $(docdir)/languages.texi $(docdir)/sourcebuild.texi \
! 	 $(docdir)/gty.texi $(docdir)/softfloat.texi

   TEXI_GCCINSTALL_FILES = $(docdir)/install.texi 
$(docdir)/install-old.texi \
   	 $(docdir)/include/fdl.texi
Index: doc/softfloat.texi
===================================================================
RCS file: doc/softfloat.texi
diff -N doc/softfloat.texi
*** /dev/null	1 Jan 1970 00:00:00 -0000
--- doc/softfloat.texi	4 Mar 2003 02:28:58 -0000
***************
*** 0 ****
--- 1,187 ----
+ @c Copyright (C) 2003 Free Software Foundation, Inc.
+ @c This is part of the GCC manual.
+ @c For copying conditions, see the file gcc.texi.
+ @c Contributed by Aldy Hernandez <aldy@quesejoda.com>
+
+ @node Soft float library routines
+ @section Supporting soft floating point library routines
+ @cindex soft library
+ @opindex msoft-float
+
+ Code compiled with GCC may call certain library routines.  Most of
+ them handle arithmetic for which there are no machine instructions.
+ This includes floating point operations for which floating point
+ support is disabled with @option{-msoft-float}.  This section
+ documents the floating point subset of these routines.
+
+ This document assumes @code{float} is a floating point of
+ @code{SF} mode, @code{double} is a floating point of @code{DF}
+ mode, @code{long double} is a floating point of @code{TF} mode,
+ and @code{int} is an integer of @code{SI} mode.
+
+ These functions return the sum of their two arguments.
+
+ @smallexample
+ double __adddf3 (double, double);
+ float __addsf3 (float, float);
+ long double __addtf3 (long double, long double);
+ @end smallexample
+
+ Given two arguments (a and b), these functions compare the two
+ arguments.  If @code{a} is less than @code{b}, the function returns
+ -1.  If @code{a} is greater than @code{b}, the function returns 1.  If
+ @code{a} is equal to @code{b}, the function returns 0.  If either
+ argument is a NAN, the function returns 1.
+
+ @smallexample
+ int __cmpdf2 (double, double);
+ int __cmpsf2 (float, float);
+ int __cmptf2 (long double, long double);
+ @end smallexample
+
+ These functions return the result of dividing the first argument by
+ the second argument.
+
+ @smallexample
+ double __divdf3 (double, double);
+ float __divsf3 (float, float);
+ long double __divtf3 (long double, long double);
+ @end smallexample
+
+ These functions return 0 if their arguments are equal to each other,
+ otherwise a non-zero is returned.  If either argument is a NAN, 1 is
+ return.
+
+ @smallexample
+ int __eqdf2 (double, double);
+ int __eqsf2 (float, float);
+ int __eqtf2 (long double, long double);
+ @end smallexample
+
+ These functions extend their argument to @code{double} and
+ @code{long double} respectively.
+
+ @smallexample
+ double __extendsfdf2 (float);
+ long double __extendsftf2 (float);
+ @end smallexample
+
+ These functions return the result of converting its floating point
+ argument to an integer, still represented in floating point mode, by
+ rounding towards zero.
+
+ @smallexample
+ int __fixdfsi (double);
+ int __fixsfsi (float);
+ int __fixtfsi (long double);
+ @end smallexample
+
+ These functions represent the result of converting its fixed point
+ argument, regarded as signed, to a floating point value.
+
+ @smallexample
+ double __floatsidf (int);
+ float __floatsisf (int);
+ long double __floatsitf (int);
+ @end smallexample
+
+ The same as above, but the argument is regarded as unsigned.
+
+ @smallexample
+ double __floatunsidf (unsigned int);
+ float __floatunsisf (unsigned int);
+ long double __floatunsitf (int);
+ @end smallexample
+
+ These functions return 1 if the first argument is greater or equal
+ than the second argument, or if either argument is a NAN.  Otherwise,
+ 0 is returned.
+
+ @smallexample
+ int __gedf2 (double, double);
+ int __gesf2 (float, float);
+ int __getf2 (long double, long double);
+ @end smallexample
+
+ These functions return 1 if the first argument is less than or equal
+ to the second argument, or if either argument is a NAN.  Otherwise, 0
+ is returned.
+
+ @smallexample
+ int __ledf2 (double, double);
+ int __lesf2 (float, float);
+ int __letf2 (long double, long double);
+ @end smallexample
+
+ These functions return 1 if the first argument is less than the second
+ argument, or if either argument is a NAN.  Otherwise, 0 is returned.
+
+ @smallexample
+ int __ltdf2 (double, double);
+ int __ltsf2 (float, float);
+ int __lttf2 (long double, long double);
+ @end smallexample
+
+ These functions return the result of multiplying their arguments.
+
+ @smallexample
+ double __muldf3 (double, double);
+ float __mulsf3 (float, float);
+ long double __multf3 (long double, long double);
+ @end smallexample
+
+ These functions return 1 if the first argument is not equal to the
+ second argument, or if either argument is a NAN.  Otherwise, 0 is
+ returned.
+
+ @smallexample
+ int __nedf2 (double, double);
+ int __nesf2 (float, float);
+ int __netf2 (long double, long double);
+ @end smallexample
+
+ These functions return the result of negating its argument.
+
+ @smallexample
+ long double __negtf2 (long double);
+ double __negdf2 (double);
+ float __negsf2 (float);
+ @end smallexample
+
+ These functions return the result of subtracting the second argument
+ from the first.
+
+ @smallexample
+ double __subdf3 (double, double);
+ float __subsf3 (float, float);
+ long double __subtf3 (long double, long double);
+ @end smallexample
+
+ These function return the result of truncating the floating argument
+ to the mode indicated by its return type.
+
+ @smallexample
+ float __truncdfsf2 (double);
+ double __trunctfdf2 (long double);
+ float __trunctfsf2 (long double);
+ @end smallexample
+
+ These functions return 1 if either argument is a NAN, otherwise 0 is
+ returned.
+
+ @smallexample
+ int __unorddf2 (double, double);
+ int __unordsf2 (float, float);
+ int __unordtf2 (long double, long double);
+ @end smallexample
+
+ These functions represent the result of converting its floating point
+ argument ot a fixed point value, regarded as unsigned.  How rounding
+ is done is not specified.
+
+ @smallexample
+ unsigned int __fixunsdfsi (double);
+ unsigned int __fixunssfsi (float);
+ unsigned int __fixunstfsi (long double);
+
+ @end smallexample
Index: doc/interface.texi
===================================================================
RCS file: /cvs/gcc/gcc/gcc/doc/interface.texi,v
retrieving revision 1.2
diff -c -p -r1.2 interface.texi
*** doc/interface.texi	15 Sep 2002 22:48:04 -0000	1.2
--- doc/interface.texi	4 Mar 2003 02:28:58 -0000
*************** they appear in @file{libgcc2.c}.  Others
*** 100,102 ****
--- 100,108 ----
   assembly language for each processor.  Wherever they are defined, they
   are compiled into the support library, @file{libgcc.a}, which is
   automatically searched when you link programs with GCC@.
+
+ @menu
+ * Soft float library routines:: Supporting floating point routines.
+ @end menu
+
+ @include softfloat.texi



More information about the Gcc-patches mailing list