This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: atomic memory operation builtins, v2


On Thu, Apr 14, 2005 at 04:39:10PM -0700, Richard Henderson wrote:
> I've committed the following patch.  Follow on patches
> for i686 and ia64 will follow shortly.
> 
> 	* optabs.c (init_optabs): Initialize sync optabs.
> 	(expand_val_compare_and_swap_1, expand_val_compare_and_swap,
> 	expand_bool_compare_and_swap, expand_compare_and_swap_loop,
> 	expand_sync_operation, expand_sync_fetch_operation,
> 	expand_sync_lock_test_and_set): New.
...
> Index: optabs.c
...
> +rtx
> +expand_bool_compare_and_swap (rtx mem, rtx old_val, rtx new_val, rtx target)
...
> +  /* Without an appropriate setcc instruction, use a set of branches to 
> +     get 1 and 0 stored into target.  Presumably if the target has a 
> +     STORE_FLAG_VALUE that isn't 1, then this will get cleaned up by ifcvt.  */
> +
> +  label0 = gen_label_rtx ();
> +  label1 = gen_label_rtx ();
> +
> +  emit_jump_insn (bcc_gen_fctn[EQ] (label0));
> +  emit_move_insn (target, const0_rtx);
> +  emit_jump_insn (gen_jump (label1));
> +  emit_label (label0);
> +  emit_move_insn (target, const1_rtx);
> +  emit_label (label1);
> +
> +  return target;
> +}

This sequence seems to cause 'verify_flow_info' to emit an "missing barrier"
error. The attached patch fixes that for me. Is that the way it was
meant? 

With the patch bootstrap and regtest was successful.

Bye,
Adrian


2005-05-12  Adrian Straetling  <straetling@de.ibm.com>

	* optabs.c: (expand_bool_compare_and_swap): Emit barrier after
	  unconditional jump.

	
Index: gcc/optabs.c
===================================================================
--- gcc/optabs.c.orig	2005-05-17 16:05:19.000000000 +0200
+++ gcc/optabs.c	2005-05-31 19:04:43.000000000 +0200
@@ -5627,6 +5627,7 @@ expand_bool_compare_and_swap (rtx mem, r
   emit_jump_insn (bcc_gen_fctn[EQ] (label0));
   emit_move_insn (target, const0_rtx);
   emit_jump_insn (gen_jump (label1));
+  emit_barrier ();
   emit_label (label0);
   emit_move_insn (target, const1_rtx);
   emit_label (label1);


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]