This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: New back end ia16: 16-bit Intel x86
Rask Ingemann Lambertsen wrote:
>
> It is not different in your case! You're targetting the i386, so you can
> use i386 addressing modes at just the cost of a 0x67 prefix:
>
Well, then you're effectively doing nothing other than the .code16gcc hack.
> $ echo -e '.code16\nleaw (%eax,%ecx,2),%bp' | as
> $ objdump --wide --disassemble -m i8086 a.out
>
> a.out: file format elf32-i386
>
> Disassembly of section .text:
>
> 00000000 <.text>:
> 0: 67 8d 2c 48 addr32 lea (%eax,%ecx,2),%bp
>
> Obviously you want to save the 0x67 prefix whenever possible; use
> "20(%bp)" instead of "20(%ebp)", for example.
>
> I target only i286 or less, so none of the fancy stuff is available.
> Watch me being green with envy.
>
>> It is also much harder to eliminate the frame pointer in
>> 16-bit mode, since there is no %sp-based addressing at all.
>
> With disp(%esp) being valid on i386, you don't have that problem either.
If your environment isn't clean w.r.t. the top half of %esp, you can't
*ever* use this mode. The stack pointer especially...
-hpa