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]

[RS6000] Fix for PR57865, _savegpr64 breakage on spe


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.

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

-- 
Alan Modra
Australia Development Lab, IBM


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