This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [AArch64][PATCH 5/5] Use atomic load-operate instructions for update-fetch patterns.
- From: James Greenhalgh <james dot greenhalgh at arm dot com>
- To: Matthew Wahab <matthew dot wahab at foss dot arm dot com>
- Cc: "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>
- Date: Mon, 21 Sep 2015 15:16:14 +0100
- Subject: Re: [AArch64][PATCH 5/5] Use atomic load-operate instructions for update-fetch patterns.
- Authentication-results: sourceware.org; auth=none
- References: <55FAEC63 dot 7040403 at foss dot arm dot com> <55FAF059 dot 2030205 at foss dot arm dot com> <55FFECB0 dot 7070508 at foss dot arm dot com>
On Mon, Sep 21, 2015 at 12:40:32PM +0100, Matthew Wahab wrote:
> On 17/09/15 17:54, Matthew Wahab wrote:
> > ARMv8.1 adds atomic swap and atomic load-operate instructions with
> > optional memory ordering specifiers. This patch uses the ARMv8.1
> > load-operate instructions to implement the atomic_<op>_fetch patterns.
> >
> > The approach is to use the atomic load-operate instruction to atomically
> > load the data and update memory and then to use the loaded data to
> > calculate the value that the instruction would have stored. The
> > calculation attempts to mirror the operation of the atomic instruction.
> > For example, atomic_and_fetch<mode> is implemented with an atomic
> > load-bic so the result is also calculated using a BIC instruction.
> >
> [...]
> >
> > 2015-09-17 Matthew Wahab <matthew.wahab@arm.com>
> >
> > * config/aarch64/aarch64-protos.h (aarch64_gen_atomic_ldop):
> > Adjust declaration.
> > * config/aarch64/aarch64.c (aarch64_emit_bic): New.
> > (aarch64_gen_atomic_load_op): Adjust comment. Add parameter
> > out_result. Update to support update-fetch operations.
> > * config/aarch64/atomics.md (aarch64_atomic_exchange<mode>_lse):
> > Adjust for change to aarch64_gen_atomic_ldop.
> > (aarch64_atomic_<atomic_optab><mode>_lse): Likewise.
> > (aarch64_atomic_fetch_<atomic_optab><mode>_lse): Likewise.
> > (atomic_<atomic_optab>_fetch<mode>): Change to an expander.
> > (aarch64_atomic_<atomic_optab>_fetch<mode>): New.
> > (aarch64_atomic_<atomic_optab>_fetch<mode>_lse): New.
> >
> > gcc/testsuite
> > 2015-09-17 Matthew Wahab <matthew.wahab@arm.com>
> >
> > * gcc.target/aarch64/atomic-inst-ldadd.c: Add tests for
> > update-fetch operations.
> > * gcc.target/aarch64/atomic-inst-ldlogic.c: Likewise.
> >
>
> Attached an updated patch that takes into account the review comments and changes for
> the rest of the series.
>
> The changes in this patch:
> - Updated emit_bic for changes in the earlier patch.
> - Simplified the patterns used in the new expanders.
> - Dropped CC clobber from the _lse patterns.
>
> Tested the series for aarch64-none-linux-gnu with native bootstrap and
> make check. Also tested for aarch64-none-elf with cross-compiled
> check-gcc on an ARMv8.1 emulator with +lse enabled by default.
>
> Ok for trunk?
OK.
Thanks,
James
> Matthew
>
> 2015-09-21 Matthew Wahab <matthew.wahab@arm.com>
>
> * config/aarch64/aarch64-protos.h (aarch64_gen_atomic_ldop):
> Adjust declaration.
> * config/aarch64/aarch64.c (aarch64_emit_bic): New.
> (aarch64_gen_atomic_ldop): Adjust comment. Add parameter
> out_result. Update to support update-fetch operations.
> * config/aarch64/atomics.md (aarch64_atomic_exchange<mode>_lse):
> Adjust for change to aarch64_gen_atomic_ldop.
> (aarch64_atomic_<atomic_optab><mode>_lse): Likewise.
> (aarch64_atomic_fetch_<atomic_optab><mode>_lse): Likewise.
> (atomic_<atomic_optab>_fetch<mode>): Change to an expander.
> (aarch64_atomic_<atomic_optab>_fetch<mode>): New.
> (aarch64_atomic_<atomic_optab>_fetch<mode>_lse): New.
>
> gcc/testsuite
> 2015-09-21 Matthew Wahab <matthew.wahab@arm.com>
>
> * gcc.target/aarch64/atomic-inst-ldadd.c: Add tests for
> update-fetch operations.
> * gcc.target/aarch64/atomic-inst-ldlogic.c: Likewise.
>
>