From patchwork Thu Jun 10 01:17:12 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: PR 44364, e500 caller-save slots Date: Wed, 09 Jun 2010 15:17:12 -0000 From: Alan Modra X-Patchwork-Id: 55140 Message-Id: <20100610011712.GO7312@bubble.grove.modra.org> To: gcc-patches@gcc.gnu.org Cc: David Edelsohn 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. 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))