diff options
author | Richard Henderson <rth@redhat.com> | 2012-12-13 13:16:45 -0800 |
---|---|---|
committer | Richard Henderson <rth@gcc.gnu.org> | 2012-12-13 13:16:45 -0800 |
commit | 80928237a94f7bc5e717e9374880fdd05525ef27 (patch) | |
tree | cafd23a84466080e9cb01852e158f948387b42a8 /gcc | |
parent | 01f4c821945d7f96f5f24cde63fce64ca0ef88a9 (diff) | |
download | gcc-80928237a94f7bc5e717e9374880fdd05525ef27.zip gcc-80928237a94f7bc5e717e9374880fdd05525ef27.tar.gz gcc-80928237a94f7bc5e717e9374880fdd05525ef27.tar.bz2 |
re PR middle-end/55492 (__atomic_load doesn't match ACQUIRE memory model)
PR middle-end/55492
* optabs.c (expand_atomic_load): Emit acquire barrier after the load.
From-SVN: r194490
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/optabs.c | 14 |
2 files changed, 12 insertions, 7 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 9f1af89..0dbf203 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,10 @@ 2012-12-13 Richard Henderson <rth@redhat.com> + PR middle-end/55492 + * optabs.c (expand_atomic_load): Emit acquire barrier after the load. + +2012-12-13 Richard Henderson <rth@redhat.com> + * config/alpha/alpha.c (alpha_pad_function_end): Consider barriers when looking for NOTE_INSN_CALL_ARG_LOCATION. diff --git a/gcc/optabs.c b/gcc/optabs.c index d59a1ea..99fd025 100644 --- a/gcc/optabs.c +++ b/gcc/optabs.c @@ -7468,14 +7468,14 @@ expand_atomic_load (rtx target, rtx mem, enum memmodel model) if (!target || target == const0_rtx) target = gen_reg_rtx (mode); - /* Emit the appropriate barrier before the load. */ - expand_mem_thread_fence (model); + /* For SEQ_CST, emit a barrier before the load. */ + if (model == MEMMODEL_SEQ_CST) + expand_mem_thread_fence (model); emit_move_insn (target, mem); - /* For SEQ_CST, also emit a barrier after the load. */ - if (model == MEMMODEL_SEQ_CST) - expand_mem_thread_fence (model); + /* Emit the appropriate barrier after the load. */ + expand_mem_thread_fence (model); return target; } @@ -7536,13 +7536,13 @@ expand_atomic_store (rtx mem, rtx val, enum memmodel model, bool use_release) return NULL_RTX; } - /* If there is no mem_store, default to a move with barriers */ + /* Otherwise assume stores are atomic, and emit the proper barriers. */ if (model == MEMMODEL_SEQ_CST || model == MEMMODEL_RELEASE) expand_mem_thread_fence (model); emit_move_insn (mem, val); - /* For SEQ_CST, also emit a barrier after the load. */ + /* For SEQ_CST, also emit a barrier after the store. */ if (model == MEMMODEL_SEQ_CST) expand_mem_thread_fence (model); |