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
This commit is contained in:
Richard Henderson 2012-12-13 13:16:45 -08:00 committed by Richard Henderson
parent 01f4c82194
commit 80928237a9
2 changed files with 12 additions and 7 deletions

View File

@ -1,3 +1,8 @@
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> 2012-12-13 Richard Henderson <rth@redhat.com>
* config/alpha/alpha.c (alpha_pad_function_end): Consider barriers * config/alpha/alpha.c (alpha_pad_function_end): Consider barriers

View File

@ -7468,14 +7468,14 @@ expand_atomic_load (rtx target, rtx mem, enum memmodel model)
if (!target || target == const0_rtx) if (!target || target == const0_rtx)
target = gen_reg_rtx (mode); target = gen_reg_rtx (mode);
/* Emit the appropriate barrier before the load. */ /* For SEQ_CST, emit a barrier before the load. */
expand_mem_thread_fence (model); if (model == MEMMODEL_SEQ_CST)
expand_mem_thread_fence (model);
emit_move_insn (target, mem); emit_move_insn (target, mem);
/* For SEQ_CST, also emit a barrier after the load. */ /* Emit the appropriate barrier after the load. */
if (model == MEMMODEL_SEQ_CST) expand_mem_thread_fence (model);
expand_mem_thread_fence (model);
return target; return target;
} }
@ -7536,13 +7536,13 @@ expand_atomic_store (rtx mem, rtx val, enum memmodel model, bool use_release)
return NULL_RTX; 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) if (model == MEMMODEL_SEQ_CST || model == MEMMODEL_RELEASE)
expand_mem_thread_fence (model); expand_mem_thread_fence (model);
emit_move_insn (mem, val); 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) if (model == MEMMODEL_SEQ_CST)
expand_mem_thread_fence (model); expand_mem_thread_fence (model);