$include_dir="/home/hyper-archives/boost/include"; include("$include_dir/msg-header.inc") ?>
From: Alexander Terekhov (terekhov_at_[hidden])
Date: 2005-04-07 07:31:02
Peter Dimov wrote:
[...]
> >> and an acquire when the new value is zero.
> >
> > Hmm, tricky.  There would be need to be another instruction afterward
> > that creates the acquire barrier.  Maybe this would do:
> >
> >    __asm__ ("     fetchaddl.rel %0=[%4],-1 \n"
> >             "     cmp.eq        %2,%3=1,%0 \n"
> >             "(%2) ldl.acq       %0=[%4]    " :
> >      "=r"(rv), "=m"(*pw), "=c", "=c" :
> >      "r"(pw) :
> >      );
> >
> > Don't ask me whether that's the most efficient way to do this!
That's RAW dependency on a semaphore. It isn't optimal for refcounting 
because it equates to a full fence, not mere acquire. BTW, you need a 
"memory" clobber clause here (not sure about cc/predicate stuff).
regards,
alexander.