This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: This was fun to track down
- To: Jim Wilson <wilson at cygnus dot com>
- Subject: Re: This was fun to track down
- From: Jeffrey A Law <law at cygnus dot com>
- Date: Thu, 25 Sep 1997 00:17:50 -0600
- cc: egcs at cygnus dot com, Torbjorn Granlund <tege at pdc dot kth dot se>, "David S. Miller" <davem at jenolan dot rutgers dot edu>
- Reply-To: law at cygnus dot com
In message <199709241957.MAA01872@cygnus.com>you write:
> I see no reason why expand_divmod needs to call convert_modes in this case.
> If we are passed in a constant value, then we should keep the value as a
> constant, so that we have a chance of emitting optimized code for the divide.
> There is no need to emit insns to perform an actual conversion on the value.
> All we need to do is convert the RTL itself, and I don't even think that is
> necessary, since a CONST_INT is valid regardless of the mode.
>
> Hence, it looks like expmed.c should be calling gen_lowpart (or something
> similar) instead of convert_modes if op1 is a constant. This will give
> better code than the current patch by retaining the constant.
Note the following comment in convert_modes; it may apply to any attempt
to use gen_lowpart:
/* There is one case that we must handle specially: If we are converting
a CONST_INT into a mode whose size is twice HOST_BITS_PER_WIDE_INT and
we are to interpret the constant as unsigned, gen_lowpart will do
the wrong if the constant appears negative. What we want to do is
make the high-order word of the constant zero, not all ones. */