-qasm

Description

Controls the interpretation of and subsequent generation of code for an asm assembly statement.

Syntax

C only The default is -qasm=gcc, independent of the language level. Specifying -qasm without a suboption is equivalent to specifying the default.

Read syntax diagramSkip visual syntax diagram        .-asm=gcc-.
>>- -q--+-noasm---+--------------------------------------------><
 

C++ only The default is also-qasm=gcc, independent of the language level.

Read syntax diagramSkip visual syntax diagram        .-asm=gcc----.
>>- -q--+-asm=stdcpp-+-----------------------------------------><
        '-noasm------'
 

Notes

The -qasm option and its negative form control whether or not code is emitted for an assembly statement. The positive form of the option directs the compiler to generate code for assembly statements in the source code. The suboptions specify the syntax used to interpret the content of the assembly statement. For example, specifying -qasm=gcc instructs the compiler to recognize the extended GCC syntax and semantics for assembly statements.

C only 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, the token asm is treated as a keyword unless the option -qnokeyword=asm is in effect. In C, the compiler-specific variants __asm and __asm__ are keywords at all language levels and cannot be disabled.

C++ only 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.

Predefined macros

Whenever asm is treated as a keyword, the compiler predefines one of the following mutually exclusive macros, depending on the assembly language syntax specified. If assembler code is generated, the macro has the value 1; otherwise, 0.

Informational messages

When the option -qinfo=eff is also in effect, the compiler emits an informational message if no code is generated for an assembly statement.

Whenever an assembly statement is recognized as a valid language feature, the option -qinfo=por instructs the compiler to report it in an informational message.

The system assembler program must be available for this command to have effect. See the -qasm_as compiler option for more information.

Example

The following code snippet shows an example of the GCC conventions for asm syntax in inline statements:

int a, b, c;
int main() {
    asm("add %0, %1, %2" : "=r"(a) : "r"(b), "r"(c) );
}

Related information