You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
826 lines
60 KiB
HTML
826 lines
60 KiB
HTML
<html lang="en">
|
|
<head>
|
|
<title>Other Builtins - Using the GNU Compiler Collection (GCC)</title>
|
|
<meta http-equiv="Content-Type" content="text/html">
|
|
<meta name="description" content="Using the GNU Compiler Collection (GCC)">
|
|
<meta name="generator" content="makeinfo 4.13">
|
|
<link title="Top" rel="start" href="index.html#Top">
|
|
<link rel="up" href="C-Extensions.html#C-Extensions" title="C Extensions">
|
|
<link rel="prev" href="Cilk-Plus-Builtins.html#Cilk-Plus-Builtins" title="Cilk Plus Builtins">
|
|
<link rel="next" href="Target-Builtins.html#Target-Builtins" title="Target Builtins">
|
|
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
|
|
<!--
|
|
Copyright (C) 1988-2015 Free Software Foundation, Inc.
|
|
|
|
Permission is granted to copy, distribute and/or modify this document
|
|
under the terms of the GNU Free Documentation License, Version 1.3 or
|
|
any later version published by the Free Software Foundation; with the
|
|
Invariant Sections being ``Funding Free Software'', the Front-Cover
|
|
Texts being (a) (see below), and with the Back-Cover Texts being (b)
|
|
(see below). A copy of the license is included in the section entitled
|
|
``GNU Free Documentation License''.
|
|
|
|
(a) The FSF's Front-Cover Text is:
|
|
|
|
A GNU Manual
|
|
|
|
(b) The FSF's Back-Cover Text is:
|
|
|
|
You have freedom to copy and modify this GNU Manual, like GNU
|
|
software. Copies published by the Free Software Foundation raise
|
|
funds for GNU development.-->
|
|
<meta http-equiv="Content-Style-Type" content="text/css">
|
|
<style type="text/css"><!--
|
|
pre.display { font-family:inherit }
|
|
pre.format { font-family:inherit }
|
|
pre.smalldisplay { font-family:inherit; font-size:smaller }
|
|
pre.smallformat { font-family:inherit; font-size:smaller }
|
|
pre.smallexample { font-size:smaller }
|
|
pre.smalllisp { font-size:smaller }
|
|
span.sc { font-variant:small-caps }
|
|
span.roman { font-family:serif; font-weight:normal; }
|
|
span.sansserif { font-family:sans-serif; font-weight:normal; }
|
|
--></style>
|
|
</head>
|
|
<body>
|
|
<div class="node">
|
|
<a name="Other-Builtins"></a>
|
|
<p>
|
|
Next: <a rel="next" accesskey="n" href="Target-Builtins.html#Target-Builtins">Target Builtins</a>,
|
|
Previous: <a rel="previous" accesskey="p" href="Cilk-Plus-Builtins.html#Cilk-Plus-Builtins">Cilk Plus Builtins</a>,
|
|
Up: <a rel="up" accesskey="u" href="C-Extensions.html#C-Extensions">C Extensions</a>
|
|
<hr>
|
|
</div>
|
|
|
|
<h3 class="section">6.57 Other Built-in Functions Provided by GCC</h3>
|
|
|
|
<p><a name="index-built_002din-functions-3625"></a><a name="index-g_t_005f_005fbuiltin_005fcall_005fwith_005fstatic_005fchain-3626"></a><a name="index-g_t_005f_005fbuiltin_005ffpclassify-3627"></a><a name="index-g_t_005f_005fbuiltin_005fisfinite-3628"></a><a name="index-g_t_005f_005fbuiltin_005fisnormal-3629"></a><a name="index-g_t_005f_005fbuiltin_005fisgreater-3630"></a><a name="index-g_t_005f_005fbuiltin_005fisgreaterequal-3631"></a><a name="index-g_t_005f_005fbuiltin_005fisinf_005fsign-3632"></a><a name="index-g_t_005f_005fbuiltin_005fisless-3633"></a><a name="index-g_t_005f_005fbuiltin_005fislessequal-3634"></a><a name="index-g_t_005f_005fbuiltin_005fislessgreater-3635"></a><a name="index-g_t_005f_005fbuiltin_005fisunordered-3636"></a><a name="index-g_t_005f_005fbuiltin_005fpowi-3637"></a><a name="index-g_t_005f_005fbuiltin_005fpowif-3638"></a><a name="index-g_t_005f_005fbuiltin_005fpowil-3639"></a><a name="index-g_t_005fExit-3640"></a><a name="index-g_t_005fexit-3641"></a><a name="index-abort-3642"></a><a name="index-abs-3643"></a><a name="index-acos-3644"></a><a name="index-acosf-3645"></a><a name="index-acosh-3646"></a><a name="index-acoshf-3647"></a><a name="index-acoshl-3648"></a><a name="index-acosl-3649"></a><a name="index-alloca-3650"></a><a name="index-asin-3651"></a><a name="index-asinf-3652"></a><a name="index-asinh-3653"></a><a name="index-asinhf-3654"></a><a name="index-asinhl-3655"></a><a name="index-asinl-3656"></a><a name="index-atan-3657"></a><a name="index-atan2-3658"></a><a name="index-atan2f-3659"></a><a name="index-atan2l-3660"></a><a name="index-atanf-3661"></a><a name="index-atanh-3662"></a><a name="index-atanhf-3663"></a><a name="index-atanhl-3664"></a><a name="index-atanl-3665"></a><a name="index-bcmp-3666"></a><a name="index-bzero-3667"></a><a name="index-cabs-3668"></a><a name="index-cabsf-3669"></a><a name="index-cabsl-3670"></a><a name="index-cacos-3671"></a><a name="index-cacosf-3672"></a><a name="index-cacosh-3673"></a><a name="index-cacoshf-3674"></a><a name="index-cacoshl-3675"></a><a name="index-cacosl-3676"></a><a name="index-calloc-3677"></a><a name="index-carg-3678"></a><a name="index-cargf-3679"></a><a name="index-cargl-3680"></a><a name="index-casin-3681"></a><a name="index-casinf-3682"></a><a name="index-casinh-3683"></a><a name="index-casinhf-3684"></a><a name="index-casinhl-3685"></a><a name="index-casinl-3686"></a><a name="index-catan-3687"></a><a name="index-catanf-3688"></a><a name="index-catanh-3689"></a><a name="index-catanhf-3690"></a><a name="index-catanhl-3691"></a><a name="index-catanl-3692"></a><a name="index-cbrt-3693"></a><a name="index-cbrtf-3694"></a><a name="index-cbrtl-3695"></a><a name="index-ccos-3696"></a><a name="index-ccosf-3697"></a><a name="index-ccosh-3698"></a><a name="index-ccoshf-3699"></a><a name="index-ccoshl-3700"></a><a name="index-ccosl-3701"></a><a name="index-ceil-3702"></a><a name="index-ceilf-3703"></a><a name="index-ceill-3704"></a><a name="index-cexp-3705"></a><a name="index-cexpf-3706"></a><a name="index-cexpl-3707"></a><a name="index-cimag-3708"></a><a name="index-cimagf-3709"></a><a name="index-cimagl-3710"></a><a name="index-clog-3711"></a><a name="index-clogf-3712"></a><a name="index-clogl-3713"></a><a name="index-conj-3714"></a><a name="index-conjf-3715"></a><a name="index-conjl-3716"></a><a name="index-copysign-3717"></a><a name="index-copysignf-3718"></a><a name="index-copysignl-3719"></a><a name="index-cos-3720"></a><a name="index-cosf-3721"></a><a name="index-cosh-3722"></a><a name="index-coshf-3723"></a><a name="index-coshl-3724"></a><a name="index-cosl-3725"></a><a name="index-cpow-3726"></a><a name="index-cpowf-3727"></a><a name="index-cpowl-3728"></a><a name="index-cproj-3729"></a><a name="index-cprojf-3730"></a><a name="index-cprojl-3731"></a><a name="index-creal-3732"></a><a name="index-crealf-3733"></a><a name="index-creall-3734"></a><a name="index-csin-3735"></a><a name="index-csinf-3736"></a><a name="index-csinh-3737"></a><a name="index-csinhf-3738"></a><a name="index-csinhl-3739"></a><a name="index-csinl-3740"></a><a name="index-csqrt-3741"></a><a name="index-csqrtf-3742"></a><a name="index-csqrtl-3743"></a><a name="index-ctan-3744"></a><a name="index-ctanf-3745"></a><a name="index-ctanh-3746"></a><a name="index-ctanhf-3747"></a><a name="index-ctanhl-3748"></a><a name="index-ctanl-3749"></a><a name="index-dcgettext-3750"></a><a name="index-dgettext-3751"></a><a name="index-drem-3752"></a><a name="index-dremf-3753"></a><a name="index-dreml-3754"></a><a name="index-erf-3755"></a><a name="index-erfc-3756"></a><a name="index-erfcf-3757"></a><a name="index-erfcl-3758"></a><a name="index-erff-3759"></a><a name="index-erfl-3760"></a><a name="index-exit-3761"></a><a name="index-exp-3762"></a><a name="index-exp10-3763"></a><a name="index-exp10f-3764"></a><a name="index-exp10l-3765"></a><a name="index-exp2-3766"></a><a name="index-exp2f-3767"></a><a name="index-exp2l-3768"></a><a name="index-expf-3769"></a><a name="index-expl-3770"></a><a name="index-expm1-3771"></a><a name="index-expm1f-3772"></a><a name="index-expm1l-3773"></a><a name="index-fabs-3774"></a><a name="index-fabsf-3775"></a><a name="index-fabsl-3776"></a><a name="index-fdim-3777"></a><a name="index-fdimf-3778"></a><a name="index-fdiml-3779"></a><a name="index-ffs-3780"></a><a name="index-floor-3781"></a><a name="index-floorf-3782"></a><a name="index-floorl-3783"></a><a name="index-fma-3784"></a><a name="index-fmaf-3785"></a><a name="index-fmal-3786"></a><a name="index-fmax-3787"></a><a name="index-fmaxf-3788"></a><a name="index-fmaxl-3789"></a><a name="index-fmin-3790"></a><a name="index-fminf-3791"></a><a name="index-fminl-3792"></a><a name="index-fmod-3793"></a><a name="index-fmodf-3794"></a><a name="index-fmodl-3795"></a><a name="index-fprintf-3796"></a><a name="index-fprintf_005funlocked-3797"></a><a name="index-fputs-3798"></a><a name="index-fputs_005funlocked-3799"></a><a name="index-frexp-3800"></a><a name="index-frexpf-3801"></a><a name="index-frexpl-3802"></a><a name="index-fscanf-3803"></a><a name="index-gamma-3804"></a><a name="index-gammaf-3805"></a><a name="index-gammal-3806"></a><a name="index-gamma_005fr-3807"></a><a name="index-gammaf_005fr-3808"></a><a name="index-gammal_005fr-3809"></a><a name="index-gettext-3810"></a><a name="index-hypot-3811"></a><a name="index-hypotf-3812"></a><a name="index-hypotl-3813"></a><a name="index-ilogb-3814"></a><a name="index-ilogbf-3815"></a><a name="index-ilogbl-3816"></a><a name="index-imaxabs-3817"></a><a name="index-index-3818"></a><a name="index-isalnum-3819"></a><a name="index-isalpha-3820"></a><a name="index-isascii-3821"></a><a name="index-isblank-3822"></a><a name="index-iscntrl-3823"></a><a name="index-isdigit-3824"></a><a name="index-isgraph-3825"></a><a name="index-islower-3826"></a><a name="index-isprint-3827"></a><a name="index-ispunct-3828"></a><a name="index-isspace-3829"></a><a name="index-isupper-3830"></a><a name="index-iswalnum-3831"></a><a name="index-iswalpha-3832"></a><a name="index-iswblank-3833"></a><a name="index-iswcntrl-3834"></a><a name="index-iswdigit-3835"></a><a name="index-iswgraph-3836"></a><a name="index-iswlower-3837"></a><a name="index-iswprint-3838"></a><a name="index-iswpunct-3839"></a><a name="index-iswspace-3840"></a><a name="index-iswupper-3841"></a><a name="index-iswxdigit-3842"></a><a name="index-isxdigit-3843"></a><a name="index-j0-3844"></a><a name="index-j0f-3845"></a><a name="index-j0l-3846"></a><a name="index-j1-3847"></a><a name="index-j1f-3848"></a><a name="index-j1l-3849"></a><a name="index-jn-3850"></a><a name="index-jnf-3851"></a><a name="index-jnl-3852"></a><a name="index-labs-3853"></a><a name="index-ldexp-3854"></a><a name="index-ldexpf-3855"></a><a name="index-ldexpl-3856"></a><a name="index-lgamma-3857"></a><a name="index-lgammaf-3858"></a><a name="index-lgammal-3859"></a><a name="index-lgamma_005fr-3860"></a><a name="index-lgammaf_005fr-3861"></a><a name="index-lgammal_005fr-3862"></a><a name="index-llabs-3863"></a><a name="index-llrint-3864"></a><a name="index-llrintf-3865"></a><a name="index-llrintl-3866"></a><a name="index-llround-3867"></a><a name="index-llroundf-3868"></a><a name="index-llroundl-3869"></a><a name="index-log-3870"></a><a name="index-log10-3871"></a><a name="index-log10f-3872"></a><a name="index-log10l-3873"></a><a name="index-log1p-3874"></a><a name="index-log1pf-3875"></a><a name="index-log1pl-3876"></a><a name="index-log2-3877"></a><a name="index-log2f-3878"></a><a name="index-log2l-3879"></a><a name="index-logb-3880"></a><a name="index-logbf-3881"></a><a name="index-logbl-3882"></a><a name="index-logf-3883"></a><a name="index-logl-3884"></a><a name="index-lrint-3885"></a><a name="index-lrintf-3886"></a><a name="index-lrintl-3887"></a><a name="index-lround-3888"></a><a name="index-lroundf-3889"></a><a name="index-lroundl-3890"></a><a name="index-malloc-3891"></a><a name="index-memchr-3892"></a><a name="index-memcmp-3893"></a><a name="index-memcpy-3894"></a><a name="index-mempcpy-3895"></a><a name="index-memset-3896"></a><a name="index-modf-3897"></a><a name="index-modff-3898"></a><a name="index-modfl-3899"></a><a name="index-nearbyint-3900"></a><a name="index-nearbyintf-3901"></a><a name="index-nearbyintl-3902"></a><a name="index-nextafter-3903"></a><a name="index-nextafterf-3904"></a><a name="index-nextafterl-3905"></a><a name="index-nexttoward-3906"></a><a name="index-nexttowardf-3907"></a><a name="index-nexttowardl-3908"></a><a name="index-pow-3909"></a><a name="index-pow10-3910"></a><a name="index-pow10f-3911"></a><a name="index-pow10l-3912"></a><a name="index-powf-3913"></a><a name="index-powl-3914"></a><a name="index-printf-3915"></a><a name="index-printf_005funlocked-3916"></a><a name="index-putchar-3917"></a><a name="index-puts-3918"></a><a name="index-remainder-3919"></a><a name="index-remainderf-3920"></a><a name="index-remainderl-3921"></a><a name="index-remquo-3922"></a><a name="index-remquof-3923"></a><a name="index-remquol-3924"></a><a name="index-rindex-3925"></a><a name="index-rint-3926"></a><a name="index-rintf-3927"></a><a name="index-rintl-3928"></a><a name="index-round-3929"></a><a name="index-roundf-3930"></a><a name="index-roundl-3931"></a><a name="index-scalb-3932"></a><a name="index-scalbf-3933"></a><a name="index-scalbl-3934"></a><a name="index-scalbln-3935"></a><a name="index-scalblnf-3936"></a><a name="index-scalblnf-3937"></a><a name="index-scalbn-3938"></a><a name="index-scalbnf-3939"></a><a name="index-scanfnl-3940"></a><a name="index-signbit-3941"></a><a name="index-signbitf-3942"></a><a name="index-signbitl-3943"></a><a name="index-signbitd32-3944"></a><a name="index-signbitd64-3945"></a><a name="index-signbitd128-3946"></a><a name="index-significand-3947"></a><a name="index-significandf-3948"></a><a name="index-significandl-3949"></a><a name="index-sin-3950"></a><a name="index-sincos-3951"></a><a name="index-sincosf-3952"></a><a name="index-sincosl-3953"></a><a name="index-sinf-3954"></a><a name="index-sinh-3955"></a><a name="index-sinhf-3956"></a><a name="index-sinhl-3957"></a><a name="index-sinl-3958"></a><a name="index-snprintf-3959"></a><a name="index-sprintf-3960"></a><a name="index-sqrt-3961"></a><a name="index-sqrtf-3962"></a><a name="index-sqrtl-3963"></a><a name="index-sscanf-3964"></a><a name="index-stpcpy-3965"></a><a name="index-stpncpy-3966"></a><a name="index-strcasecmp-3967"></a><a name="index-strcat-3968"></a><a name="index-strchr-3969"></a><a name="index-strcmp-3970"></a><a name="index-strcpy-3971"></a><a name="index-strcspn-3972"></a><a name="index-strdup-3973"></a><a name="index-strfmon-3974"></a><a name="index-strftime-3975"></a><a name="index-strlen-3976"></a><a name="index-strncasecmp-3977"></a><a name="index-strncat-3978"></a><a name="index-strncmp-3979"></a><a name="index-strncpy-3980"></a><a name="index-strndup-3981"></a><a name="index-strpbrk-3982"></a><a name="index-strrchr-3983"></a><a name="index-strspn-3984"></a><a name="index-strstr-3985"></a><a name="index-tan-3986"></a><a name="index-tanf-3987"></a><a name="index-tanh-3988"></a><a name="index-tanhf-3989"></a><a name="index-tanhl-3990"></a><a name="index-tanl-3991"></a><a name="index-tgamma-3992"></a><a name="index-tgammaf-3993"></a><a name="index-tgammal-3994"></a><a name="index-toascii-3995"></a><a name="index-tolower-3996"></a><a name="index-toupper-3997"></a><a name="index-towlower-3998"></a><a name="index-towupper-3999"></a><a name="index-trunc-4000"></a><a name="index-truncf-4001"></a><a name="index-truncl-4002"></a><a name="index-vfprintf-4003"></a><a name="index-vfscanf-4004"></a><a name="index-vprintf-4005"></a><a name="index-vscanf-4006"></a><a name="index-vsnprintf-4007"></a><a name="index-vsprintf-4008"></a><a name="index-vsscanf-4009"></a><a name="index-y0-4010"></a><a name="index-y0f-4011"></a><a name="index-y0l-4012"></a><a name="index-y1-4013"></a><a name="index-y1f-4014"></a><a name="index-y1l-4015"></a><a name="index-yn-4016"></a><a name="index-ynf-4017"></a><a name="index-ynl-4018"></a>
|
|
GCC provides a large number of built-in functions other than the ones
|
|
mentioned above. Some of these are for internal use in the processing
|
|
of exceptions or variable-length argument lists and are not
|
|
documented here because they may change from time to time; we do not
|
|
recommend general use of these functions.
|
|
|
|
<p>The remaining functions are provided for optimization purposes.
|
|
|
|
<p><a name="index-fno_002dbuiltin-4019"></a>GCC includes built-in versions of many of the functions in the standard
|
|
C library. The versions prefixed with <code>__builtin_</code> are always
|
|
treated as having the same meaning as the C library function even if you
|
|
specify the <samp><span class="option">-fno-builtin</span></samp> option. (see <a href="C-Dialect-Options.html#C-Dialect-Options">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 is
|
|
emitted.
|
|
|
|
<p><a name="index-ansi-4020"></a><a name="index-std-4021"></a>Outside strict ISO C mode (<samp><span class="option">-ansi</span></samp>, <samp><span class="option">-std=c90</span></samp>,
|
|
<samp><span class="option">-std=c99</span></samp> or <samp><span class="option">-std=c11</span></samp>), the functions
|
|
<code>_exit</code>, <code>alloca</code>, <code>bcmp</code>, <code>bzero</code>,
|
|
<code>dcgettext</code>, <code>dgettext</code>, <code>dremf</code>, <code>dreml</code>,
|
|
<code>drem</code>, <code>exp10f</code>, <code>exp10l</code>, <code>exp10</code>, <code>ffsll</code>,
|
|
<code>ffsl</code>, <code>ffs</code>, <code>fprintf_unlocked</code>,
|
|
<code>fputs_unlocked</code>, <code>gammaf</code>, <code>gammal</code>, <code>gamma</code>,
|
|
<code>gammaf_r</code>, <code>gammal_r</code>, <code>gamma_r</code>, <code>gettext</code>,
|
|
<code>index</code>, <code>isascii</code>, <code>j0f</code>, <code>j0l</code>, <code>j0</code>,
|
|
<code>j1f</code>, <code>j1l</code>, <code>j1</code>, <code>jnf</code>, <code>jnl</code>, <code>jn</code>,
|
|
<code>lgammaf_r</code>, <code>lgammal_r</code>, <code>lgamma_r</code>, <code>mempcpy</code>,
|
|
<code>pow10f</code>, <code>pow10l</code>, <code>pow10</code>, <code>printf_unlocked</code>,
|
|
<code>rindex</code>, <code>scalbf</code>, <code>scalbl</code>, <code>scalb</code>,
|
|
<code>signbit</code>, <code>signbitf</code>, <code>signbitl</code>, <code>signbitd32</code>,
|
|
<code>signbitd64</code>, <code>signbitd128</code>, <code>significandf</code>,
|
|
<code>significandl</code>, <code>significand</code>, <code>sincosf</code>,
|
|
<code>sincosl</code>, <code>sincos</code>, <code>stpcpy</code>, <code>stpncpy</code>,
|
|
<code>strcasecmp</code>, <code>strdup</code>, <code>strfmon</code>, <code>strncasecmp</code>,
|
|
<code>strndup</code>, <code>toascii</code>, <code>y0f</code>, <code>y0l</code>, <code>y0</code>,
|
|
<code>y1f</code>, <code>y1l</code>, <code>y1</code>, <code>ynf</code>, <code>ynl</code> and
|
|
<code>yn</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 C90
|
|
mode.
|
|
|
|
<p>The ISO C99 functions
|
|
<code>_Exit</code>, <code>acoshf</code>, <code>acoshl</code>, <code>acosh</code>, <code>asinhf</code>,
|
|
<code>asinhl</code>, <code>asinh</code>, <code>atanhf</code>, <code>atanhl</code>, <code>atanh</code>,
|
|
<code>cabsf</code>, <code>cabsl</code>, <code>cabs</code>, <code>cacosf</code>, <code>cacoshf</code>,
|
|
<code>cacoshl</code>, <code>cacosh</code>, <code>cacosl</code>, <code>cacos</code>,
|
|
<code>cargf</code>, <code>cargl</code>, <code>carg</code>, <code>casinf</code>, <code>casinhf</code>,
|
|
<code>casinhl</code>, <code>casinh</code>, <code>casinl</code>, <code>casin</code>,
|
|
<code>catanf</code>, <code>catanhf</code>, <code>catanhl</code>, <code>catanh</code>,
|
|
<code>catanl</code>, <code>catan</code>, <code>cbrtf</code>, <code>cbrtl</code>, <code>cbrt</code>,
|
|
<code>ccosf</code>, <code>ccoshf</code>, <code>ccoshl</code>, <code>ccosh</code>, <code>ccosl</code>,
|
|
<code>ccos</code>, <code>cexpf</code>, <code>cexpl</code>, <code>cexp</code>, <code>cimagf</code>,
|
|
<code>cimagl</code>, <code>cimag</code>, <code>clogf</code>, <code>clogl</code>, <code>clog</code>,
|
|
<code>conjf</code>, <code>conjl</code>, <code>conj</code>, <code>copysignf</code>, <code>copysignl</code>,
|
|
<code>copysign</code>, <code>cpowf</code>, <code>cpowl</code>, <code>cpow</code>, <code>cprojf</code>,
|
|
<code>cprojl</code>, <code>cproj</code>, <code>crealf</code>, <code>creall</code>, <code>creal</code>,
|
|
<code>csinf</code>, <code>csinhf</code>, <code>csinhl</code>, <code>csinh</code>, <code>csinl</code>,
|
|
<code>csin</code>, <code>csqrtf</code>, <code>csqrtl</code>, <code>csqrt</code>, <code>ctanf</code>,
|
|
<code>ctanhf</code>, <code>ctanhl</code>, <code>ctanh</code>, <code>ctanl</code>, <code>ctan</code>,
|
|
<code>erfcf</code>, <code>erfcl</code>, <code>erfc</code>, <code>erff</code>, <code>erfl</code>,
|
|
<code>erf</code>, <code>exp2f</code>, <code>exp2l</code>, <code>exp2</code>, <code>expm1f</code>,
|
|
<code>expm1l</code>, <code>expm1</code>, <code>fdimf</code>, <code>fdiml</code>, <code>fdim</code>,
|
|
<code>fmaf</code>, <code>fmal</code>, <code>fmaxf</code>, <code>fmaxl</code>, <code>fmax</code>,
|
|
<code>fma</code>, <code>fminf</code>, <code>fminl</code>, <code>fmin</code>, <code>hypotf</code>,
|
|
<code>hypotl</code>, <code>hypot</code>, <code>ilogbf</code>, <code>ilogbl</code>, <code>ilogb</code>,
|
|
<code>imaxabs</code>, <code>isblank</code>, <code>iswblank</code>, <code>lgammaf</code>,
|
|
<code>lgammal</code>, <code>lgamma</code>, <code>llabs</code>, <code>llrintf</code>, <code>llrintl</code>,
|
|
<code>llrint</code>, <code>llroundf</code>, <code>llroundl</code>, <code>llround</code>,
|
|
<code>log1pf</code>, <code>log1pl</code>, <code>log1p</code>, <code>log2f</code>, <code>log2l</code>,
|
|
<code>log2</code>, <code>logbf</code>, <code>logbl</code>, <code>logb</code>, <code>lrintf</code>,
|
|
<code>lrintl</code>, <code>lrint</code>, <code>lroundf</code>, <code>lroundl</code>,
|
|
<code>lround</code>, <code>nearbyintf</code>, <code>nearbyintl</code>, <code>nearbyint</code>,
|
|
<code>nextafterf</code>, <code>nextafterl</code>, <code>nextafter</code>,
|
|
<code>nexttowardf</code>, <code>nexttowardl</code>, <code>nexttoward</code>,
|
|
<code>remainderf</code>, <code>remainderl</code>, <code>remainder</code>, <code>remquof</code>,
|
|
<code>remquol</code>, <code>remquo</code>, <code>rintf</code>, <code>rintl</code>, <code>rint</code>,
|
|
<code>roundf</code>, <code>roundl</code>, <code>round</code>, <code>scalblnf</code>,
|
|
<code>scalblnl</code>, <code>scalbln</code>, <code>scalbnf</code>, <code>scalbnl</code>,
|
|
<code>scalbn</code>, <code>snprintf</code>, <code>tgammaf</code>, <code>tgammal</code>,
|
|
<code>tgamma</code>, <code>truncf</code>, <code>truncl</code>, <code>trunc</code>,
|
|
<code>vfscanf</code>, <code>vscanf</code>, <code>vsnprintf</code> and <code>vsscanf</code>
|
|
are handled as built-in functions
|
|
except in strict ISO C90 mode (<samp><span class="option">-ansi</span></samp> or <samp><span class="option">-std=c90</span></samp>).
|
|
|
|
<p>There are also built-in versions of the ISO C99 functions
|
|
<code>acosf</code>, <code>acosl</code>, <code>asinf</code>, <code>asinl</code>, <code>atan2f</code>,
|
|
<code>atan2l</code>, <code>atanf</code>, <code>atanl</code>, <code>ceilf</code>, <code>ceill</code>,
|
|
<code>cosf</code>, <code>coshf</code>, <code>coshl</code>, <code>cosl</code>, <code>expf</code>,
|
|
<code>expl</code>, <code>fabsf</code>, <code>fabsl</code>, <code>floorf</code>, <code>floorl</code>,
|
|
<code>fmodf</code>, <code>fmodl</code>, <code>frexpf</code>, <code>frexpl</code>, <code>ldexpf</code>,
|
|
<code>ldexpl</code>, <code>log10f</code>, <code>log10l</code>, <code>logf</code>, <code>logl</code>,
|
|
<code>modfl</code>, <code>modf</code>, <code>powf</code>, <code>powl</code>, <code>sinf</code>,
|
|
<code>sinhf</code>, <code>sinhl</code>, <code>sinl</code>, <code>sqrtf</code>, <code>sqrtl</code>,
|
|
<code>tanf</code>, <code>tanhf</code>, <code>tanhl</code> and <code>tanl</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>.
|
|
|
|
<p>The ISO C94 functions
|
|
<code>iswalnum</code>, <code>iswalpha</code>, <code>iswcntrl</code>, <code>iswdigit</code>,
|
|
<code>iswgraph</code>, <code>iswlower</code>, <code>iswprint</code>, <code>iswpunct</code>,
|
|
<code>iswspace</code>, <code>iswupper</code>, <code>iswxdigit</code>, <code>towlower</code> and
|
|
<code>towupper</code>
|
|
are handled as built-in functions
|
|
except in strict ISO C90 mode (<samp><span class="option">-ansi</span></samp> or <samp><span class="option">-std=c90</span></samp>).
|
|
|
|
<p>The ISO C90 functions
|
|
<code>abort</code>, <code>abs</code>, <code>acos</code>, <code>asin</code>, <code>atan2</code>,
|
|
<code>atan</code>, <code>calloc</code>, <code>ceil</code>, <code>cosh</code>, <code>cos</code>,
|
|
<code>exit</code>, <code>exp</code>, <code>fabs</code>, <code>floor</code>, <code>fmod</code>,
|
|
<code>fprintf</code>, <code>fputs</code>, <code>frexp</code>, <code>fscanf</code>,
|
|
<code>isalnum</code>, <code>isalpha</code>, <code>iscntrl</code>, <code>isdigit</code>,
|
|
<code>isgraph</code>, <code>islower</code>, <code>isprint</code>, <code>ispunct</code>,
|
|
<code>isspace</code>, <code>isupper</code>, <code>isxdigit</code>, <code>tolower</code>,
|
|
<code>toupper</code>, <code>labs</code>, <code>ldexp</code>, <code>log10</code>, <code>log</code>,
|
|
<code>malloc</code>, <code>memchr</code>, <code>memcmp</code>, <code>memcpy</code>,
|
|
<code>memset</code>, <code>modf</code>, <code>pow</code>, <code>printf</code>, <code>putchar</code>,
|
|
<code>puts</code>, <code>scanf</code>, <code>sinh</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>tanh</code>, <code>tan</code>, <code>vfprintf</code>, <code>vprintf</code> and <code>vsprintf</code>
|
|
are all recognized as built-in functions unless
|
|
<samp><span class="option">-fno-builtin</span></samp> is specified (or <samp><span class="option">-fno-builtin-</span><var>function</var></samp>
|
|
is specified for an individual function). All of these functions have
|
|
corresponding versions prefixed with <code>__builtin_</code>.
|
|
|
|
<p>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. We intend for a library implementor to be able to simply
|
|
<code>#define</code> each standard macro to its built-in equivalent.
|
|
In the same fashion, GCC provides <code>fpclassify</code>, <code>isfinite</code>,
|
|
<code>isinf_sign</code> and <code>isnormal</code> built-ins used with
|
|
<code>__builtin_</code> prefixed. The <code>isinf</code> and <code>isnan</code>
|
|
built-in functions appear both with and without the <code>__builtin_</code> prefix.
|
|
|
|
<div class="defun">
|
|
— Built-in Function: int <b>__builtin_types_compatible_p</b> (<var>type1, type2</var>)<var><a name="index-g_t_005f_005fbuiltin_005ftypes_005fcompatible_005fp-4022"></a></var><br>
|
|
<blockquote>
|
|
<p>You can use the built-in function <code>__builtin_types_compatible_p</code> to
|
|
determine whether two types are the same.
|
|
|
|
<p>This built-in function returns 1 if the unqualified versions of the
|
|
types <var>type1</var> and <var>type2</var> (which are types, not expressions) are
|
|
compatible, 0 otherwise. The result of this built-in function can be
|
|
used in integer constant expressions.
|
|
|
|
<p>This built-in function ignores top level qualifiers (e.g., <code>const</code>,
|
|
<code>volatile</code>). For example, <code>int</code> is equivalent to <code>const
|
|
int</code>.
|
|
|
|
<p>The type <code>int[]</code> and <code>int[5]</code> are compatible. On the other
|
|
hand, <code>int</code> and <code>char *</code> are not compatible, even if the size
|
|
of their types, on the particular architecture are the same. Also, the
|
|
amount of pointer indirection is taken into account when determining
|
|
similarity. Consequently, <code>short *</code> is not similar to
|
|
<code>short **</code>. Furthermore, two types that are typedefed are
|
|
considered compatible if their underlying types are compatible.
|
|
|
|
<p>An <code>enum</code> type is not considered to be compatible with another
|
|
<code>enum</code> type even if both are compatible with the same integer
|
|
type; this is what the C standard specifies.
|
|
For example, <code>enum {foo, bar}</code> is not similar to
|
|
<code>enum {hot, dog}</code>.
|
|
|
|
<p>You typically use this function in code whose execution varies
|
|
depending on the arguments' types. For example:
|
|
|
|
<pre class="smallexample"> #define foo(x) \
|
|
({ \
|
|
typeof (x) tmp = (x); \
|
|
if (__builtin_types_compatible_p (typeof (x), long double)) \
|
|
tmp = foo_long_double (tmp); \
|
|
else if (__builtin_types_compatible_p (typeof (x), double)) \
|
|
tmp = foo_double (tmp); \
|
|
else if (__builtin_types_compatible_p (typeof (x), float)) \
|
|
tmp = foo_float (tmp); \
|
|
else \
|
|
abort (); \
|
|
tmp; \
|
|
})
|
|
</pre>
|
|
<p><em>Note:</em> This construct is only available for C.
|
|
|
|
</blockquote></div>
|
|
|
|
<div class="defun">
|
|
— Built-in Function: <var>type</var> <b>__builtin_call_with_static_chain</b> (<var>call_exp, pointer_exp</var>)<var><a name="index-g_t_005f_005fbuiltin_005fcall_005fwith_005fstatic_005fchain-4023"></a></var><br>
|
|
<blockquote>
|
|
<p>The <var>call_exp</var> expression must be a function call, and the
|
|
<var>pointer_exp</var> expression must be a pointer. The <var>pointer_exp</var>
|
|
is passed to the function call in the target's static chain location.
|
|
The result of builtin is the result of the function call.
|
|
|
|
<p><em>Note:</em> This builtin is only available for C.
|
|
This builtin can be used to call Go closures from C.
|
|
|
|
</blockquote></div>
|
|
|
|
<div class="defun">
|
|
— Built-in Function: <var>type</var> <b>__builtin_choose_expr</b> (<var>const_exp, exp1, exp2</var>)<var><a name="index-g_t_005f_005fbuiltin_005fchoose_005fexpr-4024"></a></var><br>
|
|
<blockquote>
|
|
<p>You can use the built-in function <code>__builtin_choose_expr</code> to
|
|
evaluate code depending on the value of a constant expression. This
|
|
built-in function returns <var>exp1</var> if <var>const_exp</var>, which is an
|
|
integer constant expression, is nonzero. Otherwise it returns <var>exp2</var>.
|
|
|
|
<p>This built-in function is analogous to the ‘<samp><span class="samp">? :</span></samp>’ operator in C,
|
|
except that the expression returned has its type unaltered by promotion
|
|
rules. Also, the built-in function does not evaluate the expression
|
|
that is not chosen. For example, if <var>const_exp</var> evaluates to true,
|
|
<var>exp2</var> is not evaluated even if it has side-effects.
|
|
|
|
<p>This built-in function can return an lvalue if the chosen argument is an
|
|
lvalue.
|
|
|
|
<p>If <var>exp1</var> is returned, the return type is the same as <var>exp1</var>'s
|
|
type. Similarly, if <var>exp2</var> is returned, its return type is the same
|
|
as <var>exp2</var>.
|
|
|
|
<p>Example:
|
|
|
|
<pre class="smallexample"> #define foo(x) \
|
|
__builtin_choose_expr ( \
|
|
__builtin_types_compatible_p (typeof (x), double), \
|
|
foo_double (x), \
|
|
__builtin_choose_expr ( \
|
|
__builtin_types_compatible_p (typeof (x), float), \
|
|
foo_float (x), \
|
|
/* <span class="roman">The void expression results in a compile-time error</span> \
|
|
<span class="roman">when assigning the result to something.</span> */ \
|
|
(void)0))
|
|
</pre>
|
|
<p><em>Note:</em> This construct is only available for C. Furthermore, the
|
|
unused expression (<var>exp1</var> or <var>exp2</var> depending on the value of
|
|
<var>const_exp</var>) may still generate syntax errors. This may change in
|
|
future revisions.
|
|
|
|
</blockquote></div>
|
|
|
|
<div class="defun">
|
|
— Built-in Function: <var>type</var> <b>__builtin_complex</b> (<var>real, imag</var>)<var><a name="index-g_t_005f_005fbuiltin_005fcomplex-4025"></a></var><br>
|
|
<blockquote>
|
|
<p>The built-in function <code>__builtin_complex</code> is provided for use in
|
|
implementing the ISO C11 macros <code>CMPLXF</code>, <code>CMPLX</code> and
|
|
<code>CMPLXL</code>. <var>real</var> and <var>imag</var> must have the same type, a
|
|
real binary floating-point type, and the result has the corresponding
|
|
complex type with real and imaginary parts <var>real</var> and <var>imag</var>.
|
|
Unlike ‘<samp><var>real</var><span class="samp"> + I * </span><var>imag</var></samp>’, this works even when
|
|
infinities, NaNs and negative zeros are involved.
|
|
|
|
</blockquote></div>
|
|
|
|
<div class="defun">
|
|
— Built-in Function: int <b>__builtin_constant_p</b> (<var>exp</var>)<var><a name="index-g_t_005f_005fbuiltin_005fconstant_005fp-4026"></a></var><br>
|
|
<blockquote><p>You can use the built-in function <code>__builtin_constant_p</code> to
|
|
determine if a value is known to be constant at compile time and hence
|
|
that GCC can perform constant-folding on expressions involving that
|
|
value. The argument of the function is the value to test. The function
|
|
returns the integer 1 if the argument is known to be a compile-time
|
|
constant and 0 if it is not known to be a compile-time constant. A
|
|
return of 0 does not indicate that the value is <em>not</em> a constant,
|
|
but merely that GCC cannot prove it is a constant with the specified
|
|
value of the <samp><span class="option">-O</span></samp> option.
|
|
|
|
<p>You typically use this function in an embedded application where
|
|
memory is a critical resource. If you have some complex calculation,
|
|
you may want it to be folded if it involves constants, but need to call
|
|
a function if it does not. For example:
|
|
|
|
<pre class="smallexample"> #define Scale_Value(X) \
|
|
(__builtin_constant_p (X) \
|
|
? ((X) * SCALE + OFFSET) : Scale (X))
|
|
</pre>
|
|
<p>You may use this built-in function in either a macro or an inline
|
|
function. However, if you use it in an inlined function and pass an
|
|
argument of the function as the argument to the built-in, GCC
|
|
never returns 1 when you call the inline function with a string constant
|
|
or compound literal (see <a href="Compound-Literals.html#Compound-Literals">Compound Literals</a>) and does not return 1
|
|
when you pass a constant numeric value to the inline function unless you
|
|
specify the <samp><span class="option">-O</span></samp> option.
|
|
|
|
<p>You may also use <code>__builtin_constant_p</code> in initializers for static
|
|
data. For instance, you can write
|
|
|
|
<pre class="smallexample"> static const int table[] = {
|
|
__builtin_constant_p (EXPRESSION) ? (EXPRESSION) : -1,
|
|
/* <span class="roman">...</span> */
|
|
};
|
|
</pre>
|
|
<p class="noindent">This is an acceptable initializer even if <var>EXPRESSION</var> is not a
|
|
constant expression, including the case where
|
|
<code>__builtin_constant_p</code> returns 1 because <var>EXPRESSION</var> can be
|
|
folded to a constant but <var>EXPRESSION</var> contains operands that are
|
|
not otherwise permitted in a static initializer (for example,
|
|
<code>0 && foo ()</code>). GCC must be more conservative about evaluating the
|
|
built-in in this case, because it has no opportunity to perform
|
|
optimization.
|
|
</p></blockquote></div>
|
|
|
|
<div class="defun">
|
|
— Built-in Function: long <b>__builtin_expect</b> (<var>long exp, long c</var>)<var><a name="index-g_t_005f_005fbuiltin_005fexpect-4027"></a></var><br>
|
|
<blockquote><p><a name="index-fprofile_002darcs-4028"></a>You may use <code>__builtin_expect</code> to provide the compiler with
|
|
branch prediction information. In general, you should prefer to
|
|
use actual profile feedback for this (<samp><span class="option">-fprofile-arcs</span></samp>), as
|
|
programmers are notoriously bad at predicting how their programs
|
|
actually perform. However, there are applications in which this
|
|
data is hard to collect.
|
|
|
|
<p>The return value is the value of <var>exp</var>, which should be an integral
|
|
expression. The semantics of the built-in are that it is expected that
|
|
<var>exp</var> == <var>c</var>. For example:
|
|
|
|
<pre class="smallexample"> if (__builtin_expect (x, 0))
|
|
foo ();
|
|
</pre>
|
|
<p class="noindent">indicates that we do not expect to call <code>foo</code>, since
|
|
we expect <code>x</code> to be zero. Since you are limited to integral
|
|
expressions for <var>exp</var>, you should use constructions such as
|
|
|
|
<pre class="smallexample"> if (__builtin_expect (ptr != NULL, 1))
|
|
foo (*ptr);
|
|
</pre>
|
|
<p class="noindent">when testing pointer or floating-point values.
|
|
</p></blockquote></div>
|
|
|
|
<div class="defun">
|
|
— Built-in Function: void <b>__builtin_trap</b> (<var>void</var>)<var><a name="index-g_t_005f_005fbuiltin_005ftrap-4029"></a></var><br>
|
|
<blockquote><p>This function causes the program to exit abnormally. GCC implements
|
|
this function by using a target-dependent mechanism (such as
|
|
intentionally executing an illegal instruction) or by calling
|
|
<code>abort</code>. The mechanism used may vary from release to release so
|
|
you should not rely on any particular implementation.
|
|
</p></blockquote></div>
|
|
|
|
<div class="defun">
|
|
— Built-in Function: void <b>__builtin_unreachable</b> (<var>void</var>)<var><a name="index-g_t_005f_005fbuiltin_005funreachable-4030"></a></var><br>
|
|
<blockquote><p>If control flow reaches the point of the <code>__builtin_unreachable</code>,
|
|
the program is undefined. It is useful in situations where the
|
|
compiler cannot deduce the unreachability of the code.
|
|
|
|
<p>One such case is immediately following an <code>asm</code> statement that
|
|
either never terminates, or one that transfers control elsewhere
|
|
and never returns. In this example, without the
|
|
<code>__builtin_unreachable</code>, GCC issues a warning that control
|
|
reaches the end of a non-void function. It also generates code
|
|
to return after the <code>asm</code>.
|
|
|
|
<pre class="smallexample"> int f (int c, int v)
|
|
{
|
|
if (c)
|
|
{
|
|
return v;
|
|
}
|
|
else
|
|
{
|
|
asm("jmp error_handler");
|
|
__builtin_unreachable ();
|
|
}
|
|
}
|
|
</pre>
|
|
<p class="noindent">Because the <code>asm</code> statement unconditionally transfers control out
|
|
of the function, control never reaches the end of the function
|
|
body. The <code>__builtin_unreachable</code> is in fact unreachable and
|
|
communicates this fact to the compiler.
|
|
|
|
<p>Another use for <code>__builtin_unreachable</code> is following a call a
|
|
function that never returns but that is not declared
|
|
<code>__attribute__((noreturn))</code>, as in this example:
|
|
|
|
<pre class="smallexample"> void function_that_never_returns (void);
|
|
|
|
int g (int c)
|
|
{
|
|
if (c)
|
|
{
|
|
return 1;
|
|
}
|
|
else
|
|
{
|
|
function_that_never_returns ();
|
|
__builtin_unreachable ();
|
|
}
|
|
}
|
|
</pre>
|
|
</blockquote></div>
|
|
|
|
<div class="defun">
|
|
— Built-in Function: void <b>*__builtin_assume_aligned</b> (<var>const void *exp, size_t align, ...</var>)<var><a name="index-g_t_002a_005f_005fbuiltin_005fassume_005faligned-4031"></a></var><br>
|
|
<blockquote><p>This function returns its first argument, and allows the compiler
|
|
to assume that the returned pointer is at least <var>align</var> bytes
|
|
aligned. This built-in can have either two or three arguments,
|
|
if it has three, the third argument should have integer type, and
|
|
if it is nonzero means misalignment offset. For example:
|
|
|
|
<pre class="smallexample"> void *x = __builtin_assume_aligned (arg, 16);
|
|
</pre>
|
|
<p class="noindent">means that the compiler can assume <code>x</code>, set to <code>arg</code>, is at least
|
|
16-byte aligned, while:
|
|
|
|
<pre class="smallexample"> void *x = __builtin_assume_aligned (arg, 32, 8);
|
|
</pre>
|
|
<p class="noindent">means that the compiler can assume for <code>x</code>, set to <code>arg</code>, that
|
|
<code>(char *) x - 8</code> is 32-byte aligned.
|
|
</p></blockquote></div>
|
|
|
|
<div class="defun">
|
|
— Built-in Function: int <b>__builtin_LINE</b> ()<var><a name="index-g_t_005f_005fbuiltin_005fLINE-4032"></a></var><br>
|
|
<blockquote><p>This function is the equivalent to the preprocessor <code>__LINE__</code>
|
|
macro and returns the line number of the invocation of the built-in.
|
|
In a C++ default argument for a function <var>F</var>, it gets the line number of
|
|
the call to <var>F</var>.
|
|
</p></blockquote></div>
|
|
|
|
<div class="defun">
|
|
— Built-in Function: const char * <b>__builtin_FUNCTION</b> ()<var><a name="index-g_t_005f_005fbuiltin_005fFUNCTION-4033"></a></var><br>
|
|
<blockquote><p>This function is the equivalent to the preprocessor <code>__FUNCTION__</code>
|
|
macro and returns the function name the invocation of the built-in is in.
|
|
</p></blockquote></div>
|
|
|
|
<div class="defun">
|
|
— Built-in Function: const char * <b>__builtin_FILE</b> ()<var><a name="index-g_t_005f_005fbuiltin_005fFILE-4034"></a></var><br>
|
|
<blockquote><p>This function is the equivalent to the preprocessor <code>__FILE__</code>
|
|
macro and returns the file name the invocation of the built-in is in.
|
|
In a C++ default argument for a function <var>F</var>, it gets the file name of
|
|
the call to <var>F</var>.
|
|
</p></blockquote></div>
|
|
|
|
<div class="defun">
|
|
— Built-in Function: void <b>__builtin___clear_cache</b> (<var>char *begin, char *end</var>)<var><a name="index-g_t_005f_005fbuiltin_005f_005f_005fclear_005fcache-4035"></a></var><br>
|
|
<blockquote><p>This function is used to flush the processor's instruction cache for
|
|
the region of memory between <var>begin</var> inclusive and <var>end</var>
|
|
exclusive. Some targets require that the instruction cache be
|
|
flushed, after modifying memory containing code, in order to obtain
|
|
deterministic behavior.
|
|
|
|
<p>If the target does not require instruction cache flushes,
|
|
<code>__builtin___clear_cache</code> has no effect. Otherwise either
|
|
instructions are emitted in-line to clear the instruction cache or a
|
|
call to the <code>__clear_cache</code> function in libgcc is made.
|
|
</p></blockquote></div>
|
|
|
|
<div class="defun">
|
|
— Built-in Function: void <b>__builtin_prefetch</b> (<var>const void *addr, ...</var>)<var><a name="index-g_t_005f_005fbuiltin_005fprefetch-4036"></a></var><br>
|
|
<blockquote><p>This function is used to minimize cache-miss latency by moving data into
|
|
a cache before it is accessed.
|
|
You can insert calls to <code>__builtin_prefetch</code> into code for which
|
|
you know addresses of data in memory that is likely to be accessed soon.
|
|
If the target supports them, data prefetch instructions are generated.
|
|
If the prefetch is done early enough before the access then the data will
|
|
be in the cache by the time it is accessed.
|
|
|
|
<p>The value of <var>addr</var> is the address of the memory to prefetch.
|
|
There are two optional arguments, <var>rw</var> and <var>locality</var>.
|
|
The value of <var>rw</var> is a compile-time constant one or zero; one
|
|
means that the prefetch is preparing for a write to the memory address
|
|
and zero, the default, means that the prefetch is preparing for a read.
|
|
The value <var>locality</var> must be a compile-time constant integer between
|
|
zero and three. A value of zero means that the data has no temporal
|
|
locality, so it need not be left in the cache after the access. A value
|
|
of three means that the data has a high degree of temporal locality and
|
|
should be left in all levels of cache possible. Values of one and two
|
|
mean, respectively, a low or moderate degree of temporal locality. The
|
|
default is three.
|
|
|
|
<pre class="smallexample"> for (i = 0; i < n; i++)
|
|
{
|
|
a[i] = a[i] + b[i];
|
|
__builtin_prefetch (&a[i+j], 1, 1);
|
|
__builtin_prefetch (&b[i+j], 0, 1);
|
|
/* <span class="roman">...</span> */
|
|
}
|
|
</pre>
|
|
<p>Data prefetch does not generate faults if <var>addr</var> is invalid, but
|
|
the address expression itself must be valid. For example, a prefetch
|
|
of <code>p->next</code> does not fault if <code>p->next</code> is not a valid
|
|
address, but evaluation faults if <code>p</code> is not a valid address.
|
|
|
|
<p>If the target does not support data prefetch, the address expression
|
|
is evaluated if it includes side effects but no other code is generated
|
|
and GCC does not issue a warning.
|
|
</p></blockquote></div>
|
|
|
|
<div class="defun">
|
|
— Built-in Function: double <b>__builtin_huge_val</b> (<var>void</var>)<var><a name="index-g_t_005f_005fbuiltin_005fhuge_005fval-4037"></a></var><br>
|
|
<blockquote><p>Returns a positive infinity, if supported by the floating-point format,
|
|
else <code>DBL_MAX</code>. This function is suitable for implementing the
|
|
ISO C macro <code>HUGE_VAL</code>.
|
|
</p></blockquote></div>
|
|
|
|
<div class="defun">
|
|
— Built-in Function: float <b>__builtin_huge_valf</b> (<var>void</var>)<var><a name="index-g_t_005f_005fbuiltin_005fhuge_005fvalf-4038"></a></var><br>
|
|
<blockquote><p>Similar to <code>__builtin_huge_val</code>, except the return type is <code>float</code>.
|
|
</p></blockquote></div>
|
|
|
|
<div class="defun">
|
|
— Built-in Function: long double <b>__builtin_huge_vall</b> (<var>void</var>)<var><a name="index-g_t_005f_005fbuiltin_005fhuge_005fvall-4039"></a></var><br>
|
|
<blockquote><p>Similar to <code>__builtin_huge_val</code>, except the return
|
|
type is <code>long double</code>.
|
|
</p></blockquote></div>
|
|
|
|
<div class="defun">
|
|
— Built-in Function: int <b>__builtin_fpclassify</b> (<var>int, int, int, int, int, ...</var>)<var><a name="index-g_t_005f_005fbuiltin_005ffpclassify-4040"></a></var><br>
|
|
<blockquote><p>This built-in implements the C99 fpclassify functionality. The first
|
|
five int arguments should be the target library's notion of the
|
|
possible FP classes and are used for return values. They must be
|
|
constant values and they must appear in this order: <code>FP_NAN</code>,
|
|
<code>FP_INFINITE</code>, <code>FP_NORMAL</code>, <code>FP_SUBNORMAL</code> and
|
|
<code>FP_ZERO</code>. The ellipsis is for exactly one floating-point value
|
|
to classify. GCC treats the last argument as type-generic, which
|
|
means it does not do default promotion from float to double.
|
|
</p></blockquote></div>
|
|
|
|
<div class="defun">
|
|
— Built-in Function: double <b>__builtin_inf</b> (<var>void</var>)<var><a name="index-g_t_005f_005fbuiltin_005finf-4041"></a></var><br>
|
|
<blockquote><p>Similar to <code>__builtin_huge_val</code>, except a warning is generated
|
|
if the target floating-point format does not support infinities.
|
|
</p></blockquote></div>
|
|
|
|
<div class="defun">
|
|
— Built-in Function: _Decimal32 <b>__builtin_infd32</b> (<var>void</var>)<var><a name="index-g_t_005f_005fbuiltin_005finfd32-4042"></a></var><br>
|
|
<blockquote><p>Similar to <code>__builtin_inf</code>, except the return type is <code>_Decimal32</code>.
|
|
</p></blockquote></div>
|
|
|
|
<div class="defun">
|
|
— Built-in Function: _Decimal64 <b>__builtin_infd64</b> (<var>void</var>)<var><a name="index-g_t_005f_005fbuiltin_005finfd64-4043"></a></var><br>
|
|
<blockquote><p>Similar to <code>__builtin_inf</code>, except the return type is <code>_Decimal64</code>.
|
|
</p></blockquote></div>
|
|
|
|
<div class="defun">
|
|
— Built-in Function: _Decimal128 <b>__builtin_infd128</b> (<var>void</var>)<var><a name="index-g_t_005f_005fbuiltin_005finfd128-4044"></a></var><br>
|
|
<blockquote><p>Similar to <code>__builtin_inf</code>, except the return type is <code>_Decimal128</code>.
|
|
</p></blockquote></div>
|
|
|
|
<div class="defun">
|
|
— Built-in Function: float <b>__builtin_inff</b> (<var>void</var>)<var><a name="index-g_t_005f_005fbuiltin_005finff-4045"></a></var><br>
|
|
<blockquote><p>Similar to <code>__builtin_inf</code>, except the return type is <code>float</code>.
|
|
This function is suitable for implementing the ISO C99 macro <code>INFINITY</code>.
|
|
</p></blockquote></div>
|
|
|
|
<div class="defun">
|
|
— Built-in Function: long double <b>__builtin_infl</b> (<var>void</var>)<var><a name="index-g_t_005f_005fbuiltin_005finfl-4046"></a></var><br>
|
|
<blockquote><p>Similar to <code>__builtin_inf</code>, except the return
|
|
type is <code>long double</code>.
|
|
</p></blockquote></div>
|
|
|
|
<div class="defun">
|
|
— Built-in Function: int <b>__builtin_isinf_sign</b> (<var>...</var>)<var><a name="index-g_t_005f_005fbuiltin_005fisinf_005fsign-4047"></a></var><br>
|
|
<blockquote><p>Similar to <code>isinf</code>, except the return value is -1 for
|
|
an argument of <code>-Inf</code> and 1 for an argument of <code>+Inf</code>.
|
|
Note while the parameter list is an
|
|
ellipsis, this function only accepts exactly one floating-point
|
|
argument. GCC treats this parameter as type-generic, which means it
|
|
does not do default promotion from float to double.
|
|
</p></blockquote></div>
|
|
|
|
<div class="defun">
|
|
— Built-in Function: double <b>__builtin_nan</b> (<var>const char *str</var>)<var><a name="index-g_t_005f_005fbuiltin_005fnan-4048"></a></var><br>
|
|
<blockquote><p>This is an implementation of the ISO C99 function <code>nan</code>.
|
|
|
|
<p>Since ISO C99 defines this function in terms of <code>strtod</code>, which we
|
|
do not implement, a description of the parsing is in order. The string
|
|
is parsed as by <code>strtol</code>; that is, the base is recognized by
|
|
leading ‘<samp><span class="samp">0</span></samp>’ or ‘<samp><span class="samp">0x</span></samp>’ prefixes. The number parsed is placed
|
|
in the significand such that the least significant bit of the number
|
|
is at the least significant bit of the significand. The number is
|
|
truncated to fit the significand field provided. The significand is
|
|
forced to be a quiet NaN.
|
|
|
|
<p>This function, if given a string literal all of which would have been
|
|
consumed by <code>strtol</code>, is evaluated early enough that it is considered a
|
|
compile-time constant.
|
|
</p></blockquote></div>
|
|
|
|
<div class="defun">
|
|
— Built-in Function: _Decimal32 <b>__builtin_nand32</b> (<var>const char *str</var>)<var><a name="index-g_t_005f_005fbuiltin_005fnand32-4049"></a></var><br>
|
|
<blockquote><p>Similar to <code>__builtin_nan</code>, except the return type is <code>_Decimal32</code>.
|
|
</p></blockquote></div>
|
|
|
|
<div class="defun">
|
|
— Built-in Function: _Decimal64 <b>__builtin_nand64</b> (<var>const char *str</var>)<var><a name="index-g_t_005f_005fbuiltin_005fnand64-4050"></a></var><br>
|
|
<blockquote><p>Similar to <code>__builtin_nan</code>, except the return type is <code>_Decimal64</code>.
|
|
</p></blockquote></div>
|
|
|
|
<div class="defun">
|
|
— Built-in Function: _Decimal128 <b>__builtin_nand128</b> (<var>const char *str</var>)<var><a name="index-g_t_005f_005fbuiltin_005fnand128-4051"></a></var><br>
|
|
<blockquote><p>Similar to <code>__builtin_nan</code>, except the return type is <code>_Decimal128</code>.
|
|
</p></blockquote></div>
|
|
|
|
<div class="defun">
|
|
— Built-in Function: float <b>__builtin_nanf</b> (<var>const char *str</var>)<var><a name="index-g_t_005f_005fbuiltin_005fnanf-4052"></a></var><br>
|
|
<blockquote><p>Similar to <code>__builtin_nan</code>, except the return type is <code>float</code>.
|
|
</p></blockquote></div>
|
|
|
|
<div class="defun">
|
|
— Built-in Function: long double <b>__builtin_nanl</b> (<var>const char *str</var>)<var><a name="index-g_t_005f_005fbuiltin_005fnanl-4053"></a></var><br>
|
|
<blockquote><p>Similar to <code>__builtin_nan</code>, except the return type is <code>long double</code>.
|
|
</p></blockquote></div>
|
|
|
|
<div class="defun">
|
|
— Built-in Function: double <b>__builtin_nans</b> (<var>const char *str</var>)<var><a name="index-g_t_005f_005fbuiltin_005fnans-4054"></a></var><br>
|
|
<blockquote><p>Similar to <code>__builtin_nan</code>, except the significand is forced
|
|
to be a signaling NaN. The <code>nans</code> function is proposed by
|
|
<a href="http://www.open-std.org/jtc1/sc22/wg14/www/docs/n965.htm">WG14 N965</a>.
|
|
</p></blockquote></div>
|
|
|
|
<div class="defun">
|
|
— Built-in Function: float <b>__builtin_nansf</b> (<var>const char *str</var>)<var><a name="index-g_t_005f_005fbuiltin_005fnansf-4055"></a></var><br>
|
|
<blockquote><p>Similar to <code>__builtin_nans</code>, except the return type is <code>float</code>.
|
|
</p></blockquote></div>
|
|
|
|
<div class="defun">
|
|
— Built-in Function: long double <b>__builtin_nansl</b> (<var>const char *str</var>)<var><a name="index-g_t_005f_005fbuiltin_005fnansl-4056"></a></var><br>
|
|
<blockquote><p>Similar to <code>__builtin_nans</code>, except the return type is <code>long double</code>.
|
|
</p></blockquote></div>
|
|
|
|
<div class="defun">
|
|
— Built-in Function: int <b>__builtin_ffs</b> (<var>int x</var>)<var><a name="index-g_t_005f_005fbuiltin_005fffs-4057"></a></var><br>
|
|
<blockquote><p>Returns one plus the index of the least significant 1-bit of <var>x</var>, or
|
|
if <var>x</var> is zero, returns zero.
|
|
</p></blockquote></div>
|
|
|
|
<div class="defun">
|
|
— Built-in Function: int <b>__builtin_clz</b> (<var>unsigned int x</var>)<var><a name="index-g_t_005f_005fbuiltin_005fclz-4058"></a></var><br>
|
|
<blockquote><p>Returns the number of leading 0-bits in <var>x</var>, starting at the most
|
|
significant bit position. If <var>x</var> is 0, the result is undefined.
|
|
</p></blockquote></div>
|
|
|
|
<div class="defun">
|
|
— Built-in Function: int <b>__builtin_ctz</b> (<var>unsigned int x</var>)<var><a name="index-g_t_005f_005fbuiltin_005fctz-4059"></a></var><br>
|
|
<blockquote><p>Returns the number of trailing 0-bits in <var>x</var>, starting at the least
|
|
significant bit position. If <var>x</var> is 0, the result is undefined.
|
|
</p></blockquote></div>
|
|
|
|
<div class="defun">
|
|
— Built-in Function: int <b>__builtin_clrsb</b> (<var>int x</var>)<var><a name="index-g_t_005f_005fbuiltin_005fclrsb-4060"></a></var><br>
|
|
<blockquote><p>Returns the number of leading redundant sign bits in <var>x</var>, i.e. the
|
|
number of bits following the most significant bit that are identical
|
|
to it. There are no special cases for 0 or other values.
|
|
</p></blockquote></div>
|
|
|
|
<div class="defun">
|
|
— Built-in Function: int <b>__builtin_popcount</b> (<var>unsigned int x</var>)<var><a name="index-g_t_005f_005fbuiltin_005fpopcount-4061"></a></var><br>
|
|
<blockquote><p>Returns the number of 1-bits in <var>x</var>.
|
|
</p></blockquote></div>
|
|
|
|
<div class="defun">
|
|
— Built-in Function: int <b>__builtin_parity</b> (<var>unsigned int x</var>)<var><a name="index-g_t_005f_005fbuiltin_005fparity-4062"></a></var><br>
|
|
<blockquote><p>Returns the parity of <var>x</var>, i.e. the number of 1-bits in <var>x</var>
|
|
modulo 2.
|
|
</p></blockquote></div>
|
|
|
|
<div class="defun">
|
|
— Built-in Function: int <b>__builtin_ffsl</b> (<var>long</var>)<var><a name="index-g_t_005f_005fbuiltin_005fffsl-4063"></a></var><br>
|
|
<blockquote><p>Similar to <code>__builtin_ffs</code>, except the argument type is
|
|
<code>long</code>.
|
|
</p></blockquote></div>
|
|
|
|
<div class="defun">
|
|
— Built-in Function: int <b>__builtin_clzl</b> (<var>unsigned long</var>)<var><a name="index-g_t_005f_005fbuiltin_005fclzl-4064"></a></var><br>
|
|
<blockquote><p>Similar to <code>__builtin_clz</code>, except the argument type is
|
|
<code>unsigned long</code>.
|
|
</p></blockquote></div>
|
|
|
|
<div class="defun">
|
|
— Built-in Function: int <b>__builtin_ctzl</b> (<var>unsigned long</var>)<var><a name="index-g_t_005f_005fbuiltin_005fctzl-4065"></a></var><br>
|
|
<blockquote><p>Similar to <code>__builtin_ctz</code>, except the argument type is
|
|
<code>unsigned long</code>.
|
|
</p></blockquote></div>
|
|
|
|
<div class="defun">
|
|
— Built-in Function: int <b>__builtin_clrsbl</b> (<var>long</var>)<var><a name="index-g_t_005f_005fbuiltin_005fclrsbl-4066"></a></var><br>
|
|
<blockquote><p>Similar to <code>__builtin_clrsb</code>, except the argument type is
|
|
<code>long</code>.
|
|
</p></blockquote></div>
|
|
|
|
<div class="defun">
|
|
— Built-in Function: int <b>__builtin_popcountl</b> (<var>unsigned long</var>)<var><a name="index-g_t_005f_005fbuiltin_005fpopcountl-4067"></a></var><br>
|
|
<blockquote><p>Similar to <code>__builtin_popcount</code>, except the argument type is
|
|
<code>unsigned long</code>.
|
|
</p></blockquote></div>
|
|
|
|
<div class="defun">
|
|
— Built-in Function: int <b>__builtin_parityl</b> (<var>unsigned long</var>)<var><a name="index-g_t_005f_005fbuiltin_005fparityl-4068"></a></var><br>
|
|
<blockquote><p>Similar to <code>__builtin_parity</code>, except the argument type is
|
|
<code>unsigned long</code>.
|
|
</p></blockquote></div>
|
|
|
|
<div class="defun">
|
|
— Built-in Function: int <b>__builtin_ffsll</b> (<var>long long</var>)<var><a name="index-g_t_005f_005fbuiltin_005fffsll-4069"></a></var><br>
|
|
<blockquote><p>Similar to <code>__builtin_ffs</code>, except the argument type is
|
|
<code>long long</code>.
|
|
</p></blockquote></div>
|
|
|
|
<div class="defun">
|
|
— Built-in Function: int <b>__builtin_clzll</b> (<var>unsigned long long</var>)<var><a name="index-g_t_005f_005fbuiltin_005fclzll-4070"></a></var><br>
|
|
<blockquote><p>Similar to <code>__builtin_clz</code>, except the argument type is
|
|
<code>unsigned long long</code>.
|
|
</p></blockquote></div>
|
|
|
|
<div class="defun">
|
|
— Built-in Function: int <b>__builtin_ctzll</b> (<var>unsigned long long</var>)<var><a name="index-g_t_005f_005fbuiltin_005fctzll-4071"></a></var><br>
|
|
<blockquote><p>Similar to <code>__builtin_ctz</code>, except the argument type is
|
|
<code>unsigned long long</code>.
|
|
</p></blockquote></div>
|
|
|
|
<div class="defun">
|
|
— Built-in Function: int <b>__builtin_clrsbll</b> (<var>long long</var>)<var><a name="index-g_t_005f_005fbuiltin_005fclrsbll-4072"></a></var><br>
|
|
<blockquote><p>Similar to <code>__builtin_clrsb</code>, except the argument type is
|
|
<code>long long</code>.
|
|
</p></blockquote></div>
|
|
|
|
<div class="defun">
|
|
— Built-in Function: int <b>__builtin_popcountll</b> (<var>unsigned long long</var>)<var><a name="index-g_t_005f_005fbuiltin_005fpopcountll-4073"></a></var><br>
|
|
<blockquote><p>Similar to <code>__builtin_popcount</code>, except the argument type is
|
|
<code>unsigned long long</code>.
|
|
</p></blockquote></div>
|
|
|
|
<div class="defun">
|
|
— Built-in Function: int <b>__builtin_parityll</b> (<var>unsigned long long</var>)<var><a name="index-g_t_005f_005fbuiltin_005fparityll-4074"></a></var><br>
|
|
<blockquote><p>Similar to <code>__builtin_parity</code>, except the argument type is
|
|
<code>unsigned long long</code>.
|
|
</p></blockquote></div>
|
|
|
|
<div class="defun">
|
|
— Built-in Function: double <b>__builtin_powi</b> (<var>double, int</var>)<var><a name="index-g_t_005f_005fbuiltin_005fpowi-4075"></a></var><br>
|
|
<blockquote><p>Returns the first argument raised to the power of the second. Unlike the
|
|
<code>pow</code> function no guarantees about precision and rounding are made.
|
|
</p></blockquote></div>
|
|
|
|
<div class="defun">
|
|
— Built-in Function: float <b>__builtin_powif</b> (<var>float, int</var>)<var><a name="index-g_t_005f_005fbuiltin_005fpowif-4076"></a></var><br>
|
|
<blockquote><p>Similar to <code>__builtin_powi</code>, except the argument and return types
|
|
are <code>float</code>.
|
|
</p></blockquote></div>
|
|
|
|
<div class="defun">
|
|
— Built-in Function: long double <b>__builtin_powil</b> (<var>long double, int</var>)<var><a name="index-g_t_005f_005fbuiltin_005fpowil-4077"></a></var><br>
|
|
<blockquote><p>Similar to <code>__builtin_powi</code>, except the argument and return types
|
|
are <code>long double</code>.
|
|
</p></blockquote></div>
|
|
|
|
<div class="defun">
|
|
— Built-in Function: uint16_t <b>__builtin_bswap16</b> (<var>uint16_t x</var>)<var><a name="index-g_t_005f_005fbuiltin_005fbswap16-4078"></a></var><br>
|
|
<blockquote><p>Returns <var>x</var> with the order of the bytes reversed; for example,
|
|
<code>0xaabb</code> becomes <code>0xbbaa</code>. Byte here always means
|
|
exactly 8 bits.
|
|
</p></blockquote></div>
|
|
|
|
<div class="defun">
|
|
— Built-in Function: uint32_t <b>__builtin_bswap32</b> (<var>uint32_t x</var>)<var><a name="index-g_t_005f_005fbuiltin_005fbswap32-4079"></a></var><br>
|
|
<blockquote><p>Similar to <code>__builtin_bswap16</code>, except the argument and return types
|
|
are 32 bit.
|
|
</p></blockquote></div>
|
|
|
|
<div class="defun">
|
|
— Built-in Function: uint64_t <b>__builtin_bswap64</b> (<var>uint64_t x</var>)<var><a name="index-g_t_005f_005fbuiltin_005fbswap64-4080"></a></var><br>
|
|
<blockquote><p>Similar to <code>__builtin_bswap32</code>, except the argument and return types
|
|
are 64 bit.
|
|
</p></blockquote></div>
|
|
|
|
</body></html>
|
|
|