About __builtin_Functions.

Phil Edwards phil@codesourcery.com
Sun Mar 14 15:24:00 GMT 2004


On Sun, Mar 14, 2004 at 06:32:32PM +0530, Dhruv Matani wrote:
> Hello,
> 	I wanted to know whether ALL __builtin_functions are guaranteed to be
> inlined?

Depends on the function.  The URL that I posted earlier contains several
paragraphs describing when builtins are used and when they aren't.

It should be noted that compiler builtins (formally known as intrinsics,
if you happen across that term elsewhere) aren't really the same as inline
functions.  There's no "source code" to be inlined for an intrinsic;
the compiler itself emits the raw instructions.

Some intrinsics don't emit code, e.g., __builtin_constant_p.  Some can only
be open coded -- again, not the same thing as inlined -- under certain
circumstances, e.g., the math builtins, or the vector builtins.

My advice would be to pick a __builtin that's interesting to you and look
to see how it's implemented.  That will give you an idea of how they work.

-- 
Behind everything some further thing is found, forever; thus the tree behind
the bird, stone beneath soil, the sun behind Urth.  Behind our efforts, let
there be found our efforts.
              - Ascian saying, as related by Loyal to the Group of Seventeen



More information about the Libstdc++ mailing list