This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH 1/2] S390: Optimize atomic macros.
- From: Torvald Riegel <triegel at redhat dot com>
- To: Stefan Liebler <stli at linux dot vnet dot ibm dot com>
- Cc: libc-alpha at sourceware dot org
- Date: Mon, 27 Feb 2017 21:33:27 -1000
- Subject: Re: [PATCH 1/2] S390: Optimize atomic macros.
- Authentication-results: sourceware.org; auth=none
- References: <1479913753-20506-1-git-send-email-stli@linux.vnet.ibm.com> <1479991865.7146.1526.camel@localhost.localdomain> <a6ad0218-bb22-1289-afa0-2b29d75fb438@linux.vnet.ibm.com> <485d2d38-26ae-b941-e55d-a58f7559049b@linux.vnet.ibm.com> <1481915703.14990.622.camel@redhat.com> <ca7058d1-e26c-b4ce-f27c-b883f45d615a@linux.vnet.ibm.com>
On Mon, 2017-02-27 at 12:36 +0100, Stefan Liebler wrote:
> 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.
>
> Optimizations like using load-and-and for exchanging memory to zero
> will be done by GCC in future.
>
> 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.
s/c11/C11/ throughout the patch.
Besides that, this looks good to me. Thanks.