-qasm

Description

Controls the interpretation of and subsequent generation of code for an asm 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--+-+-asm---+-+--+------+--------------------------------><
          '-noasm-'    '-=gcc-'

C++ only The default depends on the language level. In ansi, compat366 or strict98 modes, the default is -qnoasm=stdcpp. These modes are suboptions of -qlanglvl.

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

At all other language levels, the default is -qasm=gcc.

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

Notes

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

Notes:
  1. The two macros can not be predefined at the same time.
  2. Whether macros are defined or not depends on the setting of the -qasm compiler option.

    When the -qasm=gcc is in effect, __IBM_GCC_ASM is predefined.

    When the -qasm=stdcpp is in effect, __IBM_STDPP_ASM is predefined.

Informational messages

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

Whenever an asm statement is recognized as a valid language feature, the option -qinfo=por instructs the compiler to report it in an informational message. At C language levels stdc89 or stdc99, the option -qkeyword=asm must also be in effect.

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 a simple use of the -qasm compiler option:

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

Related information