This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH v5] S/390: Optimize atomic_compare_exchange and atomic_compare builtins.
- From: "Ulrich Weigand" <uweigand at de dot ibm dot com>
- To: vogt at linux dot vnet dot ibm dot com
- Cc: gcc-patches at gcc dot gnu dot org, krebbel at linux dot vnet dot ibm dot com (Andreas Krebbel), Ulrich dot Weigand at de dot ibm dot com (Ulrich Weigand)
- Date: Mon, 24 Apr 2017 16:43:28 +0200 (CEST)
- Subject: Re: [PATCH v5] S/390: Optimize atomic_compare_exchange and atomic_compare builtins.
- Authentication-results: sourceware.org; auth=none
Dominik Vogt wrote:
> On Mon, Mar 27, 2017 at 09:27:35PM +0100, Dominik Vogt wrote:
> > The attached patch optimizes the atomic_exchange and
> > atomic_compare patterns on s390 and s390x (mostly limited to
> > SImode and DImode). Among general optimizaation, the changes fix
> > most of the problems reported in PR 80080:
> > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80080
> >
> > Bootstrapped and regression tested on a zEC12 with s390 and s390x
> > biarch.
>
> v5:
> * Generate LT pattern directly for const 0 value.
> * Split into three patches.
>
> Bootstrapped and regression tested on a zEC12 with s390 and s390x
> biarch.
> gcc/ChangeLog-dv-atomic-gcc7-1
>
> * config/s390/s390.md ("cstorecc4"): Use load-on-condition and deal
> with CCZmode for TARGET_Z196.
> gcc/ChangeLog-dv-atomic-gcc7-2
>
> * config/s390/s390.md (define_peephole2): New peephole to help
> combining the load-and-test pattern with volatile memory.
> gcc/ChangeLog-dv-atomic-gcc7-3
>
> * s390-protos.h (s390_expand_cs_hqi): Removed.
> (s390_expand_cs, s390_expand_atomic_exchange_tdsi): New prototypes.
> * config/s390/s390.c (s390_emit_compare_and_swap): Handle all integer
> modes as well as CCZ1mode and CCZmode.
> (s390_expand_atomic_exchange_tdsi, s390_expand_atomic): Adapt to new
> signature of s390_emit_compare_and_swap.
> (s390_expand_cs_hqi): Likewise, make static.
> (s390_expand_cs_tdsi): Generate an explicit compare before trying
> compare-and-swap, in some cases.
> (s390_expand_cs): Wrapper function.
> (s390_expand_atomic_exchange_tdsi): New backend specific expander for
> atomic_exchange.
> (s390_match_ccmode_set): Allow CCZmode <-> CCZ1 mode.
> * config/s390/s390.md ("atomic_compare_and_swap<mode>"): Merge the
> patterns for small and large integers. Forbid symref memory operands.
> Move expander to s390.c. Require cc register.
> ("atomic_compare_and_swap<DGPR:mode><CCZZ1:mode>_internal")
> ("*atomic_compare_and_swap<TDI:mode><CCZZ1:mode>_1")
> ("*atomic_compare_and_swapdi<CCZZ1:mode>_2")
> ("*atomic_compare_and_swapsi<CCZZ1:mode>_3"): Use s_operand to forbid
> symref memory operands. Remove CC mode and call s390_match_ccmode
> instead.
> ("atomic_exchange<mode>"): Allow and implement all integer modes.
>
> gcc/testsuite/ChangeLog-dv-atomic-gcc7
>
> * gcc.target/s390/md/atomic_compare_exchange-1.c: New test.
> * gcc.target/s390/md/atomic_compare_exchange-1.inc: New test.
> * gcc.target/s390/md/atomic_exchange-1.inc: New test.
These all look good to me now.
Thanks,
Ulrich
--
Dr. Ulrich Weigand
GNU/Linux compilers and toolchain
Ulrich.Weigand@de.ibm.com