X86: Add pseudo prefixes to control encoding
authorH.J. Lu <hjl.tools@gmail.com>
Thu, 9 Mar 2017 17:58:46 +0000 (09:58 -0800)
committerH.J. Lu <hjl.tools@gmail.com>
Thu, 9 Mar 2017 17:59:00 +0000 (09:59 -0800)
commit86fa6981e7487e2c2df4337aa75ed2d93c32eaf2
tree3a2c124ce66bd4de896bcd0fca29dcb3f4f8f094
parentf03265d9cda1f5f8df238efa9b7a20330e5711f1
X86: Add pseudo prefixes to control encoding

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}, {load}, {store}, {vex2}, {vex3}
and {evex}.  Pseudo prefixes are preferred over the ".s", ".d8" and
".d32" suffixes, which are deprecated.

gas/

* config/tc-i386.c (_i386_insn): Add dir_encoding and
vec_encoding.  Remove swap_operand and need_vrex.
(extra_symbol_chars): Add '}'.
(md_begin): Mark '}' with LEX_BEGIN_NAME.  Allow '}' in
mnemonic.
(build_vex_prefix): Don't use 2-byte VEX encoding with
{vex3}.  Check dir_encoding and load.
(parse_insn): Check pseudo prefixes.  Set dir_encoding.
(VEX_check_operands): Likewise.
(match_template): Check dir_encoding and load.
(parse_real_register): Set vec_encoding instead of need_vrex.
(parse_register): Likewise.
* doc/c-i386.texi: Document {disp8}, {disp32}, {load}, {store},
{vex2}, {vex3} and {evex}.  Remove ".s", ".d8" and ".d32"
* testsuite/gas/i386/i386.exp: Run pseudos and x86-64-pseudos.
* testsuite/gas/i386/pseudos.d: New file.
* testsuite/gas/i386/pseudos.s: Likewise.
* testsuite/gas/i386/x86-64-pseudos.d: Likewise.
* testsuite/gas/i386/x86-64-pseudos.s: Likewise.

opcodes/

* i386-gen.c (opcode_modifiers): Replace S with Load.
* i386-opc.h (S): Removed.
(Load): New.
(i386_opcode_modifier): Replace s with load.
* i386-opc.tbl: Add {disp8}, {disp32}, {swap}, {vex2}, {vex3}
and {evex}.  Replace S with Load.
* i386-tbl.h: Regenerated.
13 files changed:
gas/ChangeLog
gas/config/tc-i386.c
gas/doc/c-i386.texi
gas/testsuite/gas/i386/i386.exp
gas/testsuite/gas/i386/pseudos.d [new file with mode: 0644]
gas/testsuite/gas/i386/pseudos.s [new file with mode: 0644]
gas/testsuite/gas/i386/x86-64-pseudos.d [new file with mode: 0644]
gas/testsuite/gas/i386/x86-64-pseudos.s [new file with mode: 0644]
opcodes/ChangeLog
opcodes/i386-gen.c
opcodes/i386-opc.h
opcodes/i386-opc.tbl
opcodes/i386-tbl.h
This page took 0.042964 seconds and 4 git commands to generate.