x86: Replace IgnoreSize/DefaultSize with MnemonicSize

Since an instruction template can't have both IgnoreSize and DefaultSize,
this patch replaces IgnoreSize and DefaultSize with MnemonicSize.

gas/

	* config/tc-i386.c (match_template): Replace ignoresize and
	defaultsize with mnemonicsize.
	(process_suffix): Likewise.

opcodes/

	* i386-gen.c (opcode_modifiers): Replace IgnoreSize/DefaultSize
	with MnemonicSize.
	* i386-opc.h (IGNORESIZE): New.
	(DEFAULTSIZE): Likewise.
	(IgnoreSize): Removed.
	(DefaultSize): Likewise.
	(MnemonicSize): New.
	(i386_opcode_modifier): Replace ignoresize/defaultsize with
	mnemonicsize.
	* i386-opc.tbl (IgnoreSize): New.
	(DefaultSize): Likewise.
	* i386-tbl.h: Regenerated.
This commit is contained in:
H.J. Lu 2020-03-03 11:24:16 -08:00
parent 5e5d66b6a4
commit 3cd7f3e3bd
7 changed files with 10895 additions and 10870 deletions

View File

@ -1,3 +1,9 @@
2020-03-03 H.J. Lu <hongjiu.lu@intel.com>
* config/tc-i386.c (match_template): Replace ignoresize and
defaultsize with mnemonicsize.
(process_suffix): Likewise.
2020-03-03 Sergey Belyashov <sergey.belyashov@gmail.com>
PR 25627

View File

@ -5876,7 +5876,7 @@ match_template (char mnem_suffix)
if (i.suffix == QWORD_MNEM_SUFFIX
&& flag_code != CODE_64BIT
&& (intel_syntax
? (!t->opcode_modifier.ignoresize
? (t->opcode_modifier.mnemonicsize != IGNORESIZE
&& !t->opcode_modifier.broadcast
&& !intel_float_operand (t->name))
: intel_float_operand (t->name) != 2)
@ -5892,7 +5892,7 @@ match_template (char mnem_suffix)
else if (i.suffix == LONG_MNEM_SUFFIX
&& !cpu_arch_flags.bitfield.cpui386
&& (intel_syntax
? (!t->opcode_modifier.ignoresize
? (t->opcode_modifier.mnemonicsize != IGNORESIZE
&& !intel_float_operand (t->name))
: intel_float_operand (t->name) != 2)
&& ((operand_types[0].bitfield.class != RegMMX
@ -6247,7 +6247,7 @@ match_template (char mnem_suffix)
as_warn (_("indirect %s without `*'"), t->name);
if (t->opcode_modifier.isprefix
&& t->opcode_modifier.ignoresize)
&& t->opcode_modifier.mnemonicsize == IGNORESIZE)
{
/* Warn them that a data or address size prefix doesn't
affect assembly of the next line of code. */
@ -6371,7 +6371,7 @@ process_suffix (void)
else if (i.suffix == BYTE_MNEM_SUFFIX)
{
if (intel_syntax
&& i.tm.opcode_modifier.ignoresize
&& i.tm.opcode_modifier.mnemonicsize == IGNORESIZE
&& i.tm.opcode_modifier.no_bsuf)
i.suffix = 0;
else if (!check_byte_reg ())
@ -6380,7 +6380,7 @@ process_suffix (void)
else if (i.suffix == LONG_MNEM_SUFFIX)
{
if (intel_syntax
&& i.tm.opcode_modifier.ignoresize
&& i.tm.opcode_modifier.mnemonicsize == IGNORESIZE
&& i.tm.opcode_modifier.no_lsuf
&& !i.tm.opcode_modifier.todword
&& !i.tm.opcode_modifier.toqword)
@ -6391,7 +6391,7 @@ process_suffix (void)
else if (i.suffix == QWORD_MNEM_SUFFIX)
{
if (intel_syntax
&& i.tm.opcode_modifier.ignoresize
&& i.tm.opcode_modifier.mnemonicsize == IGNORESIZE
&& i.tm.opcode_modifier.no_qsuf
&& !i.tm.opcode_modifier.todword
&& !i.tm.opcode_modifier.toqword)
@ -6402,13 +6402,14 @@ process_suffix (void)
else if (i.suffix == WORD_MNEM_SUFFIX)
{
if (intel_syntax
&& i.tm.opcode_modifier.ignoresize
&& i.tm.opcode_modifier.mnemonicsize == IGNORESIZE
&& i.tm.opcode_modifier.no_wsuf)
i.suffix = 0;
else if (!check_word_reg ())
return 0;
}
else if (intel_syntax && i.tm.opcode_modifier.ignoresize)
else if (intel_syntax
&& i.tm.opcode_modifier.mnemonicsize == IGNORESIZE)
/* Do nothing if the instruction is going to ignore the prefix. */
;
else
@ -6417,7 +6418,8 @@ process_suffix (void)
/* Undo the movsx/movzx change done above. */
i.operands = numop;
}
else if (i.tm.opcode_modifier.defaultsize && !i.suffix)
else if (i.tm.opcode_modifier.mnemonicsize == DEFAULTSIZE
&& !i.suffix)
{
i.suffix = stackop_size;
if (stackop_size == LONG_MNEM_SUFFIX)
@ -6466,12 +6468,12 @@ process_suffix (void)
}
if (!i.suffix
&& (!i.tm.opcode_modifier.defaultsize
&& (i.tm.opcode_modifier.mnemonicsize != DEFAULTSIZE
/* Also cover lret/retf/iret in 64-bit mode. */
|| (flag_code == CODE_64BIT
&& !i.tm.opcode_modifier.no_lsuf
&& !i.tm.opcode_modifier.no_qsuf))
&& !i.tm.opcode_modifier.ignoresize
&& i.tm.opcode_modifier.mnemonicsize != IGNORESIZE
/* Accept FLDENV et al without suffix. */
&& (i.tm.opcode_modifier.no_ssuf || i.tm.opcode_modifier.floatmf))
{
@ -6544,7 +6546,7 @@ process_suffix (void)
if (suffixes & (suffixes - 1))
{
if (intel_syntax
&& (!i.tm.opcode_modifier.defaultsize
&& (i.tm.opcode_modifier.mnemonicsize != DEFAULTSIZE
|| operand_check == check_error))
{
as_bad (_("ambiguous operand size for `%s'"), i.tm.name);
@ -6638,7 +6640,7 @@ process_suffix (void)
size prefix, except for instructions that will ignore this
prefix anyway. */
if (i.suffix != QWORD_MNEM_SUFFIX
&& !i.tm.opcode_modifier.ignoresize
&& i.tm.opcode_modifier.mnemonicsize != IGNORESIZE
&& !i.tm.opcode_modifier.floatmf
&& !is_any_vex_encoding (&i.tm)
&& ((i.suffix == LONG_MNEM_SUFFIX) == (flag_code == CODE_16BIT)

View File

@ -1,3 +1,18 @@
2020-03-03 H.J. Lu <hongjiu.lu@intel.com>
* i386-gen.c (opcode_modifiers): Replace IgnoreSize/DefaultSize
with MnemonicSize.
* i386-opc.h (IGNORESIZE): New.
(DEFAULTSIZE): Likewise.
(IgnoreSize): Removed.
(DefaultSize): Likewise.
(MnemonicSize): New.
(i386_opcode_modifier): Replace ignoresize/defaultsize with
mnemonicsize.
* i386-opc.tbl (IgnoreSize): New.
(DefaultSize): Likewise.
* i386-tbl.h: Regenerated.
2020-03-03 Sergey Belyashov <sergey.belyashov@gmail.com>
PR 25627

View File

@ -622,8 +622,7 @@ static bitfield opcode_modifiers[] =
BITFIELD (FloatR),
BITFIELD (Size),
BITFIELD (CheckRegSize),
BITFIELD (IgnoreSize),
BITFIELD (DefaultSize),
BITFIELD (MnemonicSize),
BITFIELD (Anysize),
BITFIELD (No_bSuf),
BITFIELD (No_wSuf),

View File

@ -427,9 +427,10 @@ enum
CheckRegSize,
/* instruction ignores operand size prefix and in Intel mode ignores
mnemonic size suffix check. */
IgnoreSize,
#define IGNORESIZE 1
/* default insn size depends on mode */
DefaultSize,
#define DEFAULTSIZE 2
MnemonicSize,
/* any memory size */
Anysize,
/* b suffix on instruction illegal */
@ -661,8 +662,7 @@ typedef struct i386_opcode_modifier
unsigned int floatr:1;
unsigned int size:2;
unsigned int checkregsize:1;
unsigned int ignoresize:1;
unsigned int defaultsize:1;
unsigned int mnemonicsize:2;
unsigned int anysize:1;
unsigned int no_bsuf:1;
unsigned int no_wsuf:1;

View File

@ -66,6 +66,9 @@
#define Size32 Size=SIZE32
#define Size64 Size=SIZE64
#define IgnoreSize MnemonicSize=IGNORESIZE
#define DefaultSize MnemonicSize=DEFAULTSIZE
// RegMem implies a ModR/M byte
#define RegMem Modrm|RegMem

File diff suppressed because it is too large Load Diff