Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cdt-dev] Inline Assembly?

Hi folks,

We have some C files, which have Inline Assembly for ePPC.
Currently, I have lots of Syntax Errors there. I currently have undefined __asm in Project Settings so at least the function itself has not the syntax error set.

Which way is CDT handling Inline Assembly, if at all?

__asm void foo(void)
{
    lis     r0, 0x4000@ha
    ori     r0,r0, 0x1000@l
    mfspr   r3, SPR_XYZ
    stw     r3, 0(r1)
}

or rather

void foo(void)
{
    __asm {
            lis     r0, 0x4000@ha
            ori     r0,r0, 0x1000@l
            mfspr   r3, SPR_XYZ
            stw     r3, 0(r1)
    };
}

or gnu style like

void foo(void)
{
   asm(
    "lis     r0, 0x4000@ha"
    "ori     r0,r0, 0x1000@l"
    "mfspr   r3, SPR_XYZ"
    "stw     r3, 0(r1)"
    , /*in*/ : /*out*/: /*clobber*/ );
}

And how are the assembler instructtions setup?



Back to the top