Hi, This fixes an issue with the mode used for register save slots on the stack where e500 processor support is enabled along non-e500 multilibs. In that case the HARD_REGNO_CALLER_SAVE_MODE macro definition from gcc/config/rs6000/e500.h overrides one in gcc/config/rs6000/rs6000.h even for non-e500 multilibs. I think the ABI for a given multilib must not change with other multilibs being enabled or disabled.
I have therefore rewritten the generic macro to take both e500 and non-e500 cases into account, following the preexisting case of TARGET_DF_SPE -- there's no run-time performance hit for purely non-e500 targets as TARGET_E500_DOUBLE then expands to 0 and the extra e500 support code is optimised away. The change doesn't make the TARGET_VSX case check for TARGET_E500_DOUBLE being clear, as the two are mutually exclusive and guarded by CHECK_E500_OPTIONS already. This fixes: FAIL: gcc.target/powerpc/pr47862.c scan-assembler-not stfd failures on non-e500 multilibs. Regression-tested with the following powerpc-gnu-linux multilibs: -mcpu=603e -mcpu=603e -msoft-float -mcpu=8540 -mfloat-gprs=single -mspe=yes -mabi=spe -mcpu=8548 -mfloat-gprs=double -mspe=yes -mabi=spe -mcpu=7400 -maltivec -mabi=altivec -mcpu=e6500 -maltivec -mabi=altivec -mcpu=e5500 -m64 -mcpu=e6500 -m64 -maltivec -mabi=altivec OK to apply? 2014-09-01 Maciej W. Rozycki <ma...@codesourcery.com> gcc/ * config/rs6000/e500.h (HARD_REGNO_CALLER_SAVE_MODE): Remove macro. * config/rs6000/rs6000.h (HARD_REGNO_CALLER_SAVE_MODE): Handle TARGET_E500_DOUBLE case here. Maciej gcc-power-linux-e500-hard-regno-caller-save-mode.diff Index: gcc-fsf-trunk-quilt/gcc/config/rs6000/e500.h =================================================================== --- gcc-fsf-trunk-quilt.orig/gcc/config/rs6000/e500.h 2014-08-21 14:11:19.037911725 +0100 +++ gcc-fsf-trunk-quilt/gcc/config/rs6000/e500.h 2014-08-26 20:37:43.398961962 +0100 @@ -43,12 +43,3 @@ error ("E500 and FPRs not supported"); \ } \ } while (0) - -/* Override rs6000.h definition. */ -#undef HARD_REGNO_CALLER_SAVE_MODE -/* 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)) Index: gcc-fsf-trunk-quilt/gcc/config/rs6000/rs6000.h =================================================================== --- gcc-fsf-trunk-quilt.orig/gcc/config/rs6000/rs6000.h 2014-08-26 20:30:10.348973028 +0100 +++ gcc-fsf-trunk-quilt/gcc/config/rs6000/rs6000.h 2014-08-26 20:37:43.398961962 +0100 @@ -1186,9 +1186,11 @@ enum data_align { align_abi, align_opt, && ((MODE) == VOIDmode || ALTIVEC_OR_VSX_VECTOR_MODE (MODE)) \ && FP_REGNO_P (REGNO) \ ? V2DFmode \ - : ((MODE) == TFmode && FP_REGNO_P (REGNO)) \ + : TARGET_E500_DOUBLE && ((MODE) == VOIDmode || (MODE) == DFmode) \ ? DFmode \ - : ((MODE) == TDmode && FP_REGNO_P (REGNO)) \ + : !TARGET_E500_DOUBLE && (MODE) == TFmode && FP_REGNO_P (REGNO) \ + ? DFmode \ + : !TARGET_E500_DOUBLE && (MODE) == TDmode && FP_REGNO_P (REGNO) \ ? DImode \ : choose_hard_reg_mode ((REGNO), (NREGS), false))