This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: RFC: [PATCH] X86: Add pseudo prefixes to control encoding
- From: "H.J. Lu" <hjl dot tools at gmail dot com>
- To: Florian Weimer <fweimer at redhat dot com>
- Cc: Binutils <binutils at sourceware dot org>
- Date: Fri, 11 Nov 2016 12:48:35 -0800
- Subject: Re: RFC: [PATCH] X86: Add pseudo prefixes to control encoding
- Authentication-results: sourceware.org; auth=none
- References: <20161104182417.GA31915@intel.com> <fa60c8f8-ad01-5d85-8fd2-5c147151c855@redhat.com>
On Fri, Nov 11, 2016 at 12:42 PM, Florian Weimer <fweimer@redhat.com> wrote:
> On 11/04/2016 07:24 PM, H.J. Lu wrote:
>>
>> Many x86 instructions have more than one encodings. Assembler picks
>> the default one, usually the shortest one. Although the ".s", ".d8"
>> and ".d32" suffixes can be used to swap register operands or specify
>> displacement size, they aren't very flexible. This patch adds pseudo
>> prefixes, {xxx}, to control instruction encoding. The available
>> pseudo prefixes are {disp8}, {disp32}, {swap}, {vex2}, {vex3} and
>> {evex}. Pseudo prefixes are preferred over the ".s", ".d8" and ".d32"
>> suffixes, which are deprecated.
>
>
> For certain ways of writing jump tables, instruction length specifications
> would be quite useful. The assembler would be free to choose any encoding,
> as long as it has the required instruction length.
>
> Here's a bug which was caused by optimizing
>
> mov 0(%esi,%ecx,4),%edx to mov (%esi,%ecx,4),%edx
This is done on purpose since "0" can be encoded as 0, 8 or 32-bit.
Now you can use {disp8}" or "{disp32}" to prefer either 8-bit or 32-bit.
> in GAS:
>
> <https://lists.debian.org/debian-ocaml-maint/2005/11/msg00223.html>
>
> Florian
>
--
H.J.