10.5 __asm

This keyword passes information from the compiler to the ARM assembler armasm.

The precise action of this keyword depends on its usage.

Usage

Embedded assembly

The __asm keyword can declare or define an embedded assembly function. For example:

__asm void my_strcpy(const char *src, char *dst);
Inline assembly

The __asm keyword can incorporate inline assembly into a function. For example:

int qadd(int i, int j)
{
    int res;
    __asm
    {
        QADD   res, i, j
    }
    return res;
}
Assembly labels

The __asm keyword can specify an assembly label for a C symbol. For example:

int count __asm__("count_v1"); // export count_v1, not count
Named register variables

The __asm keyword can declare a named register variable. For example:

register int foo __asm("r0");
Related concepts
7.26 Embedded assembler support in the compiler
7.1 Compiler support for inline assembly language
Related reference
10.153 Named register variables
9.36 Assembler labels
Non-Confidential PDF file icon PDF version ARM DUI0472J
Copyright © 2010-2013 ARM. All rights reserved.