diff options
author | Roger Sayle <roger@eyesopen.com> | 2005-11-26 04:06:57 +0000 |
---|---|---|
committer | Roger Sayle <sayle@gcc.gnu.org> | 2005-11-26 04:06:57 +0000 |
commit | 18eaea7f15cf89aa5e0c9c99c76b14dfc39563c5 (patch) | |
tree | c16de2a90743698ed3aced9ff6b2d3d645393e96 | |
parent | 7e7b53aa73f8b47b73e924289204eac5d84723cf (diff) | |
download | gcc-18eaea7f15cf89aa5e0c9c99c76b14dfc39563c5.zip gcc-18eaea7f15cf89aa5e0c9c99c76b14dfc39563c5.tar.gz gcc-18eaea7f15cf89aa5e0c9c99c76b14dfc39563c5.tar.bz2 |
re PR middle-end/21309 (internal compiler error: in expand_mult_const, at expmed.c:2884)
PR middle-end/21309
* expmed.c (choose_mult_variant): Return immediately when mult_cost
is less than zero. Limit mult_cost to a reasonable upper bound for
the synthetic multiplication sequence.
From-SVN: r107537
-rw-r--r-- | gcc/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/expmed.c | 11 |
2 files changed, 18 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 654acf2..c4ec10c 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2005-11-25 Roger Sayle <roger@eyesopen.com> + + PR middle-end/21309 + * expmed.c (choose_mult_variant): Return immediately when mult_cost + is less than zero. Limit mult_cost to a reasonable upper bound for + the synthetic multiplication sequence. + 2005-11-25 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> PR middle-end/25022 diff --git a/gcc/expmed.c b/gcc/expmed.c index d591b6b..ec2758e 100644 --- a/gcc/expmed.c +++ b/gcc/expmed.c @@ -2836,6 +2836,17 @@ choose_mult_variant (enum machine_mode mode, HOST_WIDE_INT val, struct mult_cost limit; int op_cost; + /* Fail quickly for impossible bounds. */ + if (mult_cost < 0) + return false; + + /* Ensure that mult_cost provides a reasonable upper bound. + Any constant multiplication can be performed with less + than 2 * bits additions. */ + op_cost = 2 * GET_MODE_BITSIZE (mode) * add_cost[mode]; + if (mult_cost > op_cost) + mult_cost = op_cost; + *variant = basic_variant; limit.cost = mult_cost; limit.latency = mult_cost; |