This is the mail archive of the crossgcc@sources.redhat.com mailing list for the crossgcc project.

See the CrossGCC FAQ for lots more information.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Extended asm


Hi,

I have gone through the on-line docs for extended asm but i can't seem
to find a relevant example for what i need to do. In one part of my
application i need to set two registers from my C-code (r7 and r8) with
two 32 bit values. It look quite like the below

AFAIK, the lwi, lwz dont work in the inline assemble so i have use the
below instead to get a 32bit value into the memory.

I need code that does this: 
r7 = &buffer[0];
r8 = &buffer[max];

int tmp1 = 0x12345678;
int tmp2 = (0x12345678 >> 16);

asm volatile (  "li  7,%0;" 
                "ori	7,7,%1;"  
                :
                : "r"( tmp2 ) , "r"( tmp  )
                :"r7" );

...but this dont work. When i look as the code from my debugger then i
can see the following: All the above code has been translated into:

lwz	r0, (44)(r31)
lwz	r9, (40)(r31)
li   	r7,0x0
ori	r7,(09)

This means that it diregards my input parameter (tmp2 and tmp1). Why is
that?

Since i see "lwz" in the assembler window then i really dont get why i
can't used it within the asm "" directive.

------
Want more information?  See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/
Want to unsubscribe? Send a note to crossgcc-unsubscribe@sources.redhat.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]