You copied the Doc URL to your clipboard.

Miscellaneous inline assembler restrictions in C and C++ code

Compared with armasm or embedded assembly language, the inline assembler has the following restrictions:

  • The inline assembler is a high-level assembler, and the code it generates might not always be exactly what you write. Do not use it to generate more efficient code than the compiler generates. Use embedded assembler or the ARM assembler armasm for this purpose.

  • Some low-level features that are available in the ARM assembler armasm, such as writing to PC, are not supported.

  • Label expressions are not supported.

  • You cannot get the address of the current instruction using dot notation (.) or {PC}.

  • The & operator cannot be used to denote hexadecimal constants. Use the 0x prefix instead. For example:

    __asm { AND x, y, 0xF00 }
  • The notation to specify the actual rotation of an 8-bit constant is not available in inline assembly language. This means that where an 8-bit shifted constant is used, the C flag must be regarded as corrupted if the NZCV flags are updated.

  • You must not modify the stack pointer. This is not necessary because the compiler automatically stacks and restores any working registers as required. The compiler does not permit you to explicitly stack and restore work registers.