This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: [discuss] small challenge for instruction selection
- From: "Jan Beulich" <JBeulich at novell dot com>
- To: <hjl at lucon dot org>
- Cc: <binutils at sources dot redhat dot com>
- Date: Thu, 16 Jun 2005 07:38:42 -0600
- Subject: Re: [discuss] small challenge for instruction selection
>If you look at i386.h closely, there are
>
>/* In the 64bit mode the short form mov immediate is redefined to have
> 64bit displacement value. */
>{ "mov", 2, 0xa0, X, CpuNo64,bwl_Suf|D|W, { Disp16|Disp32, Acc, 0 } },
>{ "mov", 2, 0x88, X, 0, bwlq_Suf|D|W|Modrm, { Reg, Reg|AnyMem, 0} },
>/* In the 64bit mode the short form mov immediate is redefined to have
> 64bit displacement value. */
>{ "mov", 2, 0xb0, X, 0, bwl_Suf|W|ShortForm, { EncImm, Reg8|Reg16|Reg32, 0 } },
>{ "mov", 2, 0xc6, 0, 0, bwlq_Suf|W|Modrm, { EncImm, Reg|AnyMem, 0 } },
>{ "mov", 2, 0xb0, X, Cpu64, q_Suf|W|ShortForm, { Imm64, Reg64, 0 } },
>...
>{ "movabs",2, 0xa0, X, Cpu64, bwlq_Suf|D|W, { Disp64, Acc, 0 } },
>{ "movabs",2, 0xb0, X, Cpu64, q_Suf|W|ShortForm, { Imm64, Reg64, 0 } },
>
>I think there is an oversight. We have
>
>{ "mov", 2, 0xb0, X, Cpu64, q_Suf|W|ShortForm, { Imm64, Reg64, 0 } },
>...
>{ "movabs",2, 0xb0, X, Cpu64, q_Suf|W|ShortForm, { Imm64, Reg64, 0 } },
>
>But we just missed
>
>{ "mov",2, 0xa0, X, Cpu64, bwlq_Suf|D|W, { Disp64, Acc, 0 } },
>
>I will see what I can do.
Then it could as well be
{ "mov", 2, 0xa0, X, 0,bwl_Suf|D|W, { Disp16|Disp32|Disp64, Acc, 0 } }
at the top of the table. But as I tried to outline before, that'd (depending on its placement) either hide or be hidden by
{ "mov", 2, 0x88, X, 0, bwlq_Suf|D|W|Modrm, { Reg, Reg|AnyMem, 0} }
resulting in either the same behavior as now or all mov to/from the accumulator (and without base and/or index) to be performed with a 64-bit displacement, which needlessly increases code size for the common case.
A couple of years back I already tried to do what you're trying now, but had to give up for the reasons outlined. It would be very nice if you can make it work somehow without ill side effects...
Jan