mirror of git://gcc.gnu.org/git/gcc.git
re PR target/54089 ([SH] Refactor shift patterns)
PR target/54089 * config/sh/sh.c (shiftcosts): Remove case where first operand is a const_int. Move COSTS_N_INSNS usage into caller ... (sh_rtx_costs) ... here. Return false when shiftcosts cannot be calculated instead of MAX_COST. From-SVN: r189917
This commit is contained in:
parent
d03cefc12c
commit
ebe0dd3802
|
|
@ -1,3 +1,11 @@
|
||||||
|
2012-07-27 Oleg Endo <olegendo@gcc.gnu.org>
|
||||||
|
|
||||||
|
PR target/54089
|
||||||
|
* config/sh/sh.c (shiftcosts): Remove case where first operand
|
||||||
|
is a const_int. Move COSTS_N_INSNS usage into caller ...
|
||||||
|
(sh_rtx_costs) ... here. Return false when shiftcosts cannot be
|
||||||
|
calculated instead of MAX_COST.
|
||||||
|
|
||||||
2012-07-27 Richard Guenther <rguenther@suse.de>
|
2012-07-27 Richard Guenther <rguenther@suse.de>
|
||||||
|
|
||||||
* tree-cfg.c (gimple_can_merge_blocks_p): Do more fine-grained
|
* tree-cfg.c (gimple_can_merge_blocks_p): Do more fine-grained
|
||||||
|
|
|
||||||
|
|
@ -2859,26 +2859,22 @@ shiftcosts (rtx x)
|
||||||
{
|
{
|
||||||
int value;
|
int value;
|
||||||
|
|
||||||
/* There is no pattern for constant first operand. */
|
|
||||||
if (CONST_INT_P (XEXP (x, 0)))
|
|
||||||
return MAX_COST;
|
|
||||||
|
|
||||||
if (TARGET_SHMEDIA)
|
if (TARGET_SHMEDIA)
|
||||||
return COSTS_N_INSNS (1);
|
return 1;
|
||||||
|
|
||||||
if (GET_MODE_SIZE (GET_MODE (x)) > UNITS_PER_WORD)
|
if (GET_MODE_SIZE (GET_MODE (x)) > UNITS_PER_WORD)
|
||||||
{
|
{
|
||||||
if (GET_MODE (x) == DImode
|
if (GET_MODE (x) == DImode
|
||||||
&& CONST_INT_P (XEXP (x, 1))
|
&& CONST_INT_P (XEXP (x, 1))
|
||||||
&& INTVAL (XEXP (x, 1)) == 1)
|
&& INTVAL (XEXP (x, 1)) == 1)
|
||||||
return COSTS_N_INSNS (2);
|
return 2;
|
||||||
|
|
||||||
/* Everything else is invalid, because there is no pattern for it. */
|
/* Everything else is invalid, because there is no pattern for it. */
|
||||||
return MAX_COST;
|
return -1;
|
||||||
}
|
}
|
||||||
/* If shift by a non constant, then this will be expensive. */
|
/* If shift by a non constant, then this will be expensive. */
|
||||||
if (!CONST_INT_P (XEXP (x, 1)))
|
if (!CONST_INT_P (XEXP (x, 1)))
|
||||||
return COSTS_N_INSNS (SH_DYNAMIC_SHIFT_COST);
|
return SH_DYNAMIC_SHIFT_COST;
|
||||||
|
|
||||||
/* Otherwise, return the true cost in instructions. Cope with out of range
|
/* Otherwise, return the true cost in instructions. Cope with out of range
|
||||||
shift counts more or less arbitrarily. */
|
shift counts more or less arbitrarily. */
|
||||||
|
|
@ -2887,13 +2883,14 @@ shiftcosts (rtx x)
|
||||||
if (GET_CODE (x) == ASHIFTRT)
|
if (GET_CODE (x) == ASHIFTRT)
|
||||||
{
|
{
|
||||||
int cost = ashiftrt_insns[value];
|
int cost = ashiftrt_insns[value];
|
||||||
/* If SH3, then we put the constant in a reg and use shad. */
|
/* If dynamic shifts are available and profitable in this case, then we
|
||||||
|
put the constant in a reg and use shad. */
|
||||||
if (cost > 1 + SH_DYNAMIC_SHIFT_COST)
|
if (cost > 1 + SH_DYNAMIC_SHIFT_COST)
|
||||||
cost = 1 + SH_DYNAMIC_SHIFT_COST;
|
cost = 1 + SH_DYNAMIC_SHIFT_COST;
|
||||||
return COSTS_N_INSNS (cost);
|
return cost;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return COSTS_N_INSNS (shift_insns[value]);
|
return shift_insns[value];
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Return the cost of an AND/XOR/IOR operation. */
|
/* Return the cost of an AND/XOR/IOR operation. */
|
||||||
|
|
@ -3147,8 +3144,13 @@ sh_rtx_costs (rtx x, int code, int outer_code, int opno ATTRIBUTE_UNUSED,
|
||||||
case ASHIFT:
|
case ASHIFT:
|
||||||
case ASHIFTRT:
|
case ASHIFTRT:
|
||||||
case LSHIFTRT:
|
case LSHIFTRT:
|
||||||
*total = shiftcosts (x);
|
{
|
||||||
return true;
|
int cost = shiftcosts (x);
|
||||||
|
if (cost < 0)
|
||||||
|
return false;
|
||||||
|
*total = COSTS_N_INSNS (cost);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
case DIV:
|
case DIV:
|
||||||
case UDIV:
|
case UDIV:
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue