[PATCH] Speed up __sync_lock_test_and_set on PowerPC

David Edelsohn dje.gcc@gmail.com
Wed Sep 3 19:35:00 GMT 2008


On Wed, Sep 3, 2008 at 3:06 AM, Anton Blanchard <anton@samba.org> wrote:
> unlock looks good, but lock has both release and acquire barriers. Even
> worse, the release barrier is a heavyweight sync which is very slow.
> Looking at the gcc documentation, sync_lock_test_and_set only needs an
> aquire barrier:
>
>> sync_lock_test_and_set
> ...
>> This pattern must issue any memory barrier instructions such that the
>> pattern as a whole acts as an acquire barrier, that is all memory
>> operations after the pattern do not occur until the lock is acquired.

Richard,

Why does the GCC alpha port emit a memory barrier at the beginning of the
test_and_set sync builtin sequence, which seems to be more than
the required `acquire' semantics?

Thanks, David



More information about the Gcc mailing list