Boost logo

Boost :

From: Alexander Terekhov (terekhov_at_[hidden])
Date: 2005-04-06 11:05:55


Alexander Terekhov wrote:
>
> Peter Dimov wrote:
> [...]
> > we'll probably see a bigger hit on a dual PPC.
>
> Try on it something along the lines of
>
> asm long atomic_decrement_weak( register long * pw ) {
>
> <load-UNreserved>
> <add -1>
> <branch if zero to acquire>
> {lw}sync
>
> loop:
>
> <load-reserved>
> <add -1>
> <branch if zero to acquire>
> <store-conditional>
> <branch if failed to loop else to done>
>
> acquire:
>
> isync
>
> done:
>
> <...>
> }

and

 asm long atomic_decrement_strong( register long * pw ) {

      <load-reserved>
      <add -1>
      <branch if zero to acquire>
      {lw}sync

    loop:

      <store-conditional>
      <branch if !failed to done>
      <load-reserved>
      <add -1>
      <branch if !zero to loop>

    acquire:

      <store-conditional>
      <branch if failed to loop>
      isync

    done:

      <...>
  }

regards,
alexander.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk