always_inline is a strange attribute specific to GCC and possibly GCC (therefore, the detailed behavior may not coincide with GCC 4.5 and GCC 4.7).
GCC works by performing many optimization passes (even at -O0 some of these passes work, otherwise the code will not be emitted). Typically, GCC -O1 compilation runs two hundred optimization passes.
With gcc-4.7 your code does not even compile in -O0 :
alw.c: In function 'main': alw.c:7:5: warning: asm operand 1 probably doesn't match constraints [enabled by default] alw.c:7:5: error: impossible constraint in 'asm'
To understand what GCC does, you can run it with gcc -fdump-tree-all and you will get a so-called “dump file” (a textual representation of some internal representations converted by pass) for most GCC transmissions. Beware you will get hundreds [s] such dump files (and, unfortunately, the number inside the dump file name does not matter).
I do not understand why you want to do this. I suggest either making your test macro or always optimizing (the recent GCC deal is well suited with both -g and -O1 ).
A possible alternative could be the GCC extension using the plugin , or better, the MELT extension (MELT is a high-level domain language for the GCC extension, implemented as a licensed GPLv3 GCC plugin). Then you can make your test function your own GCC builtin , since GCC can be extended to add inline and pragmatic ones . Your extension will then install your built-in functions and insert some specific omissions for their proper management. (This means that you have been working for several days, even if you know the GCC internals well). Note that built-in functions are usually used to connect additional target specific instructions to the processor (like your use case).
Recent GCCs (notably 4.6 and 4.7) accept plugins (if configured using --enable-plugins ). Check with gcc -v if your GCC accepts plugins. Some distributions do not like the idea of a GCC plugin (for example, Suse and, possibly, Redhat), and therefore do not contain plugins that accept GCC.
If your particular Linux distribution (the latter) does not support GCC plugins, I suggest you open an error report to allow plugins to be included inside GCC. If your GCC cross-compiler provider does not support plugins, I also suggest that you request this function, which has existed in the GNU Gcc FSF since several years, for example. since 4.5!
On Debian or Ubuntu, I suggest installing the gcc-4.6-plugin-dev or gcc-4.7-plugin-dev . Then you can create and use the MELT plugin (I will work on the release of MELT 0.9.6 for GCC 4.6 and 4.7 very soon, that is, in July 2012).
The latest distributions (Debian, Ubuntu, Mandriva, ArchLinux, ...) with GCC 4.6 or 4.7 have a GCC extension with plugins. MELT is such a plugin (it is a meta plugin because melt.so does something dlopen ). After you have plugins that accept GCC and install some kind of plugin (like MELT), it just runs gcc -fplugin=melt with some other plugin options (like -fplugin-arg-melt-mode= your -Melt mode for MELT).