From: Richard Henderson Date: Thu, 13 Dec 2012 21:16:45 +0000 (-0800) Subject: re PR middle-end/55492 (__atomic_load doesn't match ACQUIRE memory model) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=80928237a94f7bc5e717e9374880fdd05525ef27;p=gcc.git 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 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 9f1af89f7fc..0dbf2032f6f 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2012-12-13 Richard Henderson + + PR middle-end/55492 + * optabs.c (expand_atomic_load): Emit acquire barrier after the load. + 2012-12-13 Richard Henderson * config/alpha/alpha.c (alpha_pad_function_end): Consider barriers diff --git a/gcc/optabs.c b/gcc/optabs.c index d59a1eae3c1..99fd02554fa 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);