Differences in compiler support of
inline and embedded assembly code
There are differences between the ways inline and embedded
assembly are compiled:
Inline assembly
code uses a high level of processor abstraction, and is integrated
with the C and C++ code during code generation. Therefore, the compiler
optimizes the C and C++ code and the assembly code together.
Unlike inline assembly code, embedded assembly code
is assembled separately from the C and C++ code to produce a compiled
object that is then combined with the object from the compilation
of the C or C++ source.
Inline assembly code can be inlined by the compiler,
but embedded assembly code cannot be inlined, either implicitly
or explicitly.
Table 20 summarizes
the main differences between inline assembler and embedded assembler.
Table 20. Differences between inline and embedded assembler
Feature
Embedded assembler
Inline assembler
Instruction set
ARM and Thumb.
ARM on all processors.
Thumb
on processors with Thumb-2 technology.
ARM assembler directives
All supported.
None supported.
ARMv6 instructions
All supported.
Supports most instructions, with some exceptions,
for example SETEND and some of the system extensions.
The complete set of ARMv6 SIMD instructions is supported.
ARMv7 instructions
All supported.
Supports most instructions.
VFP instructions
All supported.
VFPv2 only.
C/C++ expressions
Constant expressions only.
Full C/C++ expressions.
Optimization of assembly code
No optimization.
Full optimization.
Inlining
Never.
Possible.
Register access
Specified physical registers are used. You
can also use PC, LR and SP.
Uses virtual registers. Using sp (r13), lr (r14),
and pc (r15) gives an error.
Return instructions
You must add them in your code.
Generated automatically. (The BX, BXJ, and BLX instructions
are not supported.)
This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.
ARM websites use two types of cookie: (1) those that enable the site to function and perform as required; and (2) analytical cookies which anonymously track visitors only while using the site. If you are not happy with this use of these cookies please review our Privacy Policy to learn how they can be disabled. By disabling cookies some features of the site will not work.