Commit ba0cfa17 by James Greenhalgh Committed by James Greenhalgh

[AArch64 costs 11/18] Improve costs for rotate and shift operations.

	* config/aarch64/aarch64.c (aarch64_rtx_costs): Improve costs for
	rotates and shifts.


Co-Authored-By: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>

From-SVN: r210503
parent b1685e62
2014-05-16 James Greenhalgh <james.greenhalgh@arm.com> 2014-05-16 James Greenhalgh <james.greenhalgh@arm.com>
Philipp Tomsich <philipp.tomsich@theobroma-systems.com> Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
* config/aarch64/aarch64.c (aarch64_rtx_costs): Improve costs for
rotates and shifts.
2014-05-16 James Greenhalgh <james.greenhalgh@arm.com>
Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
* config/aarch64/aarch64.c (aarch64_rtx_costs): Cost * config/aarch64/aarch64.c (aarch64_rtx_costs): Cost
ZERO_EXTEND and SIGN_EXTEND better. ZERO_EXTEND and SIGN_EXTEND better.
......
...@@ -5339,21 +5339,59 @@ cost_minus: ...@@ -5339,21 +5339,59 @@ cost_minus:
*cost += extra_cost->alu.extend; *cost += extra_cost->alu.extend;
return false; return false;
case ASHIFT:
op0 = XEXP (x, 0);
op1 = XEXP (x, 1);
if (CONST_INT_P (op1))
{
/* LSL (immediate), UBMF, UBFIZ and friends. These are all
aliases. */
if (speed)
*cost += extra_cost->alu.shift;
/* We can incorporate zero/sign extend for free. */
if (GET_CODE (op0) == ZERO_EXTEND
|| GET_CODE (op0) == SIGN_EXTEND)
op0 = XEXP (op0, 0);
*cost += rtx_cost (op0, ASHIFT, 0, speed);
return true;
}
else
{
/* LSLV. */
if (speed)
*cost += extra_cost->alu.shift_reg;
return false; /* All arguments need to be in registers. */
}
case ROTATE: case ROTATE:
if (!CONST_INT_P (XEXP (x, 1)))
*cost += COSTS_N_INSNS (2);
/* Fall through. */
case ROTATERT: case ROTATERT:
case LSHIFTRT: case LSHIFTRT:
case ASHIFT:
case ASHIFTRT: case ASHIFTRT:
op0 = XEXP (x, 0);
op1 = XEXP (x, 1);
/* Shifting by a register often takes an extra cycle. */ if (CONST_INT_P (op1))
if (speed && !CONST_INT_P (XEXP (x, 1))) {
*cost += extra_cost->alu.arith_shift_reg; /* ASR (immediate) and friends. */
if (speed)
*cost += extra_cost->alu.shift;
*cost += rtx_cost (XEXP (x, 0), ASHIFT, 0, speed); *cost += rtx_cost (op0, (enum rtx_code) code, 0, speed);
return true; return true;
}
else
{
/* ASR (register) and friends. */
if (speed)
*cost += extra_cost->alu.shift_reg;
return false; /* All arguments need to be in registers. */
}
case HIGH: case HIGH:
if (!CONSTANT_P (XEXP (x, 0))) if (!CONSTANT_P (XEXP (x, 0)))
......
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