[Main]
Title=Other built-in functions provided by GCC
Subsections=SEC104___builtin_constant_p, SEC104___builtin_types_compatible_p, SEC104___builtin_choose_expr, SEC104___builtin_expect, SEC104___builtin_prefetch

[Top]
GCC provides a large number of built-in functions.  Some of these are for internal use in the processing
of exceptions or variable-length argument lists and will not be
documented here because they may change from time to time; we do not
recommend general use of these functions.
<BR><BR>
The remaining functions are provided for optimization purposes.

[Bottom]
GCC includes built-in versions of many of the functions in the standard
C library.  The versions prefixed with <CODE>__builtin_</CODE> will always be
treated as having the same meaning as the C library function even if you
specify the <B>'-fno-builtin'</B> option (see <A HREF="$$INFOLINK(comopts/SEC6)">C Dialect Options</A>).
Many of these functions are only optimized in certain cases; if they are
not optimized in a particular case, a call to the library function will
be emitted
(but this does not make sense in TIGCC, as the standard C library is not provided with it).
<BR><BR>
The functions <CODE>abort</CODE>, <CODE>exit</CODE>, <CODE>_Exit</CODE> and <CODE>_exit</CODE>
are recognized and presumed not to return, but otherwise are not built
in (TIGCC defines them as macros anyway).  <CODE>_exit</CODE> is not recognized in strict ISO C mode (<B>'-ansi'</B>,
<B>'-std=c89'</B> or <B>'-std=c99'</B>).  <CODE>_Exit</CODE> is not recognized in
strict C89 mode (<B>'-ansi'</B> or <B>'-std=c89'</B>).  All these functions
have corresponding versions prefixed with <CODE>__builtin_</CODE>, which may be
used even in strict C89 mode.
<BR><BR>
Outside strict ISO C mode, the functions <CODE>alloca</CODE>, <CODE>bcmp</CODE>,
<CODE>bzero</CODE>, <CODE>index</CODE>, <CODE>rindex</CODE>, <CODE>ffs</CODE>, <CODE>fputs_unlocked</CODE>,
<CODE>printf_unlocked</CODE> and <CODE>fprintf_unlocked</CODE> may be handled as
built-in functions.  All these functions have corresponding versions
prefixed with <CODE>__builtin_</CODE>, which may be used even in strict C89
mode
(in TIGCC, <A HREF="$$LINK(alloc.h/alloca)">alloca</A> is built-in;
other than that only <CODE>__builtin_bzero</CODE> might be useful).
<BR><BR>
The ISO C99 functions <CODE>conj</CODE>, <CODE>conjf</CODE>, <CODE>conjl</CODE>,
<CODE>creal</CODE>, <CODE>crealf</CODE>, <CODE>creall</CODE>, <CODE>cimag</CODE>, <CODE>cimagf</CODE>,
<CODE>cimagl</CODE>, <CODE>imaxabs</CODE>, <CODE>llabs</CODE>, <CODE>snprintf</CODE>,
<CODE>vscanf</CODE>, <CODE>vsnprintf</CODE> and <CODE>vsscanf</CODE> are handled as built-in
functions except in strict ISO C90 mode.  There are also built-in
versions of the ISO C99 functions <CODE>cosf</CODE>, <CODE>cosl</CODE>,
<CODE>expf</CODE>, <CODE>expl</CODE>, <CODE>fabsf</CODE>, <CODE>fabsl</CODE>,
<CODE>logf</CODE>, <CODE>logl</CODE>, <CODE>sinf</CODE>, <CODE>sinl</CODE>, <CODE>sqrtf</CODE>, and
<CODE>sqrtl</CODE>, that are recognized in any mode since ISO C90 reserves
these names for the purpose to which ISO C99 puts them.  All these
functions have corresponding versions prefixed with <CODE>__builtin_</CODE>
(again, none of these are implemented in TIGCC).
<BR><BR>
The ISO C90 functions <CODE>abs</CODE>, <CODE>cos</CODE>, <CODE>exp</CODE>, <CODE>fabs</CODE>,
<CODE>fprintf</CODE>, <CODE>fputs</CODE>, <CODE>labs</CODE>, <CODE>log</CODE>,
<CODE>memcmp</CODE>, <CODE>memcpy</CODE>,
<CODE>memset</CODE>, <CODE>printf</CODE>, <CODE>putchar</CODE>, <CODE>puts</CODE>, <CODE>scanf</CODE>,
<CODE>sin</CODE>, <CODE>snprintf</CODE>, <CODE>sprintf</CODE>, <CODE>sqrt</CODE>, <CODE>sscanf</CODE>,
<CODE>strcat</CODE>,
<CODE>strchr</CODE>, <CODE>strcmp</CODE>, <CODE>strcpy</CODE>, <CODE>strcspn</CODE>,
<CODE>strlen</CODE>, <CODE>strncat</CODE>, <CODE>strncmp</CODE>, <CODE>strncpy</CODE>,
<CODE>strpbrk</CODE>, <CODE>strrchr</CODE>, <CODE>strspn</CODE>, <CODE>strstr</CODE>,
<CODE>vprintf</CODE> and <CODE>vsprintf</CODE> are all
recognized as built-in functions unless <B>'-fno-builtin'</B> is
specified (or <B>'-fno-builtin-<I>function</I>'</B> is specified for an
individual function).  All of these functions have corresponding
versions prefixed with <CODE>__builtin_</CODE>
(but most of these are defined as macros in TIGCC).
<BR><BR>
GCC provides built-in versions of the ISO C99 floating point comparison
macros that avoid raising exceptions for unordered operands.  They have
the same names as the standard macros (<CODE>isgreater</CODE>,
<CODE>isgreaterequal</CODE>, <CODE>isless</CODE>, <CODE>islessequal</CODE>,
<CODE>islessgreater</CODE>, and <CODE>isunordered</CODE>), with <CODE>__builtin_</CODE>
prefixed.  The GNU team intends for a library implementor to be able to simply
<CODE>#define</CODE> each standard macro to its built-in equivalent.
