http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48596
--- Comment #5 from Kazumoto Kojima <kkojima at gcc dot gnu.org> 2011-08-02 23:53:30 UTC --- I was trying to find a way that solves it without penalizing -O2 or the higher cases, though it's not easy to me. It seems that the target's register_move_cost is the way to discourage trying to use FP registers for a pointer. Unfortunately, Pmode is simply SImode for our case and it also discourages using a FP reg as a cheap storage for SImode. I've tried --- ORIG/trunk/gcc/config/sh/sh.c 2011-08-01 09:22:27.000000000 +0900 +++ trunk/gcc/config/sh/sh.c 2011-08-01 09:41:25.000000000 +0900 @@ -11472,8 +11472,18 @@ sh_register_move_cost (enum machine_mode && REGCLASS_HAS_GENERAL_REG (srcclass)) || (REGCLASS_HAS_GENERAL_REG (dstclass) && REGCLASS_HAS_FP_REG (srcclass))) - return ((TARGET_SHMEDIA ? 4 : TARGET_FMOVD ? 8 : 12) - * ((GET_MODE_SIZE (mode) + 7) / 8U)); + { + if (TARGET_SHMEDIA) + return 4 * ((GET_MODE_SIZE (mode) + 7) / 8U); + else + { + /* Discourage trying to use fp regs for a pointer. */ + int addend = (mode == Pmode) ? 40 : 0; + + return (((TARGET_FMOVD ? 8 : 12) + addend) + * ((GET_MODE_SIZE (mode) + 7) / 8U)); + } + } if ((dstclass == FPUL_REGS && REGCLASS_HAS_GENERAL_REG (srcclass)) on the current trunk and observed some CSiBE testresults. A bit surprisingly, there are no code size regressions and one 2% improvement for teem-1.6.0-src src/bane/gkmsTxf which reduces to 3192 bytes from 3256 bytes. Now I'm inclined to apply it on trunk if it passes the bootstrap/regression/other tests.