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]

[expmed] Avoid clobbering a yet-to-be-used base/index register.


20040625-1 fails on targets with pointers bigger than WORD_SIZE (rl78,
msp430/-mlarge) because the base register is clobbered, partially
rebuilt with the new value, then used as a base for the second part of
the calculation.  Ok?

	* expmed.c (extract_bit_field_1): Avoid clobbering a
	yet-to-be-used base/index register.

 
Index: expmed.c
===================================================================
--- expmed.c	(revision 223850)
+++ expmed.c	(working copy)
@@ -1613,12 +1613,17 @@ extract_bit_field_1 (rtx str_rtx, unsign
       unsigned int i;
       rtx_insn *last;
 
       if (target == 0 || !REG_P (target) || !valid_multiword_target_p (target))
 	target = gen_reg_rtx (mode);
 
+      /* In case we're about to clobber a base register or something 
+	 (see gcc.c-torture/execute/20040625-1.c).   */
+      if (reg_mentioned_p (target, str_rtx))
+	target = gen_reg_rtx (mode);
+
       /* Indicate for flow that the entire target reg is being set.  */
       emit_clobber (target);
 
       last = get_last_insn ();
       for (i = 0; i < nwords; i++)
 	{


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