From 9df0192130fd054a9edf84884ca7bbccf8f7679a Mon Sep 17 00:00:00 2001 From: "Maciej W. Rozycki" Date: Mon, 1 Dec 2014 12:56:08 +0000 Subject: [PATCH] mips.c (mips16_build_call_stub): Move the save of the return address in $18 ahead of passing arguments to FPRs. * config/mips/mips.c (mips16_build_call_stub): Move the save of the return address in $18 ahead of passing arguments to FPRs. From-SVN: r218209 --- gcc/ChangeLog | 5 +++++ gcc/config/mips/mips.c | 17 ++++++++++++----- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 7aeb9bf3844..c31d8bcd462 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2014-12-01 Maciej W. Rozycki + + * config/mips/mips.c (mips16_build_call_stub): Move the save of + the return address in $18 ahead of passing arguments to FPRs. + 2014-12-01 Ilya Enkovich PR target/64055 diff --git a/gcc/config/mips/mips.c b/gcc/config/mips/mips.c index 5a53d5fefc9..85992852cfe 100644 --- a/gcc/config/mips/mips.c +++ b/gcc/config/mips/mips.c @@ -6942,6 +6942,17 @@ mips16_build_call_stub (rtx retval, rtx *fn_ptr, rtx args_size, int fp_code) /* "Save" $sp in itself so we don't use the fake CFA. This is: DW_CFA_val_expression r29, { DW_OP_reg29 }. */ fprintf (asm_out_file, "\t.cfi_escape 0x16,29,1,0x6d\n"); + + /* Save the return address in $18. The stub's caller knows + that $18 might be clobbered, even though $18 is usually + a call-saved register. + + Do it early on in case the last move to a floating-point + register can be scheduled into the delay slot of the + call we are about to make. */ + fprintf (asm_out_file, "\tmove\t%s,%s\n", + reg_names[GP_REG_FIRST + 18], + reg_names[RETURN_ADDR_REGNUM]); } else { @@ -6963,11 +6974,7 @@ mips16_build_call_stub (rtx retval, rtx *fn_ptr, rtx args_size, int fp_code) if (fp_ret_p) { - /* Save the return address in $18 and call the non-MIPS16 function. - The stub's caller knows that $18 might be clobbered, even though - $18 is usually a call-saved register. */ - fprintf (asm_out_file, "\tmove\t%s,%s\n", - reg_names[GP_REG_FIRST + 18], reg_names[RETURN_ADDR_REGNUM]); + /* Now call the non-MIPS16 function. */ output_asm_insn (MIPS_CALL ("jal", &fn, 0, -1), &fn); fprintf (asm_out_file, "\t.cfi_register 31,18\n"); -- 2.30.2