summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsayle <sayle@138bc75d-0d04-0410-961f-82ee72b054a4>2006-07-19 05:13:56 +0000
committersayle <sayle@138bc75d-0d04-0410-961f-82ee72b054a4>2006-07-19 05:13:56 +0000
commit99d2e279e9fc2f616f5dc829937723e337ed4e0e (patch)
tree3487eac9da851d55f914f10ff317d63bd8311b83
parent59bfec983fd2836c58b2093bb3f576801744807e (diff)
downloadppe42-gcc-99d2e279e9fc2f616f5dc829937723e337ed4e0e.tar.gz
ppe42-gcc-99d2e279e9fc2f616f5dc829937723e337ed4e0e.zip
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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@115578 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog9
-rw-r--r--gcc/config/sh/sh.c2
-rw-r--r--gcc/expmed.c4
3 files changed, 13 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 435f32508eb..24bf834c7bc 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,12 @@
+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>
PR 28410
diff --git a/gcc/config/sh/sh.c b/gcc/config/sh/sh.c
index 97d87416f1c..15eae4c7cd7 100644
--- a/gcc/config/sh/sh.c
+++ b/gcc/config/sh/sh.c
@@ -1944,7 +1944,7 @@ shiftcosts (rtx x)
return 2;
/* 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 (GET_CODE (XEXP (x, 1)) != CONST_INT)
diff --git a/gcc/expmed.c b/gcc/expmed.c
index 6f4e3311546..0f3a14df509 100644
--- a/gcc/expmed.c
+++ b/gcc/expmed.c
@@ -2217,7 +2217,9 @@ expand_shift (enum tree_code code, enum machine_mode mode, rtx shifted,
&& GET_CODE (op1) == CONST_INT
&& INTVAL (op1) > 0
&& 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;
for (i = 0; i < INTVAL (op1); i++)
OpenPOWER on IntegriCloud