On Fri, Apr 24, 2009 at 07:12:32PM +0200, Roland Mainz wrote: > Fedor Sergeev wrote: > > On Tue, Apr 21, 2009 at 12:21:12AM +0200, Roland Mainz wrote: > > > Fedor Sergeev wrote: > > > > On Fri, Apr 17, 2009 at 05:42:08PM +0200, Roland Mainz wrote: > > > > > Is there somewhere a document which describes which functions are > > > > > available as builtin functions via Sun Studio's "-xbuiltin=%all" > > > > > option > > > > > ? > > > > > > > > Not really. > > > > We do not handle it as "direct" builtins, that is headers do not contain > > > > compiler specific symbols, like builtin_sqrt or whatnot. > > > > > > Erm... what do you mean with that ? > > > > Well, you just dont want to know then ;) > > *beep*-wrong-answer-switching-to-'curious-mode'-*beep* :-) > > ... what does it mean ? Where does -xbuiltin=... differ from gcc4.x's > "builtin" function support ?
I'm not a biggest expert in gcc4.x builtin function support on Solaris, but on Linux I see that it uses various complicated macros definitions and attributes inside both its own headers and glibc headers, in some cases these macroses expand to symbols like __builtin_nan. These __builtin_* symbols happen to be a "pure" compiler builtins, which are meant for explicit compiler consumption and are not present in libc/libm in any form. Sun Studio does not use special __builtin symbols for the purpose of system functions optimization. > > > > > Optimizing compiler components (backends) are able to optimize nearly > > > > every > > > > standard function (function that is declared in a standard header). > > > > > > How does that work ? > > > > Compiler knows that function declaration comes from a standard system header > > (it reads these declarations from those headers after all). > > Then this function is considered to be a standard function and is subject > > for -xbuiltin > > optimizations. > > How do these optimisations look like ? Does it require that the compile > have inline code sequences in some kind of library or is this something > else ? It really depends on each particular case. It can be just a "folding" for a function call with a known argument, it can be an optimized version of math function for an integer argument, it can be an inlined code optimized for a particular platform etc etc. Different components do different kinds of optimizations. It is really impossible to give a more definitive answer. And in fact I dont believe you *need* a more definitive answer. regards, Fedor. > > > > > Different backends on different platforms have different ideas on what > > > > is a good function to optimize. > > > > > > > > What are you trying to solve with that document? > > > > > > I'd like to enable only a few builtin functions (basically only those > > > which make sense from a performance point-of-view (like the string copy > > > functions) and those which do not alter |errno|). > > > > Sorry, I do not believe this is possible. > > Why (quick look at cc(1) shows that "-xbuiltin" seems to support only > "%all" and "%none" as values and not function names... is that correct > ?) ?