re PR middle-end/55492 (__atomic_load doesn't match ACQUIRE memory model)
authorRichard Henderson <rth@redhat.com>
Thu, 13 Dec 2012 21:16:45 +0000 (13:16 -0800)
committerRichard Henderson <rth@gcc.gnu.org>
Thu, 13 Dec 2012 21:16:45 +0000 (13:16 -0800)
PR middle-end/55492

        * optabs.c (expand_atomic_load): Emit acquire barrier after the load.

From-SVN: r194490

gcc/ChangeLog
gcc/optabs.c

index 9f1af89f7fc648a095b9f73d5169f06b694800c7..0dbf2032f6f678a3d985fb8b101eeaa0a649f3ed 100644 (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>
 
        * config/alpha/alpha.c (alpha_pad_function_end): Consider barriers
index d59a1eae3c199f74f81d3513618e1fe3382005e0..99fd02554fa5b9ab2d924d4736a5431723728c90 100644 (file)
@@ -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);