This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[MIPS, committed] Fix cost of CINS
- From: Richard Sandiford <rdsandiford at googlemail dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Sun, 26 Aug 2012 20:19:37 +0100
- Subject: [MIPS, committed] Fix cost of CINS
CINS wasn't being used in -Os code because the combination didn't
seem profitable enough.
Tested on mipsisa64-elf, mips64-elf and mips64-linux-gnu. Applied.
Will be tested once gcc.target/mips uses gcc-dg.
Richard
gcc/
* config/mips/mips.c (mips_rtx_costs): Add costs for CINS.
Index: gcc/config/mips/mips.c
===================================================================
--- gcc/config/mips/mips.c 2012-08-26 11:32:09.000000000 +0100
+++ gcc/config/mips/mips.c 2012-08-26 11:34:07.346812457 +0100
@@ -3681,6 +3681,18 @@ mips_rtx_costs (rtx x, int code, int out
+ set_src_cost (XEXP (x, 0), speed));
return true;
}
+ if (ISA_HAS_CINS && CONST_INT_P (XEXP (x, 1)))
+ {
+ rtx op = XEXP (x, 0);
+ if (GET_CODE (op) == ASHIFT
+ && CONST_INT_P (XEXP (op, 1))
+ && mask_low_and_shift_p (mode, XEXP (x, 1), XEXP (op, 1), 32))
+ {
+ *total = COSTS_N_INSNS (1) + set_src_cost (XEXP (op, 0), speed);
+ return true;
+ }
+ }
+
/* Fall through. */
case IOR: