From: Peter Dimov (pdimov_at_[hidden])
Date: 2005-04-07 06:13:07


Ben Hutchings has kindly contributed the attached sp_counted_base
implementations for g++ on IA64 and 68020+. The IA64 version of decrement
should be changed to:

Ben Hutchings wrote:
>>> It isn't a memory barrier (unless you add .acq or .rel to it) but I
>>> don't believe a barrier is needed for the simple increment and
>>> decrement operations. It is always atomic, like lock xadd.
>>
>> For increment, no. For decrement, yes. It needs to be a release when
>> the new value is nonzero,
>
> Oh yes, of course it does.
>
>> 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!

In your (Boost developers) opinion,

1. Do we need a platform-specific version for 68020+ at all? (It is my
understanding that threads aren't very popular there ;-) but I may be wrong)

2. Should we try to get an IA64 version in 1.33 or should this be postponed
for 1.34?