re PR rtl-optimization/48596 ([SH] unable to find a register to spill in class 'FPUL_...
authorKaz Kojima <kkojima@gcc.gnu.org>
Fri, 2 Mar 2012 23:59:08 +0000 (23:59 +0000)
committerKaz Kojima <kkojima@gcc.gnu.org>
Fri, 2 Mar 2012 23:59:08 +0000 (23:59 +0000)
PR target/48596
PR target/48806
* config/sh/sh.c (sh_register_move_cost): Increase cost between
GENERAL_REGS and FP_REGS for SImode.

From-SVN: r184844

gcc/ChangeLog
gcc/config/sh/sh.c

index eabe45f2dfd468c360e03eb96eac244f53df6590..e2c179d5cb069aa90a30d3a7572178eeab966066 100644 (file)
@@ -1,3 +1,10 @@
+2012-03-02  Kaz Kojima  <kkojima@gcc.gnu.org>
+
+       PR target/48596
+       PR target/48806
+       * config/sh/sh.c (sh_register_move_cost): Increase cost between
+       GENERAL_REGS and FP_REGS for SImode.
+
 2012-03-02  Oleg Endo  <olegendo@gcc.gnu.org>
 
        PR target/49486
index 901a5a2b748fdbc356e571f23346234542e7c98a..00258f42b8d45bd5ebe9655fdf099519a0a43058 100644 (file)
@@ -11517,8 +11517,15 @@ sh_register_move_cost (enum machine_mode 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));
+    {
+      /* Discourage trying to use fp regs for a pointer.  This also
+        discourages fp regs with SImode because Pmode is an alias
+        of SImode on this target.  See PR target/48596.  */
+      int addend = (mode == Pmode) ? 40 : 0;
+
+      return (((TARGET_SHMEDIA ? 4 : TARGET_FMOVD ? 8 : 12) + addend)
+             * ((GET_MODE_SIZE (mode) + 7) / 8U));
+    }
 
   if ((dstclass == FPUL_REGS
        && REGCLASS_HAS_GENERAL_REG (srcclass))