4.1.4. __asm

This keyword is used to pass information from the compiler to the ARM assembler armasm.

The precise action of this keyword depends on its usage.

Usage

Embedded assembler

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

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

See Embedded assembler in the Compiler User Guide for more information.

Inline assembler

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

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

SeeInline assembler in the Compiler User Guide for more information.

Assembler labels

The __asm keyword can be used to specify an assembler label for a C symbol. For example:

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

See Assembler labels for more information.

Named register variables

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

register int foo __asm("r0");

See Named register variables for more information.

See also

Copyright © 2007, 2010 ARM Limited. All rights reserved.ARM DUI 0348A
Non-Confidential