Manuel Bouyer wrote:
On Sun, Oct 19, 2008 at 02:30:28PM +0200, Johnny Billquist wrote:Manuel Bouyer wrote:Don't you really mean the number of bits used from the register depends on the instruction?On Sun, Oct 19, 2008 at 02:07:36PM +0200, Johnny Billquist wrote:Hey! Don't shoot the messenger.But no, I wouldn't consider them all "native". The size of the registers is what I'd define as native.The size of the registers depend on the instruction on x86_64 ...Not really. For 8 bits instructions e.g. %al and %ah really behaves as 2 independant registers.
Now I'll move into very thin ice, since my knowledge of the x86 is limited. But I believe this is the same concept as can be seen in the Z80. You have one 16-bit register, called HL.It can also be accessed as two 8-bit registers. H and L. If you modify H, you are modifying the high byte of HL. So it's really the same 16-bit register the whole time. You just have a way of addressing just a part of it. Or you could say that you only have 8-bit registers, and there is a way to extract and operate on a combination of two in specific ways in some instructions. Either way, I think it's wrong to say that you really have registers of different sizes because of this.
The same kind of thing can be done partially on a PDP-11 or a VAX (and I assume any other architecture). You you refer with a byte instruction to a register, you'll just get the low byte. And it will behave consistently as a byte register. You'll get wrap-around and tests done on just that part of the full register. It don't mean that the register isn't 16 (or 32) bits anyway. With partially I mean that you can only access the low part. There is no easy way of accessing the high part of the register independently.
Johnny