diff options
author | Richard Sandiford <rdsandiford@googlemail.com> | 2012-05-06 19:12:51 +0000 |
---|---|---|
committer | Richard Sandiford <rsandifo@gcc.gnu.org> | 2012-05-06 19:12:51 +0000 |
commit | 91000c66b9eb9b3ec0a763c78c0f070b9b256850 (patch) | |
tree | 3eab565290a349b8287d371b69033420c0d31e63 /gcc | |
parent | 69523a7c8957851d9fa168edc6baf175c6bf54b6 (diff) | |
download | gcc-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')
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/config/mips/mips.c | 40 |
2 files changed, 46 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 8d6637f..55611c5 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,11 @@ 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. (compute_costs): Likewise for the zero extension. Use set_rtx_cost to compute the cost of moves. Set the mode of the target register. 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; } |