Commit 4c7c486a by Kazu Hirata Committed by Kazu Hirata

arm.c (arm_rtx_costs_1): Use power_of_two_operand where appropriate.

	* config/arm/arm.c (arm_rtx_costs_1): Use power_of_two_operand
	where appropriate.

From-SVN: r146602
parent d5df9a20
2009-04-22 Kazu Hirata <kazu@codesourcery.com> 2009-04-22 Kazu Hirata <kazu@codesourcery.com>
* config/arm/arm.c (arm_rtx_costs_1): Use power_of_two_operand
where appropriate.
2009-04-22 Kazu Hirata <kazu@codesourcery.com>
* config/arm/arm.c (arm_size_rtx_costs): Treat a PLUS with a shift * config/arm/arm.c (arm_size_rtx_costs): Treat a PLUS with a shift
the same as a PLUS without a shift. Increase the cost of a the same as a PLUS without a shift. Increase the cost of a
CONST_INT in MULT. CONST_INT in MULT.
......
...@@ -5141,9 +5141,7 @@ arm_rtx_costs_1 (rtx x, enum rtx_code outer, int* total, bool speed) ...@@ -5141,9 +5141,7 @@ arm_rtx_costs_1 (rtx x, enum rtx_code outer, int* total, bool speed)
/* A shift as a part of RSB costs no more than RSB itself. */ /* A shift as a part of RSB costs no more than RSB itself. */
if (GET_CODE (XEXP (x, 0)) == MULT if (GET_CODE (XEXP (x, 0)) == MULT
&& GET_CODE (XEXP (XEXP (x, 0), 1)) == CONST_INT && power_of_two_operand (XEXP (XEXP (x, 0), 1), SImode))
&& ((INTVAL (XEXP (XEXP (x, 0), 1))
& (INTVAL (XEXP (XEXP (x, 0), 1)) - 1)) == 0))
{ {
*total += rtx_cost (XEXP (XEXP (x, 0), 0), code, speed); *total += rtx_cost (XEXP (XEXP (x, 0), 0), code, speed);
*total += rtx_cost (XEXP (x, 1), code, speed); *total += rtx_cost (XEXP (x, 1), code, speed);
...@@ -5151,9 +5149,7 @@ arm_rtx_costs_1 (rtx x, enum rtx_code outer, int* total, bool speed) ...@@ -5151,9 +5149,7 @@ arm_rtx_costs_1 (rtx x, enum rtx_code outer, int* total, bool speed)
} }
if (subcode == MULT if (subcode == MULT
&& GET_CODE (XEXP (XEXP (x, 1), 1)) == CONST_INT && power_of_two_operand (XEXP (XEXP (x, 1), 1), SImode))
&& ((INTVAL (XEXP (XEXP (x, 1), 1)) &
(INTVAL (XEXP (XEXP (x, 1), 1)) - 1)) == 0))
{ {
*total += rtx_cost (XEXP (x, 0), code, speed); *total += rtx_cost (XEXP (x, 0), code, speed);
*total += rtx_cost (XEXP (XEXP (x, 1), 0), subcode, speed); *total += rtx_cost (XEXP (XEXP (x, 1), 0), subcode, speed);
...@@ -5189,9 +5185,7 @@ arm_rtx_costs_1 (rtx x, enum rtx_code outer, int* total, bool speed) ...@@ -5189,9 +5185,7 @@ arm_rtx_costs_1 (rtx x, enum rtx_code outer, int* total, bool speed)
multiplication by a power of two, so that we fall down into multiplication by a power of two, so that we fall down into
the code below. */ the code below. */
if (GET_CODE (XEXP (x, 0)) == MULT if (GET_CODE (XEXP (x, 0)) == MULT
&& ! (GET_CODE (XEXP (XEXP (x, 0), 1)) == CONST_INT && !power_of_two_operand (XEXP (XEXP (x, 0), 1), SImode))
&& ((INTVAL (XEXP (XEXP (x, 0), 1)) &
(INTVAL (XEXP (XEXP (x, 0), 1)) - 1)) == 0)))
{ {
/* The cost comes from the cost of the multiply. */ /* The cost comes from the cost of the multiply. */
return false; return false;
...@@ -5274,9 +5268,7 @@ arm_rtx_costs_1 (rtx x, enum rtx_code outer, int* total, bool speed) ...@@ -5274,9 +5268,7 @@ arm_rtx_costs_1 (rtx x, enum rtx_code outer, int* total, bool speed)
} }
if (subcode == MULT if (subcode == MULT
&& GET_CODE (XEXP (XEXP (x, 0), 1)) == CONST_INT && power_of_two_operand (XEXP (XEXP (x, 0), 1), SImode))
&& ((INTVAL (XEXP (XEXP (x, 0), 1)) &
(INTVAL (XEXP (XEXP (x, 0), 1)) - 1)) == 0))
{ {
*total += rtx_cost (XEXP (x, 1), code, speed); *total += rtx_cost (XEXP (x, 1), code, speed);
*total += rtx_cost (XEXP (XEXP (x, 0), 0), subcode, speed); *total += rtx_cost (XEXP (XEXP (x, 0), 0), subcode, speed);
...@@ -5333,9 +5325,7 @@ arm_rtx_costs_1 (rtx x, enum rtx_code outer, int* total, bool speed) ...@@ -5333,9 +5325,7 @@ arm_rtx_costs_1 (rtx x, enum rtx_code outer, int* total, bool speed)
|| subcode == LSHIFTRT || subcode == LSHIFTRT
|| subcode == ROTATE || subcode == ROTATERT || subcode == ROTATE || subcode == ROTATERT
|| (subcode == MULT || (subcode == MULT
&& GET_CODE (XEXP (XEXP (x, 0), 1)) == CONST_INT && power_of_two_operand (XEXP (XEXP (x, 0), 1), SImode)))
&& ((INTVAL (XEXP (XEXP (x, 0), 1)) &
(INTVAL (XEXP (XEXP (x, 0), 1)) - 1)) == 0)))
{ {
*total += rtx_cost (XEXP (XEXP (x, 0), 0), subcode, speed); *total += rtx_cost (XEXP (XEXP (x, 0), 0), subcode, speed);
/* Register shifts cost an extra cycle. */ /* Register shifts cost an extra cycle. */
...@@ -5443,9 +5433,7 @@ arm_rtx_costs_1 (rtx x, enum rtx_code outer, int* total, bool speed) ...@@ -5443,9 +5433,7 @@ arm_rtx_costs_1 (rtx x, enum rtx_code outer, int* total, bool speed)
} }
if (subcode == MULT if (subcode == MULT
&& GET_CODE (XEXP (XEXP (x, 0), 1)) == CONST_INT && power_of_two_operand (XEXP (XEXP (x, 0), 1), SImode))
&& ((INTVAL (XEXP (XEXP (x, 0), 1)) &
(INTVAL (XEXP (XEXP (x, 0), 1)) - 1)) == 0))
{ {
*total += rtx_cost (XEXP (x, 1), code, speed); *total += rtx_cost (XEXP (x, 1), code, speed);
*total += rtx_cost (XEXP (XEXP (x, 0), 0), subcode, speed); *total += rtx_cost (XEXP (XEXP (x, 0), 0), subcode, 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