Commit cb2eb96f by Roger Sayle Committed by Roger Sayle

re PR middle-end/28283 (SuperH: Very unoptimal code generated for 64-bit ints)


	PR middle-end/28283
	* expmed.c (expand_shift): Additionally check that the shift_cost
	is not MAX_COST and that INTVAL(op1) is less than MAX_BITS_PER_WORD
	before implementing a LSHIFT_EXPR as a sequence of additions.
	* config/sh/sh.c (shift_costs): Return MAX_COST to inform the
	middle-end that DImode shifts need to be synthesized by expand.

From-SVN: r115578
parent f604fc3b
2006-07-18 Roger Sayle <roger@eyesopen.com>
PR middle-end/28283
* expmed.c (expand_shift): Additionally check that the shift_cost
is not MAX_COST and that INTVAL(op1) is less than MAX_BITS_PER_WORD
before implementing a LSHIFT_EXPR as a sequence of additions.
* config/sh/sh.c (shift_costs): Return MAX_COST to inform the
middle-end that DImode shifts need to be synthesized by expand.
2006-07-18 Diego Novillo <dnovillo@redhat.com> 2006-07-18 Diego Novillo <dnovillo@redhat.com>
PR 28410 PR 28410
......
...@@ -1944,7 +1944,7 @@ shiftcosts (rtx x) ...@@ -1944,7 +1944,7 @@ shiftcosts (rtx x)
return 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 10000; return MAX_COST;
} }
/* If shift by a non constant, then this will be expensive. */ /* If shift by a non constant, then this will be expensive. */
if (GET_CODE (XEXP (x, 1)) != CONST_INT) if (GET_CODE (XEXP (x, 1)) != CONST_INT)
......
...@@ -2217,7 +2217,9 @@ expand_shift (enum tree_code code, enum machine_mode mode, rtx shifted, ...@@ -2217,7 +2217,9 @@ expand_shift (enum tree_code code, enum machine_mode mode, rtx shifted,
&& GET_CODE (op1) == CONST_INT && GET_CODE (op1) == CONST_INT
&& INTVAL (op1) > 0 && INTVAL (op1) > 0
&& INTVAL (op1) < GET_MODE_BITSIZE (mode) && INTVAL (op1) < GET_MODE_BITSIZE (mode)
&& shift_cost[mode][INTVAL (op1)] > INTVAL (op1) * add_cost[mode]) && INTVAL (op1) < MAX_BITS_PER_WORD
&& shift_cost[mode][INTVAL (op1)] > INTVAL (op1) * add_cost[mode]
&& shift_cost[mode][INTVAL (op1)] != MAX_COST)
{ {
int i; int i;
for (i = 0; i < INTVAL (op1); i++) for (i = 0; i < INTVAL (op1); i++)
......
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