Has anyone noticed how the functions atomic_add_8_nv and friends are 
implemented? They really don't look optimal for amd64 architecture. I haven't 
checked i386.

xref: /loficc/crypto/usr/src/common/atomic/amd64/atomic.s

movb    (%rdi), %al     / %al = old value
1:
movb    %sil, %cl
addb    %al, %cl        / %cl = new value
lock
cmpxchgb %cl, (%rdi)    / try to stick it in
jne     1b
movzbl  %cl, %eax       / return new value
ret

Wouldn't it be easier to use a sequence like:
movq    %rsi, %rax    //rax = rsi = delta
lock
xaddb %al, (%rdi)   // Target += delta, %al = original value
addb %sil, %al      // %al += delta (thus %al == Target)
ret

Maybe I am missing something really huge here?

Patrick Baggett, Figgle Software
 
 
This message posted from opensolaris.org
_______________________________________________
opensolaris-discuss mailing list
[email protected]

Reply via email to