]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
mips.c (mips_set_reg_reg_piece_cost): New function.
authorRichard Sandiford <rdsandiford@googlemail.com>
Sun, 6 May 2012 19:12:51 +0000 (19:12 +0000)
committerRichard Sandiford <rsandifo@gcc.gnu.org>
Sun, 6 May 2012 19:12:51 +0000 (19:12 +0000)
gcc/
* config/mips/mips.c (mips_set_reg_reg_piece_cost): New function.
(mips_set_reg_reg_cost): Likewise.
(mips_rtx_costs): Handle SET.

From-SVN: r187213

gcc/ChangeLog
gcc/config/mips/mips.c

index 8d6637fbc1973971f51d88cda1d624b3cb5574f3..55611c5b9795a675c50f01a4169ade529bb238b2 100644 (file)
@@ -1,3 +1,9 @@
+2012-05-06  Richard Sandiford  <rdsandiford@googlemail.com>
+
+       * config/mips/mips.c (mips_set_reg_reg_piece_cost): New function.
+       (mips_set_reg_reg_cost): Likewise.
+       (mips_rtx_costs): Handle SET.
+
 2012-05-06  Richard Sandiford  <rdsandiford@googlemail.com>
 
        * lower-subreg.c (shift_cost): Use set_src_cost, avoiding the SET.
index 1e09f28d9a272a0a18c4b4f01e8ecad51909064f..239d6f5a7608bd91ce93738d09359176704b76a9 100644 (file)
@@ -3490,6 +3490,37 @@ mips_zero_extend_cost (enum machine_mode mode, rtx op)
   return COSTS_N_INSNS (1);
 }
 
+/* Return the cost of moving between two registers of mode MODE,
+   assuming that the move will be in pieces of at most UNITS bytes.  */
+
+static int
+mips_set_reg_reg_piece_cost (enum machine_mode mode, unsigned int units)
+{
+  return COSTS_N_INSNS ((GET_MODE_SIZE (mode) + units - 1) / units);
+}
+
+/* Return the cost of moving between two registers of mode MODE.  */
+
+static int
+mips_set_reg_reg_cost (enum machine_mode mode)
+{
+  switch (GET_MODE_CLASS (mode))
+    {
+    case MODE_CC:
+      return mips_set_reg_reg_piece_cost (mode, GET_MODE_SIZE (CCmode));
+
+    case MODE_FLOAT:
+    case MODE_COMPLEX_FLOAT:
+    case MODE_VECTOR_FLOAT:
+      if (TARGET_HARD_FLOAT)
+       return mips_set_reg_reg_piece_cost (mode, UNITS_PER_HWFPVALUE);
+      /* Fall through */
+
+    default:
+      return mips_set_reg_reg_piece_cost (mode, UNITS_PER_WORD);
+    }
+}
+
 /* Implement TARGET_RTX_COSTS.  */
 
 static bool
@@ -3877,6 +3908,15 @@ mips_rtx_costs (rtx x, int code, int outer_code, int opno ATTRIBUTE_UNUSED,
       *total = mips_cost->fp_add;
       return false;
 
+    case SET:
+      if (register_operand (SET_DEST (x), VOIDmode)
+         && reg_or_0_operand (SET_SRC (x), VOIDmode))
+       {
+         *total = mips_set_reg_reg_cost (GET_MODE (SET_DEST (x)));
+         return true;
+       }
+      return false;
+
     default:
       return false;
     }