diff mbox

[RS6000] Fix for PR57865, _savegpr64 breakage on spe

Message ID 20130819042652.GN4024@bubble.grove.modra.org
State New
Headers show

Commit Message

Alan Modra Aug. 19, 2013, 4:26 a.m. UTC
When I made the following change
-#define FIRST_SAVED_GP_REGNO 13
+#define FIRST_SAVED_GP_REGNO	  (FIXED_R13 ? 14 : 13)
in http://gcc.gnu.org/ml/gcc-patches/2012-04/msg01274.html, I checked
all uses of FIRST_SAVED_GP_REGNO, but missed the signifigance of
FIRST_SAVRES_REGISTER appearing in the ool_adjust calculation.

Using FIRST_SAVRES_REGISTER in ool_adjust was not exactly the best
choice of available constants.  Why use a value that is the minimum
over gp, fp and vector regs, when what you need is specific to gp
regs?  Fixed as follows, bootstrapped and regression tested.
OK for mainline and 4.8?

	PR target/57865
	* config/rs6000/rs6000.c (rs6000_emit_prologue): Correct ool_adjust.
	(rs6000_emit_epilogue): Likewise.

Comments

David Edelsohn Aug. 19, 2013, 1:13 p.m. UTC | #1
On Mon, Aug 19, 2013 at 12:26 AM, Alan Modra <amodra@gmail.com> wrote:
> When I made the following change
> -#define FIRST_SAVED_GP_REGNO 13
> +#define FIRST_SAVED_GP_REGNO     (FIXED_R13 ? 14 : 13)
> in http://gcc.gnu.org/ml/gcc-patches/2012-04/msg01274.html, I checked
> all uses of FIRST_SAVED_GP_REGNO, but missed the signifigance of
> FIRST_SAVRES_REGISTER appearing in the ool_adjust calculation.
>
> Using FIRST_SAVRES_REGISTER in ool_adjust was not exactly the best
> choice of available constants.  Why use a value that is the minimum
> over gp, fp and vector regs, when what you need is specific to gp
> regs?  Fixed as follows, bootstrapped and regression tested.
> OK for mainline and 4.8?
>
>         PR target/57865
>         * config/rs6000/rs6000.c (rs6000_emit_prologue): Correct ool_adjust.
>         (rs6000_emit_epilogue): Likewise.

Okay everywhere.

Thanks, David
diff mbox

Patch

Index: gcc/config/rs6000/rs6000.c
===================================================================
--- gcc/config/rs6000/rs6000.c	(revision 200501)
+++ gcc/config/rs6000/rs6000.c	(working copy)
@@ -21043,8 +21039,7 @@  rs6000_emit_prologue (void)
 	  HOST_WIDE_INT offset;
 
 	  if (!(strategy & SAVE_INLINE_GPRS))
-	    ool_adjust = 8 * (info->first_gp_reg_save
-			      - (FIRST_SAVRES_REGISTER + 1));
+	    ool_adjust = 8 * (info->first_gp_reg_save - FIRST_SAVED_GP_REGNO);
 	  offset = info->spe_gp_save_offset + frame_off - ool_adjust;
 	  spe_save_area_ptr = gen_rtx_REG (Pmode, 11);
 	  save_off = frame_off - offset;
@@ -22286,8 +22281,7 @@  rs6000_emit_epilogue (int sibcall)
 	     anew to every function.  */
 
 	  if (!restoring_GPRs_inline)
-	    ool_adjust = 8 * (info->first_gp_reg_save
-			      - (FIRST_SAVRES_REGISTER + 1));
+	    ool_adjust = 8 * (info->first_gp_reg_save - FIRST_SAVED_GP_REGNO);
 	  frame_reg_rtx = gen_rtx_REG (Pmode, 11);
 	  emit_insn (gen_addsi3 (frame_reg_rtx, old_frame_reg_rtx,
 				 GEN_INT (info->spe_gp_save_offset