This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[csl-arm] ARM mla costs.
- From: Paul Brook <paul at codesourcery dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Fri, 29 Sep 2006 20:36:38 +0100
- Subject: [csl-arm] ARM mla costs.
The arm rtx_cost routine doesn't know about multiply-add instructions. This
means they get given the same cost as an add with memory operands.
On cores with a single-cycle multiply this is greater than the combined cost
of separate mul and add insns.
Patch below fixes this.
Tested with cross to arm-none-eabi.
Applied to branches/csl/sourcerygxx-4_1.
I'll apply to mainline once it reopens.
Paul
2006-09-29 Paul Brook <paul@codesourcery.com>
* config/arm/arm.c (arm_rtx_costs_1): Handle multiply-accumulate.
Index: gcc/config/arm/arm.c
===================================================================
--- gcc/config/arm/arm.c (revision 117308)
+++ gcc/config/arm/arm.c (working copy)
@@ -4740,6 +4740,14 @@ arm_rtx_costs_1 (rtx x, enum rtx_code co
/* Fall through */
case PLUS:
+ if (GET_CODE (XEXP (x, 0)) == MULT)
+ {
+ extra_cost = rtx_cost (XEXP (x, 0), code);
+ if (!REG_OR_SUBREG_REG (XEXP (x, 1)))
+ extra_cost += 4 * ARM_NUM_REGS (mode);
+ return extra_cost;
+ }
+
if (GET_MODE_CLASS (mode) == MODE_FLOAT)
return (2 + (REG_OR_SUBREG_REG (XEXP (x, 0)) ? 0 : 8)
+ ((REG_OR_SUBREG_REG (XEXP (x, 1))