Commit 23cb6618 by Wilco Dijkstra Committed by Kyrylo Tkachov

[AArch64] Fix aarch64_rtx_costs of PLUS/MINUS

On behalf of Wilco Dijkstra

2015-05-01  Wilco Dijkstra  <wdijkstr@arm.com>

	* gcc/config/aarch64/aarch64.c (aarch64_rtx_costs):
	Calculate cost of op0 and op1 in PLUS and MINUS cases.

From-SVN: r222676
parent 1d15ed75
2015-05-01 Wilco Dijkstra <wdijkstr@arm.com>
* gcc/config/aarch64/aarch64.c (aarch64_rtx_costs):
Calculate cost of op0 and op1 in PLUS and MINUS cases.
2015-05-01 Kyrylo Tkachov <kyrylo.tkachov@arm.com> 2015-05-01 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
* config/aarch64/aarch64.c (aarch64_rtx_costs, COMPARE case): * config/aarch64/aarch64.c (aarch64_rtx_costs, COMPARE case):
......
...@@ -5880,6 +5880,8 @@ aarch64_rtx_costs (rtx x, int code, int outer ATTRIBUTE_UNUSED, ...@@ -5880,6 +5880,8 @@ aarch64_rtx_costs (rtx x, int code, int outer ATTRIBUTE_UNUSED,
op1 = XEXP (x, 1); op1 = XEXP (x, 1);
cost_minus: cost_minus:
*cost += rtx_cost (op0, MINUS, 0, speed);
/* Detect valid immediates. */ /* Detect valid immediates. */
if ((GET_MODE_CLASS (mode) == MODE_INT if ((GET_MODE_CLASS (mode) == MODE_INT
|| (GET_MODE_CLASS (mode) == MODE_CC || (GET_MODE_CLASS (mode) == MODE_CC
...@@ -5887,13 +5889,10 @@ cost_minus: ...@@ -5887,13 +5889,10 @@ cost_minus:
&& CONST_INT_P (op1) && CONST_INT_P (op1)
&& aarch64_uimm12_shift (INTVAL (op1))) && aarch64_uimm12_shift (INTVAL (op1)))
{ {
*cost += rtx_cost (op0, MINUS, 0, speed);
if (speed) if (speed)
/* SUB(S) (immediate). */ /* SUB(S) (immediate). */
*cost += extra_cost->alu.arith; *cost += extra_cost->alu.arith;
return true; return true;
} }
/* Look for SUB (extended register). */ /* Look for SUB (extended register). */
...@@ -5918,7 +5917,6 @@ cost_minus: ...@@ -5918,7 +5917,6 @@ cost_minus:
*cost += aarch64_rtx_mult_cost (new_op1, MULT, *cost += aarch64_rtx_mult_cost (new_op1, MULT,
(enum rtx_code) code, (enum rtx_code) code,
speed); speed);
*cost += rtx_cost (op0, MINUS, 0, speed);
return true; return true;
} }
...@@ -5965,6 +5963,8 @@ cost_plus: ...@@ -5965,6 +5963,8 @@ cost_plus:
return true; return true;
} }
*cost += rtx_cost (op1, PLUS, 1, speed);
/* Look for ADD (extended register). */ /* Look for ADD (extended register). */
if (aarch64_rtx_arith_op_extract_p (op0, mode)) if (aarch64_rtx_arith_op_extract_p (op0, mode))
{ {
...@@ -5986,12 +5986,10 @@ cost_plus: ...@@ -5986,12 +5986,10 @@ cost_plus:
{ {
*cost += aarch64_rtx_mult_cost (new_op0, MULT, PLUS, *cost += aarch64_rtx_mult_cost (new_op0, MULT, PLUS,
speed); speed);
*cost += rtx_cost (op1, PLUS, 1, speed);
return true; return true;
} }
*cost += (rtx_cost (new_op0, PLUS, 0, speed) *cost += rtx_cost (new_op0, PLUS, 0, speed);
+ rtx_cost (op1, PLUS, 1, speed));
if (speed) if (speed)
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment