This was fun to track down

David S. Miller davem@jenolan.rutgers.edu
Tue Sep 23 14:16:00 GMT 1997


   Date: Tue, 23 Sep 1997 22:53:47 +0200
   From: Torbjorn Granlund <tege@pdc.kth.se>

   1. It seems strange that convert_modes put a constant into a register.
      Maybe that is a bug.
   2. If convert_modes is really right, the proper fix to expand_divmod
      would be to avoid calling it when op1 is constant.

What if you are computing an offset from a Pmode ptr (which is the
case in the test case I just sent to this list) and the CONST_INT is
_negative_ and of a smaller mode than Pmode, and the CONST_INT is
SImod and Pmode is DImode (32 and 64 bits respecticaly) on a 64-bit
target?

So I don't see convert_modes() as doing anything wrong, if anything
you could say at best that it is missing an optimization opportunity,
for the case when the CONST_INT is not negative.

For "2" I say that your suggestion is just moving an optimization into
expand_divmod() which really belongs in convert_modes().  And for the
"CONST_INT and negative" case your suggestion would generate incorrect
code on certain targets.

Later,
David "Sparc" Miller
davem@caip.rutgers.edu



More information about the Gcc mailing list