This was fun to track down

Jeffrey A Law law@cygnus.com
Wed Sep 24 23:15:00 GMT 1997


  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.  */



More information about the Gcc mailing list