Patch for PR libgomp/37938, IA64 specific.

Steve Ellcey sje@cup.hp.com
Thu Nov 6 23:21:00 GMT 2008


On Thu, Nov 6, 2008 at 1:31 PM, Jakub Jelinek <jakub@redhat.com> wrote:
> On Thu, Nov 06, 2008 at 01:09:44PM -0800, H.J. Lu wrote:
>> According to ia64 psABI, ia64 _sync_bool_compare_and_swap should
>> have full barrier.  __sync_lock_test_and_set  has acquire barrier.
>
> Ok, then we have just one problematic __sync_lock_test_and_set
> in whole libgomp.
>
> Would the following (untested) patch cure it?  Or we can use
> __sync_synchronize (); val = __sync_lock_test_and_set (mutex, 0);
> if we don't mind mf + xchg4.acq.

So I put a call to __sync_synchronize into gomp_mutex_unlock and that
seems to work fine, my only complaint is that this requires us to have
an ia64 specific version of mutex.h.  Now if ia64 was doing something
wrong, I would understand that.  But the IA64 __sync_lock_test_and_set
instruction has acquire semantics which is what is documented in
extend.texi.  If gomp_mutex_unlock needs something more then that
shouldn't the standard linux version of gomp_mutex_unlock be changed to
call __sync_synchronize and/or use something else instead of
__sync_lock_test_and_set?

Steve Ellcey
sje@cup.hp.com




More information about the Gcc-patches mailing list