From: Richard Sandiford Date: Sun, 6 May 2012 19:12:51 +0000 (+0000) Subject: mips.c (mips_set_reg_reg_piece_cost): New function. X-Git-Tag: misc/gccgo-go1_1_2~3065 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=91000c66b9eb9b3ec0a763c78c0f070b9b256850;p=thirdparty%2Fgcc.git 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 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 8d6637fbc197..55611c5b9795 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2012-05-06 Richard Sandiford + + * 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 * lower-subreg.c (shift_cost): Use set_src_cost, avoiding the SET. diff --git a/gcc/config/mips/mips.c b/gcc/config/mips/mips.c index 1e09f28d9a27..239d6f5a7608 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; }