[PATCH][RFH] Fix PR31169, bootstrap failure on SHIFT_COUNT_TRUNCATED targets

Richard Guenther richard.guenther@gmail.com
Sat Mar 31 14:53:00 GMT 2007


On 3/30/07, Richard Henderson <rth@redhat.com> wrote:
> On Fri, Mar 30, 2007 at 01:54:44PM +0200, Richard Guenther wrote:
> > This fixes the bootstrap failure on hppa, sparc and alpha (and maybe other
> > SHIFT_COUNT_TRUNCATED targets).  It's not {r,l}shift_doubles business to
> > truncate the shift count on such targets (I believe).
>
> For the record, I've responded in the PR stating that I think
> it probably *is* necessary for rshift_doubles to handle this
> case, and with an alternate patch.

It looks like a very bad design to have target dependencies in routines
computing with double HOST(!)_WIDE_INTs.  But as you say it might
be there for a reason which is why I asked that somebody tests this case.
Of course we can work around this in VRP as well.  Which doesn't make
me like that {r,l}shift_doubles code better - it's just asking for trouble.
After all, it's only combine and cse that seem to care about
SHIFT_COUNT_TRUNCATED.

This code has been there since forever (r9917):

r9917 | kenner | 1995-06-10 01:29:17 +0200 (Sat, 10 Jun 1995) | 4 lines

(lshift_double): Replace `&' with `%' to fix typo.
(lshift_double, rshift_double): Truncate shift count only if
SHIFT_COUNT_TRUNCATED.  Remove unnecessary `count >= prec' test.

and r7473:

r7473 | tege | 1994-06-15 04:23:14 +0200 (Wed, 15 Jun 1994) | 14 lines

...
add_double, mul_double, lshift_double, rshift_double): Rewrite.

I see it's to have consistency between what the machine does and
what gcc does, but tree ints are used for host computations as well,
not only target computations like real.c.  Please consider removing
this target dependency from the middle-end utility routines.

Richard.



More information about the Gcc-patches mailing list