Patchwork PR 44364, e500 caller-save slots

login
register
mail settings
Submitter Alan Modra
Date June 10, 2010, 1:17 a.m.
Message ID <20100610011712.GO7312@bubble.grove.modra.org>
Download mbox | patch
Permalink /patch/55140/
State New
Headers show

Comments

Alan Modra - June 10, 2010, 1:17 a.m.
e500 can use 64-bit gprs for fp calculations, but the normal size of
gprs for integer calculations is 32-bit.  This confuses gcc's
caller-save logic, resulting in only the low 32 bits being saved even
when the full 64-bit register is in use.  Fixed as follows, but this
tickles a bug in caller-save.c.  See
http://gcc.gnu.org/ml/gcc-patches/2010-06/msg01033.html 

OK to apply assuming bootstrap/regress test passes?

	PR target/44364
	* config/rs6000/e500.h (HARD_REGNO_CALLER_SAVE_MODE): Define.
David Edelsohn - June 10, 2010, 12:30 p.m.
On Wed, Jun 9, 2010 at 9:17 PM, Alan Modra <amodra@gmail.com> wrote:
> e500 can use 64-bit gprs for fp calculations, but the normal size of
> gprs for integer calculations is 32-bit.  This confuses gcc's
> caller-save logic, resulting in only the low 32 bits being saved even
> when the full 64-bit register is in use.  Fixed as follows, but this
> tickles a bug in caller-save.c.  See
> http://gcc.gnu.org/ml/gcc-patches/2010-06/msg01033.html
>
> OK to apply assuming bootstrap/regress test passes?
>
>        PR target/44364
>        * config/rs6000/e500.h (HARD_REGNO_CALLER_SAVE_MODE): Define.

Okay.

Thanks, David

Patch

Index: gcc/config/rs6000/e500.h
===================================================================
--- gcc/config/rs6000/e500.h	(revision 160245)
+++ gcc/config/rs6000/e500.h	(working copy)
@@ -43,3 +43,10 @@ 
 	  error ("E500 and FPRs not supported");			\
       }									\
   } while (0)
+
+/* When setting up caller-save slots (MODE == VOIDmode) ensure we
+   allocate space for DFmode.  Save gprs in the correct mode too.  */
+#define HARD_REGNO_CALLER_SAVE_MODE(REGNO, NREGS, MODE) \
+  (TARGET_E500_DOUBLE && ((MODE) == VOIDmode || (MODE) == DFmode)	\
+   ? DFmode								\
+   : choose_hard_reg_mode ((REGNO), (NREGS), false))