New back end ia16: 16-bit Intel x86

H. Peter Anvin hpa@zytor.com
Sun Aug 19 07:29:00 GMT 2007


Rask Ingemann Lambertsen wrote:
> 
>    I target only i286 or less, so none of the fancy stuff is available.
> Watch me being green with envy.
> 

I was thinking about usage spaces, there are pretty much the remaining
uses of 16-bit code as far as I can tell:

186+:	residual microcontroller use (80186/80188 were available for the
        microcontroller market until not all that long ago)
386+:	bootloaders, PCI card firmware
686+:	mainboard firmware, PCI-e card firmware

All of these are primarily constrained by space, so size optimization is
what really matters.  I have so far operated on the assumption that
16-bit addressing modes are more space-efficient than 32-bit ones,
despite the register allocation issues, due to the lack of 67 prefixes,
SIB bytes, 32-bit offsets and the occational need to save/restore a
32-bit register instead of a 16-bit one.

286, 486, and 586 don't really add enough instructions to be worth
worrying with, as far as I can see.  386 obviously adds 32-bit registers
and a whole bunch of useful instructions (movsx, movzx especially); 686
adds cmov (although that only saves one byte compared to a branch over a
mov.)

	-hpa



More information about the Gcc-patches mailing list