Skip to content
Snippets Groups Projects
  • Tom Lane's avatar
    0a41e865
    Use __sync_lock_test_and_set() for spinlocks on ARM, if available. · 0a41e865
    Tom Lane authored
    Historically we've used the SWPB instruction for TAS() on ARM, but this
    is deprecated and not available on ARMv6 and later.  Instead, make use
    of a GCC builtin if available.  We'll still fall back to SWPB if not,
    so as not to break existing ports using older GCC versions.
    
    Eventually we might want to try using __sync_lock_test_and_set() on some
    other architectures too, but for now that seems to present only risk and
    not reward.
    
    Back-patch to all supported versions, since people might want to use any
    of them on more recent ARM chips.
    
    Martin Pitt
    0a41e865
    History
    Use __sync_lock_test_and_set() for spinlocks on ARM, if available.
    Tom Lane authored
    Historically we've used the SWPB instruction for TAS() on ARM, but this
    is deprecated and not available on ARMv6 and later.  Instead, make use
    of a GCC builtin if available.  We'll still fall back to SWPB if not,
    so as not to break existing ports using older GCC versions.
    
    Eventually we might want to try using __sync_lock_test_and_set() on some
    other architectures too, but for now that seems to present only risk and
    not reward.
    
    Back-patch to all supported versions, since people might want to use any
    of them on more recent ARM chips.
    
    Martin Pitt