]> CyberLeo.Net >> Repos - FreeBSD/releng/10.2.git/blob - contrib/gcc/doc/libgcc.texi
- Copy stable/10@285827 to releng/10.2 in preparation for 10.2-RC1
[FreeBSD/releng/10.2.git] / contrib / gcc / doc / libgcc.texi
1 @c Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc.
2 @c This is part of the GCC manual.
3 @c For copying conditions, see the file gcc.texi.
4 @c Contributed by Aldy Hernandez <aldy@quesejoda.com>
5
6 @node Libgcc
7 @chapter The GCC low-level runtime library
8
9 GCC provides a low-level runtime library, @file{libgcc.a} or
10 @file{libgcc_s.so.1} on some platforms.  GCC generates calls to
11 routines in this library automatically, whenever it needs to perform
12 some operation that is too complicated to emit inline code for.
13
14 Most of the routines in @code{libgcc} handle arithmetic operations
15 that the target processor cannot perform directly.  This includes
16 integer multiply and divide on some machines, and all floating-point
17 operations on other machines.  @code{libgcc} also includes routines
18 for exception handling, and a handful of miscellaneous operations.
19
20 Some of these routines can be defined in mostly machine-independent C@.
21 Others must be hand-written in assembly language for each processor
22 that needs them.
23
24 GCC will also generate calls to C library routines, such as
25 @code{memcpy} and @code{memset}, in some cases.  The set of routines
26 that GCC may possibly use is documented in @ref{Other
27 Builtins,,,gcc, Using the GNU Compiler Collection (GCC)}.
28
29 These routines take arguments and return values of a specific machine
30 mode, not a specific C type.  @xref{Machine Modes}, for an explanation
31 of this concept.  For illustrative purposes, in this chapter the
32 floating point type @code{float} is assumed to correspond to @code{SFmode};
33 @code{double} to @code{DFmode}; and @code{@w{long double}} to both
34 @code{TFmode} and @code{XFmode}.  Similarly, the integer types @code{int}
35 and @code{@w{unsigned int}} correspond to @code{SImode}; @code{long} and
36 @code{@w{unsigned long}} to @code{DImode}; and @code{@w{long long}} and
37 @code{@w{unsigned long long}} to @code{TImode}.
38
39 @menu
40 * Integer library routines::
41 * Soft float library routines::
42 * Decimal float library routines::
43 * Exception handling routines::
44 * Miscellaneous routines::
45 @end menu
46
47 @node Integer library routines
48 @section Routines for integer arithmetic
49
50 The integer arithmetic routines are used on platforms that don't provide
51 hardware support for arithmetic operations on some modes.
52
53 @subsection Arithmetic functions
54
55 @deftypefn {Runtime Function} int __ashlsi3 (int @var{a}, int @var{b})
56 @deftypefnx {Runtime Function} long __ashldi3 (long @var{a}, int @var{b})
57 @deftypefnx {Runtime Function} {long long} __ashlti3 (long long @var{a}, int @var{b})
58 These functions return the result of shifting @var{a} left by @var{b} bits.
59 @end deftypefn
60
61 @deftypefn {Runtime Function} int __ashrsi3 (int @var{a}, int @var{b})
62 @deftypefnx {Runtime Function} long __ashrdi3 (long @var{a}, int @var{b})
63 @deftypefnx {Runtime Function} {long long} __ashrti3 (long long @var{a}, int @var{b})
64 These functions return the result of arithmetically shifting @var{a} right
65 by @var{b} bits.
66 @end deftypefn
67
68 @deftypefn {Runtime Function} int __divsi3 (int @var{a}, int @var{b})
69 @deftypefnx {Runtime Function} long __divdi3 (long @var{a}, long @var{b})
70 @deftypefnx {Runtime Function} {long long} __divti3 (long long @var{a}, long long @var{b})
71 These functions return the quotient of the signed division of @var{a} and
72 @var{b}.
73 @end deftypefn
74
75 @deftypefn {Runtime Function} int __lshrsi3 (int @var{a}, int @var{b})
76 @deftypefnx {Runtime Function} long __lshrdi3 (long @var{a}, int @var{b})
77 @deftypefnx {Runtime Function} {long long} __lshrti3 (long long @var{a}, int @var{b})
78 These functions return the result of logically shifting @var{a} right by
79 @var{b} bits.
80 @end deftypefn
81
82 @deftypefn {Runtime Function} int __modsi3 (int @var{a}, int @var{b})
83 @deftypefnx {Runtime Function} long __moddi3 (long @var{a}, long @var{b})
84 @deftypefnx {Runtime Function} {long long} __modti3 (long long @var{a}, long long @var{b})
85 These functions return the remainder of the signed division of @var{a}
86 and @var{b}.
87 @end deftypefn
88
89 @deftypefn {Runtime Function} int __mulsi3 (int @var{a}, int @var{b})
90 @deftypefnx {Runtime Function} long __muldi3 (long @var{a}, long @var{b})
91 @deftypefnx {Runtime Function} {long long} __multi3 (long long @var{a}, long long @var{b})
92 These functions return the product of @var{a} and @var{b}.
93 @end deftypefn
94
95 @deftypefn {Runtime Function} long __negdi2 (long @var{a})
96 @deftypefnx {Runtime Function} {long long} __negti2 (long long @var{a})
97 These functions return the negation of @var{a}.
98 @end deftypefn
99
100 @deftypefn {Runtime Function} {unsigned int} __udivsi3 (unsigned int @var{a}, unsigned int @var{b})
101 @deftypefnx {Runtime Function} {unsigned long} __udivdi3 (unsigned long @var{a}, unsigned long @var{b})
102 @deftypefnx {Runtime Function} {unsigned long long} __udivti3 (unsigned long long @var{a}, unsigned long long @var{b})
103 These functions return the quotient of the unsigned division of @var{a}
104 and @var{b}.
105 @end deftypefn
106
107 @deftypefn {Runtime Function} {unsigned long} __udivmoddi3 (unsigned long @var{a}, unsigned long @var{b}, unsigned long *@var{c})
108 @deftypefnx {Runtime Function} {unsigned long long} __udivti3 (unsigned long long @var{a}, unsigned long long @var{b}, unsigned long long *@var{c})
109 These functions calculate both the quotient and remainder of the unsigned
110 division of @var{a} and @var{b}.  The return value is the quotient, and
111 the remainder is placed in variable pointed to by @var{c}.
112 @end deftypefn
113
114 @deftypefn {Runtime Function} {unsigned int} __umodsi3 (unsigned int @var{a}, unsigned int @var{b})
115 @deftypefnx {Runtime Function} {unsigned long} __umoddi3 (unsigned long @var{a}, unsigned long @var{b})
116 @deftypefnx {Runtime Function} {unsigned long long} __umodti3 (unsigned long long @var{a}, unsigned long long @var{b})
117 These functions return the remainder of the unsigned division of @var{a}
118 and @var{b}.
119 @end deftypefn
120
121 @subsection Comparison functions
122
123 The following functions implement integral comparisons.  These functions
124 implement a low-level compare, upon which the higher level comparison
125 operators (such as less than and greater than or equal to) can be
126 constructed.  The returned values lie in the range zero to two, to allow
127 the high-level operators to be implemented by testing the returned
128 result using either signed or unsigned comparison.
129
130 @deftypefn {Runtime Function} int __cmpdi2 (long @var{a}, long @var{b})
131 @deftypefnx {Runtime Function} int __cmpti2 (long long @var{a}, long long @var{b})
132 These functions perform a signed comparison of @var{a} and @var{b}.  If
133 @var{a} is less than @var{b}, they return 0; if @var{a} is greater than
134 @var{b}, they return 2; and if @var{a} and @var{b} are equal they return 1.
135 @end deftypefn
136
137 @deftypefn {Runtime Function} int __ucmpdi2 (unsigned long @var{a}, unsigned long @var{b})
138 @deftypefnx {Runtime Function} int __ucmpti2 (unsigned long long @var{a}, unsigned long long @var{b})
139 These functions perform an unsigned comparison of @var{a} and @var{b}.
140 If @var{a} is less than @var{b}, they return 0; if @var{a} is greater than
141 @var{b}, they return 2; and if @var{a} and @var{b} are equal they return 1.
142 @end deftypefn
143
144 @subsection Trapping arithmetic functions
145
146 The following functions implement trapping arithmetic.  These functions
147 call the libc function @code{abort} upon signed arithmetic overflow.
148
149 @deftypefn {Runtime Function} int __absvsi2 (int @var{a})
150 @deftypefnx {Runtime Function} long __absvdi2 (long @var{a})
151 These functions return the absolute value of @var{a}.
152 @end deftypefn
153
154 @deftypefn {Runtime Function} int __addvsi3 (int @var{a}, int @var{b})
155 @deftypefnx {Runtime Function} long __addvdi3 (long @var{a}, long @var{b})
156 These functions return the sum of @var{a} and @var{b}; that is
157 @code{@var{a} + @var{b}}.
158 @end deftypefn
159
160 @deftypefn {Runtime Function} int __mulvsi3 (int @var{a}, int @var{b})
161 @deftypefnx {Runtime Function} long __mulvdi3 (long @var{a}, long @var{b})
162 The functions return the product of @var{a} and @var{b}; that is
163 @code{@var{a} * @var{b}}.
164 @end deftypefn
165
166 @deftypefn {Runtime Function} int __negvsi2 (int @var{a})
167 @deftypefnx {Runtime Function} long __negvdi2 (long @var{a})
168 These functions return the negation of @var{a}; that is @code{-@var{a}}.
169 @end deftypefn
170
171 @deftypefn {Runtime Function} int __subvsi3 (int @var{a}, int @var{b})
172 @deftypefnx {Runtime Function} long __subvdi3 (long @var{a}, long @var{b})
173 These functions return the difference between @var{b} and @var{a};
174 that is @code{@var{a} - @var{b}}.
175 @end deftypefn
176
177 @subsection Bit operations
178
179 @deftypefn {Runtime Function} int __clzsi2 (int @var{a})
180 @deftypefnx {Runtime Function} int __clzdi2 (long @var{a})
181 @deftypefnx {Runtime Function} int __clzti2 (long long @var{a})
182 These functions return the number of leading 0-bits in @var{a}, starting
183 at the most significant bit position.  If @var{a} is zero, the result is
184 undefined.
185 @end deftypefn
186
187 @deftypefn {Runtime Function} int __ctzsi2 (int @var{a})
188 @deftypefnx {Runtime Function} int __ctzdi2 (long @var{a})
189 @deftypefnx {Runtime Function} int __ctzti2 (long long @var{a})
190 These functions return the number of trailing 0-bits in @var{a}, starting
191 at the least significant bit position.  If @var{a} is zero, the result is
192 undefined.
193 @end deftypefn
194
195 @deftypefn {Runtime Function} int __ffsdi2 (long @var{a})
196 @deftypefnx {Runtime Function} int __ffsti2 (long long @var{a})
197 These functions return the index of the least significant 1-bit in @var{a},
198 or the value zero if @var{a} is zero.  The least significant bit is index
199 one.
200 @end deftypefn
201
202 @deftypefn {Runtime Function} int __paritysi2 (int @var{a})
203 @deftypefnx {Runtime Function} int __paritydi2 (long @var{a})
204 @deftypefnx {Runtime Function} int __parityti2 (long long @var{a})
205 These functions return the value zero if the number of bits set in
206 @var{a} is even, and the value one otherwise.
207 @end deftypefn
208
209 @deftypefn {Runtime Function} int __popcountsi2 (int @var{a})
210 @deftypefnx {Runtime Function} int __popcountdi2 (long @var{a})
211 @deftypefnx {Runtime Function} int __popcountti2 (long long @var{a})
212 These functions return the number of bits set in @var{a}.
213 @end deftypefn
214
215 @deftypefn {Runtime Function} int32_t __bswapsi2 (int32_t @var{a})
216 @deftypefnx {Runtime Function} int64_t __bswapdi2 (int64_t @var{a})
217 These functions return the @var{a} byteswapped.
218 @end deftypefn
219
220 @node Soft float library routines
221 @section Routines for floating point emulation
222 @cindex soft float library
223 @cindex arithmetic library
224 @cindex math library
225 @opindex msoft-float
226
227 The software floating point library is used on machines which do not
228 have hardware support for floating point.  It is also used whenever
229 @option{-msoft-float} is used to disable generation of floating point
230 instructions.  (Not all targets support this switch.)
231
232 For compatibility with other compilers, the floating point emulation
233 routines can be renamed with the @code{DECLARE_LIBRARY_RENAMES} macro
234 (@pxref{Library Calls}).  In this section, the default names are used.
235
236 Presently the library does not support @code{XFmode}, which is used
237 for @code{long double} on some architectures.
238
239 @subsection Arithmetic functions
240
241 @deftypefn {Runtime Function} float __addsf3 (float @var{a}, float @var{b})
242 @deftypefnx {Runtime Function} double __adddf3 (double @var{a}, double @var{b})
243 @deftypefnx {Runtime Function} {long double} __addtf3 (long double @var{a}, long double @var{b})
244 @deftypefnx {Runtime Function} {long double} __addxf3 (long double @var{a}, long double @var{b})
245 These functions return the sum of @var{a} and @var{b}.
246 @end deftypefn
247
248 @deftypefn {Runtime Function} float __subsf3 (float @var{a}, float @var{b})
249 @deftypefnx {Runtime Function} double __subdf3 (double @var{a}, double @var{b})
250 @deftypefnx {Runtime Function} {long double} __subtf3 (long double @var{a}, long double @var{b})
251 @deftypefnx {Runtime Function} {long double} __subxf3 (long double @var{a}, long double @var{b})
252 These functions return the difference between @var{b} and @var{a};
253 that is, @w{@math{@var{a} - @var{b}}}.
254 @end deftypefn
255
256 @deftypefn {Runtime Function} float __mulsf3 (float @var{a}, float @var{b})
257 @deftypefnx {Runtime Function} double __muldf3 (double @var{a}, double @var{b})
258 @deftypefnx {Runtime Function} {long double} __multf3 (long double @var{a}, long double @var{b})
259 @deftypefnx {Runtime Function} {long double} __mulxf3 (long double @var{a}, long double @var{b})
260 These functions return the product of @var{a} and @var{b}.
261 @end deftypefn
262
263 @deftypefn {Runtime Function} float __divsf3 (float @var{a}, float @var{b})
264 @deftypefnx {Runtime Function} double __divdf3 (double @var{a}, double @var{b})
265 @deftypefnx {Runtime Function} {long double} __divtf3 (long double @var{a}, long double @var{b})
266 @deftypefnx {Runtime Function} {long double} __divxf3 (long double @var{a}, long double @var{b})
267 These functions return the quotient of @var{a} and @var{b}; that is,
268 @w{@math{@var{a} / @var{b}}}.
269 @end deftypefn
270
271 @deftypefn {Runtime Function} float __negsf2 (float @var{a})
272 @deftypefnx {Runtime Function} double __negdf2 (double @var{a})
273 @deftypefnx {Runtime Function} {long double} __negtf2 (long double @var{a})
274 @deftypefnx {Runtime Function} {long double} __negxf2 (long double @var{a})
275 These functions return the negation of @var{a}.  They simply flip the
276 sign bit, so they can produce negative zero and negative NaN@.
277 @end deftypefn
278
279 @subsection Conversion functions
280
281 @deftypefn {Runtime Function} double __extendsfdf2 (float @var{a})
282 @deftypefnx {Runtime Function} {long double} __extendsftf2 (float @var{a})
283 @deftypefnx {Runtime Function} {long double} __extendsfxf2 (float @var{a})
284 @deftypefnx {Runtime Function} {long double} __extenddftf2 (double @var{a})
285 @deftypefnx {Runtime Function} {long double} __extenddfxf2 (double @var{a})
286 These functions extend @var{a} to the wider mode of their return
287 type.
288 @end deftypefn
289
290 @deftypefn {Runtime Function} double __truncxfdf2 (long double @var{a})
291 @deftypefnx {Runtime Function} double __trunctfdf2 (long double @var{a})
292 @deftypefnx {Runtime Function} float __truncxfsf2 (long double @var{a})
293 @deftypefnx {Runtime Function} float __trunctfsf2 (long double @var{a})
294 @deftypefnx {Runtime Function} float __truncdfsf2 (double @var{a})
295 These functions truncate @var{a} to the narrower mode of their return
296 type, rounding toward zero.
297 @end deftypefn
298
299 @deftypefn {Runtime Function} int __fixsfsi (float @var{a})
300 @deftypefnx {Runtime Function} int __fixdfsi (double @var{a})
301 @deftypefnx {Runtime Function} int __fixtfsi (long double @var{a})
302 @deftypefnx {Runtime Function} int __fixxfsi (long double @var{a})
303 These functions convert @var{a} to a signed integer, rounding toward zero.
304 @end deftypefn
305
306 @deftypefn {Runtime Function} long __fixsfdi (float @var{a})
307 @deftypefnx {Runtime Function} long __fixdfdi (double @var{a})
308 @deftypefnx {Runtime Function} long __fixtfdi (long double @var{a})
309 @deftypefnx {Runtime Function} long __fixxfdi (long double @var{a})
310 These functions convert @var{a} to a signed long, rounding toward zero.
311 @end deftypefn
312
313 @deftypefn {Runtime Function} {long long} __fixsfti (float @var{a})
314 @deftypefnx {Runtime Function} {long long} __fixdfti (double @var{a})
315 @deftypefnx {Runtime Function} {long long} __fixtfti (long double @var{a})
316 @deftypefnx {Runtime Function} {long long} __fixxfti (long double @var{a})
317 These functions convert @var{a} to a signed long long, rounding toward zero.
318 @end deftypefn
319
320 @deftypefn {Runtime Function} {unsigned int} __fixunssfsi (float @var{a})
321 @deftypefnx {Runtime Function} {unsigned int} __fixunsdfsi (double @var{a})
322 @deftypefnx {Runtime Function} {unsigned int} __fixunstfsi (long double @var{a})
323 @deftypefnx {Runtime Function} {unsigned int} __fixunsxfsi (long double @var{a})
324 These functions convert @var{a} to an unsigned integer, rounding
325 toward zero.  Negative values all become zero.
326 @end deftypefn
327
328 @deftypefn {Runtime Function} {unsigned long} __fixunssfdi (float @var{a})
329 @deftypefnx {Runtime Function} {unsigned long} __fixunsdfdi (double @var{a})
330 @deftypefnx {Runtime Function} {unsigned long} __fixunstfdi (long double @var{a})
331 @deftypefnx {Runtime Function} {unsigned long} __fixunsxfdi (long double @var{a})
332 These functions convert @var{a} to an unsigned long, rounding
333 toward zero.  Negative values all become zero.
334 @end deftypefn
335
336 @deftypefn {Runtime Function} {unsigned long long} __fixunssfti (float @var{a})
337 @deftypefnx {Runtime Function} {unsigned long long} __fixunsdfti (double @var{a})
338 @deftypefnx {Runtime Function} {unsigned long long} __fixunstfti (long double @var{a})
339 @deftypefnx {Runtime Function} {unsigned long long} __fixunsxfti (long double @var{a})
340 These functions convert @var{a} to an unsigned long long, rounding
341 toward zero.  Negative values all become zero.
342 @end deftypefn
343
344 @deftypefn {Runtime Function} float __floatsisf (int @var{i})
345 @deftypefnx {Runtime Function} double __floatsidf (int @var{i})
346 @deftypefnx {Runtime Function} {long double} __floatsitf (int @var{i})
347 @deftypefnx {Runtime Function} {long double} __floatsixf (int @var{i})
348 These functions convert @var{i}, a signed integer, to floating point.
349 @end deftypefn
350
351 @deftypefn {Runtime Function} float __floatdisf (long @var{i})
352 @deftypefnx {Runtime Function} double __floatdidf (long @var{i})
353 @deftypefnx {Runtime Function} {long double} __floatditf (long @var{i})
354 @deftypefnx {Runtime Function} {long double} __floatdixf (long @var{i})
355 These functions convert @var{i}, a signed long, to floating point.
356 @end deftypefn
357
358 @deftypefn {Runtime Function} float __floattisf (long long @var{i})
359 @deftypefnx {Runtime Function} double __floattidf (long long @var{i})
360 @deftypefnx {Runtime Function} {long double} __floattitf (long long @var{i})
361 @deftypefnx {Runtime Function} {long double} __floattixf (long long @var{i})
362 These functions convert @var{i}, a signed long long, to floating point.
363 @end deftypefn
364
365 @deftypefn {Runtime Function} float __floatunsisf (unsigned int @var{i})
366 @deftypefnx {Runtime Function} double __floatunsidf (unsigned int @var{i})
367 @deftypefnx {Runtime Function} {long double} __floatunsitf (unsigned int @var{i})
368 @deftypefnx {Runtime Function} {long double} __floatunsixf (unsigned int @var{i})
369 These functions convert @var{i}, an unsigned integer, to floating point.
370 @end deftypefn
371
372 @deftypefn {Runtime Function} float __floatundisf (unsigned long @var{i})
373 @deftypefnx {Runtime Function} double __floatundidf (unsigned long @var{i})
374 @deftypefnx {Runtime Function} {long double} __floatunditf (unsigned long @var{i})
375 @deftypefnx {Runtime Function} {long double} __floatundixf (unsigned long @var{i})
376 These functions convert @var{i}, an unsigned long, to floating point.
377 @end deftypefn
378
379 @deftypefn {Runtime Function} float __floatuntisf (unsigned long long @var{i})
380 @deftypefnx {Runtime Function} double __floatuntidf (unsigned long long @var{i})
381 @deftypefnx {Runtime Function} {long double} __floatuntitf (unsigned long long @var{i})
382 @deftypefnx {Runtime Function} {long double} __floatuntixf (unsigned long long @var{i})
383 These functions convert @var{i}, an unsigned long long, to floating point.
384 @end deftypefn
385
386 @subsection Comparison functions
387
388 There are two sets of basic comparison functions.
389
390 @deftypefn {Runtime Function} int __cmpsf2 (float @var{a}, float @var{b})
391 @deftypefnx {Runtime Function} int __cmpdf2 (double @var{a}, double @var{b})
392 @deftypefnx {Runtime Function} int __cmptf2 (long double @var{a}, long double @var{b})
393 These functions calculate @math{a <=> b}.  That is, if @var{a} is less
394 than @var{b}, they return @minus{}1; if @var{a} is greater than @var{b}, they
395 return 1; and if @var{a} and @var{b} are equal they return 0.  If
396 either argument is NaN they return 1, but you should not rely on this;
397 if NaN is a possibility, use one of the higher-level comparison
398 functions.
399 @end deftypefn
400
401 @deftypefn {Runtime Function} int __unordsf2 (float @var{a}, float @var{b})
402 @deftypefnx {Runtime Function} int __unorddf2 (double @var{a}, double @var{b})
403 @deftypefnx {Runtime Function} int __unordtf2 (long double @var{a}, long double @var{b})
404 These functions return a nonzero value if either argument is NaN, otherwise 0.
405 @end deftypefn
406
407 There is also a complete group of higher level functions which
408 correspond directly to comparison operators.  They implement the ISO C
409 semantics for floating-point comparisons, taking NaN into account.
410 Pay careful attention to the return values defined for each set.
411 Under the hood, all of these routines are implemented as
412
413 @smallexample
414   if (__unord@var{X}f2 (a, b))
415     return @var{E};
416   return __cmp@var{X}f2 (a, b);
417 @end smallexample
418
419 @noindent
420 where @var{E} is a constant chosen to give the proper behavior for
421 NaN@.  Thus, the meaning of the return value is different for each set.
422 Do not rely on this implementation; only the semantics documented
423 below are guaranteed.
424
425 @deftypefn {Runtime Function} int __eqsf2 (float @var{a}, float @var{b})
426 @deftypefnx {Runtime Function} int __eqdf2 (double @var{a}, double @var{b})
427 @deftypefnx {Runtime Function} int __eqtf2 (long double @var{a}, long double @var{b})
428 These functions return zero if neither argument is NaN, and @var{a} and
429 @var{b} are equal.
430 @end deftypefn
431
432 @deftypefn {Runtime Function} int __nesf2 (float @var{a}, float @var{b})
433 @deftypefnx {Runtime Function} int __nedf2 (double @var{a}, double @var{b})
434 @deftypefnx {Runtime Function} int __netf2 (long double @var{a}, long double @var{b})
435 These functions return a nonzero value if either argument is NaN, or
436 if @var{a} and @var{b} are unequal.
437 @end deftypefn
438
439 @deftypefn {Runtime Function} int __gesf2 (float @var{a}, float @var{b})
440 @deftypefnx {Runtime Function} int __gedf2 (double @var{a}, double @var{b})
441 @deftypefnx {Runtime Function} int __getf2 (long double @var{a}, long double @var{b})
442 These functions return a value greater than or equal to zero if
443 neither argument is NaN, and @var{a} is greater than or equal to
444 @var{b}.
445 @end deftypefn
446
447 @deftypefn {Runtime Function} int __ltsf2 (float @var{a}, float @var{b})
448 @deftypefnx {Runtime Function} int __ltdf2 (double @var{a}, double @var{b})
449 @deftypefnx {Runtime Function} int __lttf2 (long double @var{a}, long double @var{b})
450 These functions return a value less than zero if neither argument is
451 NaN, and @var{a} is strictly less than @var{b}.
452 @end deftypefn
453
454 @deftypefn {Runtime Function} int __lesf2 (float @var{a}, float @var{b})
455 @deftypefnx {Runtime Function} int __ledf2 (double @var{a}, double @var{b})
456 @deftypefnx {Runtime Function} int __letf2 (long double @var{a}, long double @var{b})
457 These functions return a value less than or equal to zero if neither
458 argument is NaN, and @var{a} is less than or equal to @var{b}.
459 @end deftypefn
460
461 @deftypefn {Runtime Function} int __gtsf2 (float @var{a}, float @var{b})
462 @deftypefnx {Runtime Function} int __gtdf2 (double @var{a}, double @var{b})
463 @deftypefnx {Runtime Function} int __gttf2 (long double @var{a}, long double @var{b})
464 These functions return a value greater than zero if neither argument
465 is NaN, and @var{a} is strictly greater than @var{b}.
466 @end deftypefn
467
468 @subsection Other floating-point functions
469
470 @deftypefn {Runtime Function} float __powisf2 (float @var{a}, int @var{b})
471 @deftypefnx {Runtime Function} double __powidf2 (double @var{a}, int @var{b})
472 @deftypefnx {Runtime Function} {long double} __powitf2 (long double @var{a}, int @var{b})
473 @deftypefnx {Runtime Function} {long double} __powixf2 (long double @var{a}, int @var{b})
474 These functions convert raise @var{a} to the power @var{b}.
475 @end deftypefn
476
477 @deftypefn {Runtime Function} {complex float} __mulsc3 (float @var{a}, float @var{b}, float @var{c}, float @var{d})
478 @deftypefnx {Runtime Function} {complex double} __muldc3 (double @var{a}, double @var{b}, double @var{c}, double @var{d})
479 @deftypefnx {Runtime Function} {complex long double} __multc3 (long double @var{a}, long double @var{b}, long double @var{c}, long double @var{d})
480 @deftypefnx {Runtime Function} {complex long double} __mulxc3 (long double @var{a}, long double @var{b}, long double @var{c}, long double @var{d})
481 These functions return the product of @math{@var{a} + i@var{b}} and
482 @math{@var{c} + i@var{d}}, following the rules of C99 Annex G@.
483 @end deftypefn
484
485 @deftypefn {Runtime Function} {complex float} __divsc3 (float @var{a}, float @var{b}, float @var{c}, float @var{d})
486 @deftypefnx {Runtime Function} {complex double} __divdc3 (double @var{a}, double @var{b}, double @var{c}, double @var{d})
487 @deftypefnx {Runtime Function} {complex long double} __divtc3 (long double @var{a}, long double @var{b}, long double @var{c}, long double @var{d})
488 @deftypefnx {Runtime Function} {complex long double} __divxc3 (long double @var{a}, long double @var{b}, long double @var{c}, long double @var{d})
489 These functions return the quotient of @math{@var{a} + i@var{b}} and
490 @math{@var{c} + i@var{d}} (i.e., @math{(@var{a} + i@var{b}) / (@var{c}
491 + i@var{d})}), following the rules of C99 Annex G@.
492 @end deftypefn
493
494 @node Decimal float library routines
495 @section Routines for decimal floating point emulation
496 @cindex decimal float library
497 @cindex IEEE-754R
498
499 The software decimal floating point library implements IEEE 754R
500 decimal floating point arithmetic and is only activated on selected
501 targets.
502
503 @subsection Arithmetic functions
504
505 @deftypefn {Runtime Function} _Decimal32 __addsd3 (_Decimal32 @var{a}, _Decimal32 @var{b})
506 @deftypefnx {Runtime Function} _Decimal64 __adddd3 (_Decimal64 @var{a}, _Decimal64 @var{b})
507 @deftypefnx {Runtime Function} _Decimal128 __addtd3 (_Decimal128 @var{a}, _Decimal128 @var{b})
508 These functions return the sum of @var{a} and @var{b}.
509 @end deftypefn
510
511 @deftypefn {Runtime Function} _Decimal32 __subsd3 (_Decimal32 @var{a}, _Decimal32 @var{b})
512 @deftypefnx {Runtime Function} _Decimal64 __subdd3 (_Decimal64 @var{a}, _Decimal64 @var{b})
513 @deftypefnx {Runtime Function} _Decimal128 __subtd3 (_Decimal128 @var{a}, _Decimal128 @var{b})
514 These functions return the difference between @var{b} and @var{a};
515 that is, @w{@math{@var{a} - @var{b}}}.
516 @end deftypefn
517
518 @deftypefn {Runtime Function} _Decimal32 __mulsd3 (_Decimal32 @var{a}, _Decimal32 @var{b})
519 @deftypefnx {Runtime Function} _Decimal64 __muldd3 (_Decimal64 @var{a}, _Decimal64 @var{b})
520 @deftypefnx {Runtime Function} _Decimal128 __multd3 (_Decimal128 @var{a}, _Decimal128 @var{b})
521 These functions return the product of @var{a} and @var{b}.
522 @end deftypefn
523
524 @deftypefn {Runtime Function} _Decimal32 __divsd3 (_Decimal32 @var{a}, _Decimal32 @var{b})
525 @deftypefnx {Runtime Function} _Decimal64 __divdd3 (_Decimal64 @var{a}, _Decimal64 @var{b})
526 @deftypefnx {Runtime Function} _Decimal128 __divtd3 (_Decimal128 @var{a}, _Decimal128 @var{b})
527 These functions return the quotient of @var{a} and @var{b}; that is,
528 @w{@math{@var{a} / @var{b}}}.
529 @end deftypefn
530
531 @deftypefn {Runtime Function} _Decimal32 __negsd2 (_Decimal32 @var{a})
532 @deftypefnx {Runtime Function} _Decimal64 __negdd2 (_Decimal64 @var{a})
533 @deftypefnx {Runtime Function} _Decimal128 __negtd2 (_Decimal128 @var{a})
534 These functions return the negation of @var{a}.  They simply flip the
535 sign bit, so they can produce negative zero and negative NaN@.
536 @end deftypefn
537
538 @subsection Conversion functions
539
540 @c DFP/DFP conversions
541 @deftypefn {Runtime Function} _Decimal64 __extendsddd2 (_Decimal32 @var{a})
542 @deftypefnx {Runtime Function} _Decimal128 __extendsdtd2 (_Decimal32 @var{a})
543 @deftypefnx {Runtime Function} _Decimal128 __extendddtd2 (_Decimal64 @var{a})
544 @c DFP/binary FP conversions
545 @deftypefnx {Runtime Function} _Decimal32 __extendsfsd (float @var{a})
546 @deftypefnx {Runtime Function} double __extendsddf (_Decimal32 @var{a})
547 @deftypefnx {Runtime Function} {long double} __extendsdxf (_Decimal32 @var{a})
548 @deftypefnx {Runtime Function} _Decimal64 __extendsfdd (float @var{a})
549 @deftypefnx {Runtime Function} _Decimal64 __extenddfdd (double @var{a})
550 @deftypefnx {Runtime Function} {long double} __extendddxf (_Decimal64 @var{a})
551 @deftypefnx {Runtime Function} _Decimal128 __extendsftd (float @var{a})
552 @deftypefnx {Runtime Function} _Decimal128 __extenddftd (double @var{a})
553 @deftypefnx {Runtime Function} _Decimal128 __extendxftd ({long double} @var{a})
554 These functions extend @var{a} to the wider mode of their return type.
555 @end deftypefn
556
557 @c DFP/DFP conversions
558 @deftypefn {Runtime Function} _Decimal32 __truncddsd2 (_Decimal64 @var{a})
559 @deftypefnx {Runtime Function} _Decimal32 __trunctdsd2 (_Decimal128 @var{a})
560 @deftypefnx {Runtime Function} _Decimal64 __trunctddd2 (_Decimal128 @var{a})
561 @c DFP/binary FP conversions
562 @deftypefnx {Runtime Function} float __truncsdsf (_Decimal32 @var{a})
563 @deftypefnx {Runtime Function} _Decimal32 __truncdfsd (double @var{a})
564 @deftypefnx {Runtime Function} _Decimal32 __truncxfsd ({long double} @var{a})
565 @deftypefnx {Runtime Function} float __truncddsf (_Decimal64 @var{a})
566 @deftypefnx {Runtime Function} double __truncdddf (_Decimal64 @var{a})
567 @deftypefnx {Runtime Function} _Decimal64 __truncxfdd ({long double} @var{a})
568 @deftypefnx {Runtime Function} float __trunctdsf (_Decimal128 @var{a})
569 @deftypefnx {Runtime Function} double __trunctddf (_Decimal128 @var{a})
570 @deftypefnx {Runtime Function} {long double} __trunctdxf (_Decimal128 @var{a})
571 These functions truncate @var{a} to the narrower mode of their return
572 type.
573 @end deftypefn
574
575 @deftypefn {Runtime Function} int __fixsdsi (_Decimal32 @var{a})
576 @deftypefnx {Runtime Function} int __fixddsi (_Decimal64 @var{a})
577 @deftypefnx {Runtime Function} int __fixtdsi (_Decimal128 @var{a})
578 These functions convert @var{a} to a signed integer.
579 @end deftypefn
580
581 @deftypefn {Runtime Function} long __fixsddi (_Decimal32 @var{a})
582 @deftypefnx {Runtime Function} long __fixdddi (_Decimal64 @var{a})
583 @deftypefnx {Runtime Function} long __fixtddi (_Decimal128 @var{a})
584 These functions convert @var{a} to a signed long.
585 @end deftypefn
586
587 @deftypefn {Runtime Function} {unsigned int} __fixunssdsi (_Decimal32 @var{a})
588 @deftypefnx {Runtime Function} {unsigned int} __fixunsddsi (_Decimal64 @var{a})
589 @deftypefnx {Runtime Function} {unsigned int} __fixunstdsi (_Decimal128 @var{a})
590 These functions convert @var{a} to an unsigned integer.  Negative values all become zero.
591 @end deftypefn
592
593 @deftypefn {Runtime Function} {unsigned long} __fixunssddi (_Decimal32 @var{a})
594 @deftypefnx {Runtime Function} {unsigned long} __fixunsdddi (_Decimal64 @var{a})
595 @deftypefnx {Runtime Function} {unsigned long} __fixunstddi (_Decimal128 @var{a})
596 These functions convert @var{a} to an unsigned long.  Negative values
597 all become zero.
598 @end deftypefn
599
600 @deftypefn {Runtime Function} _Decimal32 __floatsisd (int @var{i})
601 @deftypefnx {Runtime Function} _Decimal64 __floatsidd (int @var{i})
602 @deftypefnx {Runtime Function} _Decimal128 __floatsitd (int @var{i})
603 These functions convert @var{i}, a signed integer, to decimal floating point.
604 @end deftypefn
605
606 @deftypefn {Runtime Function} _Decimal32 __floatdisd (long @var{i})
607 @deftypefnx {Runtime Function} _Decimal64 __floatdidd (long @var{i})
608 @deftypefnx {Runtime Function} _Decimal128 __floatditd (long @var{i})
609 These functions convert @var{i}, a signed long, to decimal floating point.
610 @end deftypefn
611
612 @deftypefn {Runtime Function} _Decimal32 __floatunssisd (unsigned int @var{i})
613 @deftypefnx {Runtime Function} _Decimal64 __floatunssidd (unsigned int @var{i})
614 @deftypefnx {Runtime Function} _Decimal128 __floatunssitd (unsigned int @var{i})
615 These functions convert @var{i}, an unsigned integer, to decimal floating point.
616 @end deftypefn
617
618 @deftypefn {Runtime Function} _Decimal32 __floatunsdisd (unsigned long @var{i})
619 @deftypefnx {Runtime Function} _Decimal64 __floatunsdidd (unsigned long @var{i})
620 @deftypefnx {Runtime Function} _Decimal128 __floatunsditd (unsigned long @var{i})
621 These functions convert @var{i}, an unsigned long, to decimal floating point.
622 @end deftypefn
623
624 @subsection Comparison functions
625
626 @deftypefn {Runtime Function} int __unordsd2 (_Decimal32 @var{a}, _Decimal32 @var{b})
627 @deftypefnx {Runtime Function} int __unorddd2 (_Decimal64 @var{a}, _Decimal64 @var{b})
628 @deftypefnx {Runtime Function} int __unordtd2 (_Decimal128 @var{a}, _Decimal128 @var{b})
629 These functions return a nonzero value if either argument is NaN, otherwise 0.
630 @end deftypefn
631
632 There is also a complete group of higher level functions which
633 correspond directly to comparison operators.  They implement the ISO C
634 semantics for floating-point comparisons, taking NaN into account.
635 Pay careful attention to the return values defined for each set.
636 Under the hood, all of these routines are implemented as
637
638 @smallexample
639   if (__unord@var{X}d2 (a, b))
640     return @var{E};
641   return __cmp@var{X}d2 (a, b);
642 @end smallexample
643
644 @noindent
645 where @var{E} is a constant chosen to give the proper behavior for
646 NaN@.  Thus, the meaning of the return value is different for each set.
647 Do not rely on this implementation; only the semantics documented
648 below are guaranteed.
649
650 @deftypefn {Runtime Function} int __eqsd2 (_Decimal32 @var{a}, _Decimal32 @var{b})
651 @deftypefnx {Runtime Function} int __eqdd2 (_Decimal64 @var{a}, _Decimal64 @var{b})
652 @deftypefnx {Runtime Function} int __eqtd2 (_Decimal128 @var{a}, _Decimal128 @var{b})
653 These functions return zero if neither argument is NaN, and @var{a} and
654 @var{b} are equal.
655 @end deftypefn
656
657 @deftypefn {Runtime Function} int __nesd2 (_Decimal32 @var{a}, _Decimal32 @var{b})
658 @deftypefnx {Runtime Function} int __nedd2 (_Decimal64 @var{a}, _Decimal64 @var{b})
659 @deftypefnx {Runtime Function} int __netd2 (_Decimal128 @var{a}, _Decimal128 @var{b})
660 These functions return a nonzero value if either argument is NaN, or
661 if @var{a} and @var{b} are unequal.
662 @end deftypefn
663
664 @deftypefn {Runtime Function} int __gesd2 (_Decimal32 @var{a}, _Decimal32 @var{b})
665 @deftypefnx {Runtime Function} int __gedd2 (_Decimal64 @var{a}, _Decimal64 @var{b})
666 @deftypefnx {Runtime Function} int __getd2 (_Decimal128 @var{a}, _Decimal128 @var{b})
667 These functions return a value greater than or equal to zero if
668 neither argument is NaN, and @var{a} is greater than or equal to
669 @var{b}.
670 @end deftypefn
671
672 @deftypefn {Runtime Function} int __ltsd2 (_Decimal32 @var{a}, _Decimal32 @var{b})
673 @deftypefnx {Runtime Function} int __ltdd2 (_Decimal64 @var{a}, _Decimal64 @var{b})
674 @deftypefnx {Runtime Function} int __lttd2 (_Decimal128 @var{a}, _Decimal128 @var{b})
675 These functions return a value less than zero if neither argument is
676 NaN, and @var{a} is strictly less than @var{b}.
677 @end deftypefn
678
679 @deftypefn {Runtime Function} int __lesd2 (_Decimal32 @var{a}, _Decimal32 @var{b})
680 @deftypefnx {Runtime Function} int __ledd2 (_Decimal64 @var{a}, _Decimal64 @var{b})
681 @deftypefnx {Runtime Function} int __letd2 (_Decimal128 @var{a}, _Decimal128 @var{b})
682 These functions return a value less than or equal to zero if neither
683 argument is NaN, and @var{a} is less than or equal to @var{b}.
684 @end deftypefn
685
686 @deftypefn {Runtime Function} int __gtsd2 (_Decimal32 @var{a}, _Decimal32 @var{b})
687 @deftypefnx {Runtime Function} int __gtdd2 (_Decimal64 @var{a}, _Decimal64 @var{b})
688 @deftypefnx {Runtime Function} int __gttd2 (_Decimal128 @var{a}, _Decimal128 @var{b})
689 These functions return a value greater than zero if neither argument
690 is NaN, and @var{a} is strictly greater than @var{b}.
691 @end deftypefn
692
693 @node Exception handling routines
694 @section Language-independent routines for exception handling
695
696 document me!
697
698 @smallexample
699   _Unwind_DeleteException
700   _Unwind_Find_FDE
701   _Unwind_ForcedUnwind
702   _Unwind_GetGR
703   _Unwind_GetIP
704   _Unwind_GetLanguageSpecificData
705   _Unwind_GetRegionStart
706   _Unwind_GetTextRelBase
707   _Unwind_GetDataRelBase
708   _Unwind_RaiseException
709   _Unwind_Resume
710   _Unwind_SetGR
711   _Unwind_SetIP
712   _Unwind_FindEnclosingFunction
713   _Unwind_SjLj_Register
714   _Unwind_SjLj_Unregister
715   _Unwind_SjLj_RaiseException
716   _Unwind_SjLj_ForcedUnwind
717   _Unwind_SjLj_Resume
718   __deregister_frame
719   __deregister_frame_info
720   __deregister_frame_info_bases
721   __register_frame
722   __register_frame_info
723   __register_frame_info_bases
724   __register_frame_info_table
725   __register_frame_info_table_bases
726   __register_frame_table
727 @end smallexample
728
729 @node Miscellaneous routines
730 @section Miscellaneous runtime library routines
731
732 @subsection Cache control functions
733 @deftypefn {Runtime Function} void __clear_cache (char *@var{beg}, char *@var{end})
734 This function clears the instruction cache between @var{beg} and @var{end}.
735 @end deftypefn