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]

Re: [PATCH RFC] PR 47862: Fix caller-save spill of vectors on PowerPC


On 03/01/2011 09:06 PM, Alan Modra wrote:
On Tue, Mar 01, 2011 at 05:22:15PM -0600, Pat Haugen wrote:
>  Are there alternative solutions to this such that we'll use scalar
>  FP store/load insns for SF/DF mode spill and vector store/load insns
>  for vector spill?
I made a similar fix a while ago in rs6000/e500.h (which your patch
will clash with, BTW, needs an undef somewhere).  Going from memory, I
believe you can use something like

#define HARD_REGNO_CALLER_SAVE_MODE(REGNO, NREGS, MODE)	\
   (TARGET_VSX						\
    &&  ((MODE) == VOIDmode || (MODE) == V2DFmode)	\
    &&  FP_REGNO_P (REGNO)				\
    ? V2DFmode						\
    : choose_hard_reg_mode ((REGNO), (NREGS), false))

This will allocate enough space for the vector regs, but only
save/restore using FP insns if the reg is used in a FP mode.


I don't see how this can result in shortening of the save/restore length. caller-save.c:save_call_clobbered_regs() initally sets save_mode[] to the prior computed widest mode (V2DFmode in this case), and the following code will only attempt to increase it.


                  mode = HARD_REGNO_CALLER_SAVE_MODE
                    (r, nregs, PSEUDO_REGNO_MODE (regno));
                  if (GET_MODE_BITSIZE (mode)
                      > GET_MODE_BITSIZE (save_mode[r]))
                    save_mode[r] = mode;

Modifying the above code to always update save_mode[r] to the mode of the pseudo would surely do the trick.


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