S390: Optimize atomic macros.
commit022c9fec9b9de101788244a58f2dcdfb3583b8e3
authorStefan Liebler <stli@linux.vnet.ibm.com>
Mon, 6 Mar 2017 14:28:25 +0000 (6 15:28 +0100)
committerStefan Liebler <stli@linux.vnet.ibm.com>
Mon, 6 Mar 2017 14:28:25 +0000 (6 15:28 +0100)
tree078379da750b2796c9412c17678032582e65f975
parent21d58b2a43cab26838ba57bcea52d5cef132f925
S390: Optimize atomic macros.

This patch activates C11 atomic builtins by defining
USE_ATOMIC_COMPILER_BUILTINS to 1.
Note:
E.g. in nptl/pthread_key_delete.c if compiled with GCCs 6 and before,
an extra stack-frame is generated and the old value is stored on stack
before cs instruction but it never loads this value from stack.
An unreleased GCC 7 omit those stack operations.

E.g. in nptl/pthread_once.c the condition code of cs instruction is
evaluated by a sequence of ipm, sra, compare and jump instructions instead
of one conditional jump instruction.  This also occurs with an unreleased
GCC 7.

These shortcomings does not really hurt.  Nevertheless, the gcc guys are
investigating those ones and plan to fix them before GCC 7 release.

The atomic_fetch_abc_def C11 builtins are now using load-and-abc instructions
on z196 zarch and higher cpus instead of a loop with compare-and-swap
instruction.

Some of the non-C11 atomic macros from include/atomic.h are now implemented
with help of the C11 atomic builtins.  The other non-C11 atomic macros
are using the macros defined here.

ChangeLog:

* sysdeps/s390/atomic-machine.h
(USE_ATOMIC_COMPILER_BUILTINS): Define to 1.
(__arch_compare_and_exchange_val_8_acq,
__arch_compare_and_exchange_val_16_acq,
__arch_compare_and_exchange_val_32_acq,
__arch_compare_and_exchange_val_64_acq):
Delete macro.
(atomic_compare_and_exchange_val_acq,
atomic_compare_and_exchange_val_rel,
atomic_compare_and_exchange_bool_acq,
catomic_compare_and_exchange_bool_acq,
atomic_exchange_acq, atomic_exchange_rel,
atomic_exchange_and_add_acq,
atomic_exchange_and_add_rel,
catomic_exchange_and_add, atomic_or_val,
atomic_or, catomic_or, atomic_bit_test_set,
atomic_and_val, atomic_and, catomic_and):
Define macros with help of C11 atomic builtins.
ChangeLog
sysdeps/s390/atomic-machine.h