summaryrefslogtreecommitdiff
path: root/gcc/optabs.c
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2013-01-18 12:34:11 -0800
committerH.J. Lu <hjl.tools@gmail.com>2013-01-18 12:34:11 -0800
commit43269d882367dc4f0e4c2651d6625e1b7de78764 (patch)
tree6aaf525a6fb8a4fb63a71c9ca56be58bc1d6655b /gcc/optabs.c
parentce97ec0e268b7b50b9f801dd12ffc67042c47193 (diff)
parent48dc1117de124a2265129a36bfbbc211522c2c02 (diff)
downloadgcc-hjl/tsx/gcc-4_7-branch.tar.gz
Merge remote-tracking branch 'origin/gcc-4_7-branch' into hjl/tsx/gcc-4_7-branchhjl/tsx/gcc-4_7-branch
Conflicts: gcc/config/i386/driver-i386.c gcc/config/i386/i386.c gcc/config/i386/sync.md
Diffstat (limited to 'gcc/optabs.c')
-rw-r--r--gcc/optabs.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/gcc/optabs.c b/gcc/optabs.c
index fd353d7e627..91b4661090d 100644
--- a/gcc/optabs.c
+++ b/gcc/optabs.c
@@ -7700,14 +7700,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;
}
@@ -7768,13 +7768,12 @@ 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 */
- if (model == MEMMODEL_SEQ_CST || model == MEMMODEL_RELEASE)
- expand_mem_thread_fence (model);
+ /* Otherwise assume stores are atomic, and emit the proper barriers. */
+ 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);