public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* CRIS atomics revisited 1/4: use need_atomic_barrier_p.
@ 2012-07-16  3:42 Hans-Peter Nilsson
  0 siblings, 0 replies; only message in thread
From: Hans-Peter Nilsson @ 2012-07-16  3:42 UTC (permalink / raw)
  To: gcc-patches

Use the new need_atomic_barrier_p.

gcc:
	* config/cris/sync.md ("atomic_fetch_<atomic_op_name><mode>")
	("atomic_compare_and_swap<mode>"): Gate expand_mem_thread_fence
	calls on result of call to need_atomic_barrier_p.

Index: config/cris/sync.md
===================================================================
--- config/cris/sync.md	(revision 189499)
+++ config/cris/sync.md	(working copy)
@@ -93,11 +93,15 @@ (define_expand "atomic_fetch_<atomic_op_
   if (<MODE>mode != QImode && TARGET_TRAP_UNALIGNED_ATOMIC)
     cris_emit_trap_for_misalignment (operands[1]);
 
-  expand_mem_thread_fence (mmodel);
+  if (need_atomic_barrier_p (mmodel, true))
+    expand_mem_thread_fence (mmodel);
+
   emit_insn (gen_cris_atomic_fetch_<atomic_op_name><mode>_1 (operands[0],
 							     operands[1],
 							     operands[2]));
-  expand_mem_thread_fence (mmodel);
+  if (need_atomic_barrier_p (mmodel, false))
+    expand_mem_thread_fence (mmodel);
+
   DONE;
 })
 
@@ -196,13 +200,17 @@ (define_expand "atomic_compare_and_swap<
   if (<MODE>mode != QImode && TARGET_TRAP_UNALIGNED_ATOMIC)
     cris_emit_trap_for_misalignment (operands[2]);
 
-  expand_mem_thread_fence (mmodel);
+  if (need_atomic_barrier_p (mmodel, true))
+    expand_mem_thread_fence (mmodel);
+
   emit_insn (gen_cris_atomic_compare_and_swap<mode>_1 (operands[0],
 						       operands[1],
 						       operands[2],
 						       operands[3],
 						       operands[4]));
-  expand_mem_thread_fence (mmodel);
+  if (need_atomic_barrier_p (mmodel, false))
+    expand_mem_thread_fence (mmodel);
+
   DONE;
 })
 
brgds, H-P

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2012-07-16  3:42 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-07-16  3:42 CRIS atomics revisited 1/4: use need_atomic_barrier_p Hans-Peter Nilsson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).