On Mon, Nov 27, 2006 at 02:21:36PM -0800, Ian Lance Taylor wrote: > Rask Ingemann Lambertsen <[EMAIL PROTECTED]> writes: > > > If I take out the lines 5643 and 5644 > > > > if (regno < FIRST_PSEUDO_REGISTER) > > regno = subreg_regno (rld[r].in_reg); > > > > it will instead get regno = 10, mode = SImode and last_reg = (reg:SI 8 si) > > and call subreg_regno_offset (xregno=8, xmode=SImode, offset=2, > > ymode=HImode) > > which is fine and returns 1. > > I have to agree that this looks rather dubious. It seems to me that > when we increment regno in the lines above, we need to reset byte to 0.
I'll try it out. I think I even prefer this way since it would make it possible to inherit the high part even if the low part has been clobbered. The only disadvantage is when updating reg_last_reload_reg[] using the piecemeal code: /* If NREGNO is a hard register, it may occupy more than one register. If it does, say what is in the rest of the registers assuming that both registers agree on how many words the object takes. If not, invalidate the subsequent registers. */ Because I've modelled the 8086 with 8-bit registers al/ah/bl/bh/cl/ch/dl/dh, the src and dest registers might not agree on the number of registers the object takes and then this optimization wouldn't apply. But that could be improved later. > It seems possible that it could be a bug, since a SUBREG of a hard > register is unusual. It happens when a pseudo has been allocated to multiple hard registers of a class not supported by the constraints. This could be quite rare. In this case it was only triggered because the constraint was more restrictive that necessary. Mainline subreg_regno_offset() could fail to detect invalid parameters. I'll try adding gcc_assert (subreg_offset_representable_p (...)) to subreg_regno_offset() and see if a bootstrap and regression test of i686-pc-linux-gnu succeeds. -- Rask Ingemann Lambertsen