aboutsummaryrefslogtreecommitdiff
path: root/gcc/config
diff options
context:
space:
mode:
authorRichard Sandiford <rdsandiford@googlemail.com>2012-05-06 19:12:51 +0000
committerRichard Sandiford <rsandifo@gcc.gnu.org>2012-05-06 19:12:51 +0000
commit91000c66b9eb9b3ec0a763c78c0f070b9b256850 (patch)
tree3eab565290a349b8287d371b69033420c0d31e63 /gcc/config
parent69523a7c8957851d9fa168edc6baf175c6bf54b6 (diff)
downloadgcc-91000c66b9eb9b3ec0a763c78c0f070b9b256850.zip
gcc-91000c66b9eb9b3ec0a763c78c0f070b9b256850.tar.gz
gcc-91000c66b9eb9b3ec0a763c78c0f070b9b256850.tar.bz2
mips.c (mips_set_reg_reg_piece_cost): New function.
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
Diffstat (limited to 'gcc/config')
-rw-r--r--gcc/config/mips/mips.c40
1 files changed, 40 insertions, 0 deletions
diff --git a/gcc/config/mips/mips.c b/gcc/config/mips/mips.c
index 1e09f28..239d6f5 100644
--- a/gcc/config/mips/mips.c
+++ b/gcc/config/mips/mips.c
@@ -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;
}