This is just a guess, but I think you need to use $1 instead of 1 in  
your add. The $ tells gcc the value is an immediate, and I think  
otherwise 1 is treated as a memory address. There probably isn't a  
version of add that operates on memory (especially unaligned memory)  
so that might not really be the problem.

Gabe

Quoting Amir Hossein Hormati <[email protected]>:

> Hi,
> Has anyone implemented atomic add function for Alpha that works in m5? I
> tried to write this using inline assembly in gcc:
>
> void atomic_add(volatile long* operand)
> {
>   int temp;
>   asm volatile (
>     "1: ldq_l %0, %1       \n"
>     "   addl %0, 1, %0 \n"
>     "   stq_c %0, %1       \n"
>       : "=&r" (temp),
>         "=m" (*operand)
>       : "m" (*operand)
>       );
> }
>
> but it does not work and I don't much about alpha instruction set. I don't
> want to use operation system based mutex because that comes with a big
> overhead. Does any one have a better idea?
>
>
> Thanks,
> Amir
>


_______________________________________________
m5-users mailing list
[email protected]
http://m5sim.org/cgi-bin/mailman/listinfo/m5-users

Reply via email to