[Patch] MIPS: fix Mips16 frame pointer in prologue.

David Ung davidu@mips.com
Thu Aug 25 15:15:00 GMT 2005


This patch fixes the problems of setting up the frame pointer
incorrectly when the outgoing argument area is > 32k.
This is problem is seen when running the regressions with -mips16.

Schedule of variations:
    mips-sim-idt32/-mips32/-mips16

...
FAIL: gcc.c-torture/execute/pr20621-1.c execution,  -O0
FAIL: gcc.c-torture/execute/pr20621-1.c execution,  -O1
FAIL: gcc.c-torture/execute/pr20621-1.c execution,  -O2
...
FAIL: gcc.c-torture/execute/pr23135.c execution,  -O0
FAIL: gcc.c-torture/execute/pr23135.c execution,  -O1
FAIL: gcc.c-torture/execute/pr23135.c execution,  -O2
...
FAIL: gcc.c-torture/execute/pr23135.c execution,  -Os
...
                === gcc Summary ===

# of expected passes            35859
# of unexpected failures        21
# of unexpected successes       1
# of expected failures          74
# of untested testcases         28
# of unsupported tests          532
/local/fsf-mainline/gcc/xgcc  version 4.1.0 20050822 (experimental)


after applying the patch below, I get

                === gcc Summary ===

# of expected passes            35866
# of unexpected failures        14
# of unexpected successes       1
# of expected failures          74
# of untested testcases         28
# of unsupported tests          532
/local/fsf-mainline/gcc/xgcc  version 4.1.0 20050822 (experimental)

ok for mainline?

David.


2005-08-25  David Ung  <davidu@mips.com>

	* config/mips/mips.c (mips_expand_prologue): Handle case when
	generating for MIPS16 and the outgoing argument area is more than
	SMALL_OPERAND. Use the frame pointer as temporary to generate the
	add instruction. 

Index: gcc/config/mips/mips.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/mips/mips.c,v
retrieving revision 1.520
diff -c -p -b -r1.520 mips.c
*** gcc/config/mips/mips.c	6 Aug 2005 13:26:10 -0000	1.520
--- gcc/config/mips/mips.c	25 Aug 2005 14:44:18 -0000
*************** mips_expand_prologue (void)
*** 6736,6745 ****
--- 6736,6758 ----
        if (TARGET_MIPS16 && cfun->machine->frame.args_size != 0)
  	{
  	  rtx offset = GEN_INT (cfun->machine->frame.args_size);
+ 	  if (SMALL_OPERAND (cfun->machine->frame.args_size))
  	    RTX_FRAME_RELATED_P 
  	      (emit_insn (gen_add3_insn (hard_frame_pointer_rtx,
  					 stack_pointer_rtx,
  					 offset))) = 1;
+ 	  else
+ 	    {
+ 	      emit_move_insn (MIPS_PROLOGUE_TEMP (Pmode), offset);
+ 	      emit_move_insn (hard_frame_pointer_rtx, stack_pointer_rtx);
+ 	      emit_insn (gen_add3_insn (hard_frame_pointer_rtx,
+ 					hard_frame_pointer_rtx,
+ 					MIPS_PROLOGUE_TEMP (Pmode)));
+ 	      mips_set_frame_expr
+ 		(gen_rtx_SET (VOIDmode, hard_frame_pointer_rtx,
+ 			      plus_constant (stack_pointer_rtx, 
+ 					     cfun->machine->frame.args_size)));
+ 	    }
  	}
        else
  	RTX_FRAME_RELATED_P (emit_move_insn (hard_frame_pointer_rtx,



More information about the Gcc-patches mailing list