-qasm
Category
Pragma equivalent
None.
Purpose
Controls the interpretation and subsequent generation of code for assembler language extensions.
When -qasm is in effect, the compiler generates code for assembly statements in the source code. Suboptions specify the syntax used to interpret the content of the assembly statement.
Syntax
-qasm syntax(for C) .-asm--+------------+-. | | .-gcc-. | | | '-=--+-----+-' | >>- -q--+-noasm---------------+--------------------------------><
-qasm syntax (for C++) .-asm--+---------------+-. | | .-gcc----. | | | '-=--+-stdcpp-+-' | >>- -q--+-noasm------------------+-----------------------------><
Defaults
-qasm=gcc
-qasm=gcc at all
language levels except compat366 or strict98. -qnoasm=stdcpp when -qlanglvl=compat366 or -qlanglvl=strict98 is
in effect.
Parameters
- gcc
- Instructs the compiler to recognize the extended GCC syntax and semantics for assembly statements.
stdcpp- Reserved for possible future use.
Specifying -qasm without a suboption is equivalent to specifying the default.
Usage
The
token asm is not a C language keyword. Therefore,
at language levels stdc89 and stdc99, which enforce
strict compliance to the C89 and C99 standards, respectively, the
option -qkeyword=asm must also be specified to compile source
that generates assembly code. At all other language levels, token asm is
treated as a keyword unless the option -qnokeyword=asm is in
effect.
The tokens asm, __asm,
and __asm__ are keywords at all language levels. Suboptions of -qnokeyword=token can
be used to disable each of these reserved words individually.
For detailed information about the syntax and semantics of inline asm statements, see Inline assembly statements.
Predefined macros
__IBM_GCC_ASM is predefined to 1 when asm is
recognized as a keyword and assembler code is generated; that is,
at all language levels except stdc89 | stdc99, or when -qkeyword=asm is in effect, and
when -qasm[=gcc] is in effect. It is predefined to 0 when asm is
recognized as a keyword but assembler code is not generated; that
is, at all language levels except stdc89 | stdc99, or when -qkeyword=asm is in effect,
and when -qnoasm is in effect. It is undefined when the stdc89
| stdc99 language level or -qnokeyword=asm is
in effect.
__IBM_GCC_ASM is predefined to 1 when asm is
recognized as a keyword and assembler code is generated; that is,
at all language levels except compat366 | strict98,
and when -qasm[=gcc] is in effect. It is predefined to 0 when asm is
recognized as a keyword but assembler code is not generated; that
is, at all language levels except compat366|strict98,
and when -qnoasm is in effect. It is undefined when -qlanglvl=compat366 | strict98 or -qnoasm=stdcpp is
in effect. __IBM_STDCPP_ASM is predefined to 0 when -qlanglvl=compat366
| strict98 or -qnoasm=stdcpp is in effect; otherwise
it is undefined.
Examples
int a, b, c;
int main() {
asm("add %0, %1, %2" : "=r"(a) : "r"(b), "r"(c) );
}



