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]

[PATCH]: HC11 regression, don't rely on REG_WAS_0 notes


Hi!

I was too optimistic in thinking the REG_WAS_0 notes could be used.
They can in some cases.  But they are not removed in other cases and
this results in wrong value to be set (reg is incremented/decremented instead
of loading +1/-1 in it, but since the previous reg value is *not* 0, we get a wrong value).

I committed this patch on 3_3 and mainline to disable their use.

Stephane

2003-03-31 Stephane Carrez <stcarrez at nerim dot fr>

	* config/m68hc11/m68hc11.c (m68hc11_gen_movhi): Don't rely on REG_WAS_0
	notes as they are boggus.
	(m68hc11_gen_movqi): Likewise.
Index: config/m68hc11/m68hc11.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/m68hc11/m68hc11.c,v
retrieving revision 1.56.4.13
diff -u -p -r1.56.4.13 m68hc11.c
--- config/m68hc11/m68hc11.c	31 Mar 2003 20:32:01 -0000	1.56.4.13
+++ config/m68hc11/m68hc11.c	31 Mar 2003 20:35:14 -0000
@@ -3261,7 +3261,8 @@ m68hc11_gen_movhi (insn, operands)
 	{
 	  if (SP_REG_P (operands[0]))
 	    output_asm_insn ("lds\t%1", operands);
-	  else if (!D_REG_P (operands[0])
+	  else if (0 /* REG_WAS_0 note is boggus;  don't rely on it.  */
+                   && !D_REG_P (operands[0])
                    && GET_CODE (operands[1]) == CONST_INT
                    && (INTVAL (operands[1]) == 1 || INTVAL (operands[1]) == -1)
                    && find_reg_note (insn, REG_WAS_0, 0))
@@ -3454,7 +3455,8 @@ m68hc11_gen_movhi (insn, operands)
 	      cc_status = cc_prev_status;
 	      output_asm_insn ("tsx", operands);
 	    }
-	  else if (GET_CODE (operands[1]) == CONST_INT
+	  else if (0 /* REG_WAS_0 note is boggus;  don't rely on it.  */
+                   && GET_CODE (operands[1]) == CONST_INT
                    && (INTVAL (operands[1]) == 1 || INTVAL (operands[1]) == -1)
                    && find_reg_note (insn, REG_WAS_0, 0))
             {
@@ -3511,7 +3513,8 @@ m68hc11_gen_movhi (insn, operands)
 	      cc_status = cc_prev_status;
 	      output_asm_insn ("tsy", operands);
 	    }
-	  else if (GET_CODE (operands[1]) == CONST_INT
+	  else if (0 /* REG_WAS_0 note is boggus;  don't rely on it.  */
+                   && GET_CODE (operands[1]) == CONST_INT
                    && (INTVAL (operands[1]) == 1 || INTVAL (operands[1]) == -1)
                    && find_reg_note (insn, REG_WAS_0, 0))
             {
@@ -3760,7 +3763,8 @@ m68hc11_gen_movqi (insn, operands)
 		  output_asm_insn ("ldab\t%T0", operands);
 		}
 	    }
-	  else if (GET_CODE (operands[1]) == CONST_INT
+	  else if (0 /* REG_WAS_0 note is boggus;  don't rely on it.  */
+                   && GET_CODE (operands[1]) == CONST_INT
                    && (INTVAL (operands[1]) == 1 || INTVAL (operands[1]) == -1)
                    && find_reg_note (insn, REG_WAS_0, 0))
             {

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