diff options
author | Richard Henderson <richard.henderson@linaro.org> | 2018-10-31 23:11:22 +0000 |
---|---|---|
committer | Richard Henderson <rth@gcc.gnu.org> | 2018-10-31 16:11:22 -0700 |
commit | 53de1ea800db54b47290d578c43892799b66c8dc (patch) | |
tree | 7e6aa0d2eed28621a627f57bccb596ebfae1c2f7 /gcc | |
parent | 4911c15c97820eeccc97aa73563c9605bba073a1 (diff) | |
download | gcc-53de1ea800db54b47290d578c43892799b66c8dc.zip gcc-53de1ea800db54b47290d578c43892799b66c8dc.tar.gz gcc-53de1ea800db54b47290d578c43892799b66c8dc.tar.bz2 |
aarch64: Remove early clobber from ATOMIC_LDOP scratch
* config/aarch64/atomics.md (aarch64_atomic_<ATOMIC_LDOP><ALLI>_lse):
The scratch register need not be early-clobber. Document the reason
why we cannot use ST<OP>.
From-SVN: r265703
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/config/aarch64/atomics.md | 14 |
2 files changed, 19 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 8361165..8510ddd 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2018-10-31 Richard Henderson <richard.henderson@linaro.org> + + * config/aarch64/atomics.md (aarch64_atomic_<ATOMIC_LDOP><ALLI>_lse): + scratch register need not be early-clobber. Document the reason + why we cannot use ST<OP>. + 2018-10-31 Joseph Myers <joseph@codesourcery.com> PR bootstrap/82856 diff --git a/gcc/config/aarch64/atomics.md b/gcc/config/aarch64/atomics.md index 2198649..00f7af4 100644 --- a/gcc/config/aarch64/atomics.md +++ b/gcc/config/aarch64/atomics.md @@ -263,6 +263,18 @@ } ) +;; It is tempting to want to use ST<OP> for relaxed and release +;; memory models here. However, that is incompatible with the +;; C++ memory model for the following case: +;; +;; atomic_fetch_add(ptr, 1, memory_order_relaxed); +;; atomic_thread_fence(memory_order_acquire); +;; +;; The problem is that the architecture says that ST<OP> (and LD<OP> +;; insns where the destination is XZR) are not regarded as a read. +;; However we also implement the acquire memory barrier with DMB LD, +;; and so the ST<OP> is not blocked by the barrier. + (define_insn "aarch64_atomic_<atomic_ldoptab><mode>_lse" [(set (match_operand:ALLI 0 "aarch64_sync_memory_operand" "+Q") (unspec_volatile:ALLI @@ -270,7 +282,7 @@ (match_operand:ALLI 1 "register_operand" "r") (match_operand:SI 2 "const_int_operand")] ATOMIC_LDOP)) - (clobber (match_scratch:ALLI 3 "=&r"))] + (clobber (match_scratch:ALLI 3 "=r"))] "TARGET_LSE" { enum memmodel model = memmodel_from_int (INTVAL (operands[2])); |