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.wa...@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.wa...@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.wa...@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.wa...@arm.com> > > * gcc.target/aarch64/atomic-inst-ldadd.c: Add tests for > update-fetch operations. > * gcc.target/aarch64/atomic-inst-ldlogic.c: Likewise. > >