[PATCH] i386: Only check suffix in instruction mnemonic

H.J. Lu hjl.tools@gmail.com
Fri Nov 8 15:54:00 GMT 2019


On Thu, Nov 7, 2019 at 11:41 PM Jan Beulich <jbeulich@suse.com> wrote:
>
> On 07.11.2019 22:52,  H.J. Lu  wrote:
> > Another problem is Intel syntax sets instruction suffix from operand size:
>
> An unrelated one, but yes.
>
> > [hjl@gnu-cfl-1 gas]$ cat 2.s
> > .intel_syntax noprefix
> > call WORD PTR [rax]
> > [hjl@gnu-cfl-1 gas]$ as -mintel64 -o 2.o 2.s
> > 2.s: Assembler messages:
> > 2.s:2: Error: invalid instruction suffix for `call'
> > [hjl@gnu-cfl-1 gas]$
> >
> > It is operand size mismatch, not invalid instruction suffix.  In case
> > of CMPSD and
> > and MOVSD,the 'l' suffix is invalid, not DWORD on memory operand.  But suffix
> > check treats them the same.  This makes Intel syntax more complicated.   Should
> > Intel syntax disallow suffix in mnemonic?  It will make Intel syntax
> > closer to SDM.
>
> There are some suffixes that need honoring. The original authors
> of the code apparently decided that it's better to accept some
> stray/bogus suffixes than to further complicate the code. I guess
> once we have the No_*Suf attributes put straight (as mentioned by
> Michael the other day, matching plans I've been having), then we
> could see about further cleaning up Intel syntax behavior here.
>

I am checking in this.

We should check suffix in instruction mnemonic when matching instruction.
In Intel syntax, normally we check for memory operand size.  But the same
mnemonic with 2 different encodings can have the same memory operand
size and i.suffix is set to LONG_DOUBLE_MNEM_SUFFIX from memory operand
size in Intel syntax to distinguish them.  When there is no suffix in
mnemonic, we check LONG_DOUBLE_MNEM_SUFFIX in i.suffix for mnemonic
suffix.

gas/

PR gas/25167
* config/tc-i386.c (match_template): Don't check instruction
suffix set from operand.
* testsuite/gas/i386/code16.d: New file.
* testsuite/gas/i386/code16.s: Likewise.
* testsuite/gas/i386/i386.exp: Run code16.

opcodes/

PR gas/25167
* i386-opc.tbl: Remove IgnoreSize from cmpsd and movsd.
* i386-tbl.h: Regenerated.


-- 
H.J.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-i386-Only-check-suffix-in-instruction-mnemonic.patch
Type: application/x-patch
Size: 11997 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20191108/eb02b5fe/attachment.bin>


More information about the Binutils mailing list