[patch] s390: support for __sync_lock_test_and_set

Richard Henderson rth@redhat.com
Wed Oct 5 01:31:00 GMT 2005


On Tue, Oct 04, 2005 at 10:38:08PM +0200, Adrian Straetling wrote:
> > But I would strongly suggest that targets that *can* store a
> > particular value do so.  And s390 can, via compare-and-swap.
> For HImode and QImode it actually cannot.

Yes, it can.  It's just more difficult.  Essentially, you do the
compare-and-swap on a larger aligned value and insert the smaller
user value into it.

I think both Alpha and PowerPC implement this.

> IMHO, if the caller of __sync_lock_test_and_set cannot expect deterministic
> behaviour in some cases ("weak targets"), it should not do that in any
> case for the sake of portability.

All of the "weak targets" are embedded.  In libgomp I do in fact
expect that __sync_lock_test_and_set works as advertised on 
workstation-class machines.  Though I suppose I can add yet another
autoconf test to use a cs loop if tas is crippled.


r~



More information about the Gcc-patches mailing list