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]

[PATCH]: Fix HC11 address computation using stack pointer


Hi!

I've committed the following patch on 3_0 branch and mainline to fix
the HC11 code generation with -fomit-frame-pointer.  Address computation
with the stack pointer was not correct in some cases.

	Stephane

2001-10-01  Stephane Carrez  <Stephane.Carrez@worldnet.fr>

	* config/m68hc11/m68hc11.md ("add-split"): Fix add split when
	operand 2 is the stack pointer.
	("addr-peephole"): Fix address computation peephole when operand 2
	is the stack pointer.
Index: config/m68hc11/m68hc11.md
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/m68hc11/m68hc11.md,v
retrieving revision 1.18
diff -u -p -r1.18 m68hc11.md
--- m68hc11.md	2001/09/30 17:33:18	1.18
+++ m68hc11.md	2001/10/01 13:30:31
@@ -3657,8 +3657,9 @@
               (set (match_dup 0) (reg:HI D_REGNUM))])]
   "
    /* Save the operand2 in a temporary location and use it. */
-   if (H_REG_P (operands[2])
-       || reg_mentioned_p  (operands[0], operands[2]))
+   if ((H_REG_P (operands[2])
+        || reg_mentioned_p  (operands[0], operands[2]))
+       && !(SP_REG_P (operands[2]) && GET_CODE (operands[3]) == PLUS))
      {
        operands[4] = gen_rtx (REG, HImode, SOFT_TMP_REGNUM);
        operands[6] = operands[4];
@@ -6121,9 +6122,14 @@
 {
   int value_loaded = 1;
 
-  if (X_REG_P (operands[0]))
+  if (X_REG_P (operands[0]) || SP_REG_P (operands[2]))
     {
-      output_asm_insn (\"ldx\\t%2\\n\\txgdx\", operands);
+      rtx ops[2];
+
+      ops[0] = operands[0];
+      ops[1] = operands[2];
+      m68hc11_gen_movhi (insn, ops);
+      output_asm_insn (\"xgd%0\", operands);
     }
   else if (Y_REG_P (operands[0]))
     {

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