problem w/ GCC asm stmt on sparc
Matthew R Wette
mwette@mr-ed.jpl.nasa.gov
Tue Jun 24 12:50:00 GMT 1997
I'm having problems getting the following code to compile properly.
Specifically the last asm statement "st %%l0,%0" works if I compile
w/o optimization, but fails if I optimize. The reason is that addr
is a stack variable but gets optimized to a register if I use "-O2".
Is there any way to `repair' my asm statement below?
int
a_spin_trylock(volatile char *addr)
{
int __val;
asm volatile("\
ldstub %1,%%l0;\
tst %%l0;\
mov -1,%%l0;\
bne 1f; nop;\
mov %%g0,%%l0;\
1: st %%l0,%0":
"=g" (__val): "m" (*addr): "ccr", "%l0");
return __val;
}
Thanks,
Matt
More information about the crossgcc
mailing list