7.13 Miscellaneous inline assembler restrictions in C and C++ code

Compared with armasm or embedded assembly language, the inline assembler has a number of restrictions.

Specifically, these restrictions are as follows:

  • 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 the 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}.

  • You cannot use the & operator 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.

Non-ConfidentialPDF file icon PDF versionARM DUI0472M
Copyright © 2010-2016 ARM Limited or its affiliates. All rights reserved.