x86: Rename VexOpcode to OpcodePrefix

Rename VexOpcode to OpcodePrefix so that OpcodePrefix can be used for
regular encoding prefix.

gas/

	* config/tc-i386.c (build_vex_prefix): Replace vexopcode with
	opcodeprefix.
	(build_evex_prefix): Likewise.
	(is_any_vex_encoding): Don't check vexopcode.
	(output_insn): Handle opcodeprefix.

opcodes/

	* i386-gen.c (opcode_modifiers): Replace VexOpcode with
	OpcodePrefix.
	* i386-opc.h (VexOpcode): Renamed to ...
	(OpcodePrefix): This.
	(PREFIX_NONE): New.
	(PREFIX_0X66): Likewise.
	(PREFIX_0XF2): Likewise.
	(PREFIX_0XF3): Likewise.
	* i386-opc.tbl (Prefix_0X66): New.
	(Prefix_0XF2): Likewise.
	(Prefix_0XF3): Likewise.
	Replace VexOpcode= with OpcodePrefix=.  Use Prefix_0X66 on xorpd.
	Use Prefix_0XF3 on cvtdq2pd.  Use Prefix_0XF2 on cvtpd2dq.
	* i386-tbl.h: Regenerated.
This commit is contained in:
H.J. Lu 2020-10-13 19:28:58 -07:00
parent 6248f5e4fc
commit 7b47a31256
7 changed files with 2156 additions and 2102 deletions

View File

@ -1,3 +1,11 @@
2020-10-13 H.J. Lu <hongjiu.lu@intel.com>
* config/tc-i386.c (build_vex_prefix): Replace vexopcode with
opcodeprefix.
(build_evex_prefix): Likewise.
(is_any_vex_encoding): Don't check vexopcode.
(output_insn): Handle opcodeprefix.
2020-10-09 H.J. Lu <hongjiu.lu@intel.com>
PR gas/26703

View File

@ -3588,7 +3588,7 @@ build_vex_prefix (const insn_template *t)
&& i.dir_encoding == dir_encoding_default
&& i.operands == i.reg_operands
&& operand_type_equal (&i.types[0], &i.types[i.operands - 1])
&& i.tm.opcode_modifier.vexopcode == VEX0F
&& i.tm.opcode_modifier.opcodeprefix == VEX0F
&& (i.tm.opcode_modifier.load || i.tm.opcode_modifier.d)
&& i.rex == REX_B)
{
@ -3633,7 +3633,7 @@ build_vex_prefix (const insn_template *t)
union i386_op temp_op;
i386_operand_type temp_type;
gas_assert (i.tm.opcode_modifier.vexopcode == VEX0F);
gas_assert (i.tm.opcode_modifier.opcodeprefix == VEX0F);
gas_assert (!i.tm.opcode_modifier.sae);
gas_assert (operand_type_equal (&i.types[i.operands - 2],
&i.types[i.operands - 3]));
@ -3704,7 +3704,7 @@ build_vex_prefix (const insn_template *t)
/* Use 2-byte VEX prefix if possible. */
if (w == 0
&& i.vec_encoding != vex_encoding_vex3
&& i.tm.opcode_modifier.vexopcode == VEX0F
&& i.tm.opcode_modifier.opcodeprefix == VEX0F
&& (i.rex & (REX_W | REX_X | REX_B)) == 0)
{
/* 2-byte VEX prefix. */
@ -3727,7 +3727,7 @@ build_vex_prefix (const insn_template *t)
i.vex.length = 3;
switch (i.tm.opcode_modifier.vexopcode)
switch (i.tm.opcode_modifier.opcodeprefix)
{
case VEX0F:
m = 0x1;
@ -3779,8 +3779,7 @@ is_evex_encoding (const insn_template *t)
static INLINE bfd_boolean
is_any_vex_encoding (const insn_template *t)
{
return t->opcode_modifier.vex || t->opcode_modifier.vexopcode
|| is_evex_encoding (t);
return t->opcode_modifier.vex || is_evex_encoding (t);
}
/* Build the EVEX prefix. */
@ -3842,7 +3841,7 @@ build_evex_prefix (void)
i.vex.bytes[0] = 0x62;
/* mmmm bits. */
switch (i.tm.opcode_modifier.vexopcode)
switch (i.tm.opcode_modifier.opcodeprefix)
{
case VEX0F:
m = 1;
@ -4403,7 +4402,7 @@ load_insn_p (void)
/* vldmxcsr. */
if (i.tm.base_opcode == 0xae
&& i.tm.opcode_modifier.vex
&& i.tm.opcode_modifier.vexopcode == VEX0F
&& i.tm.opcode_modifier.opcodeprefix == VEX0F
&& i.tm.extension_opcode == 2)
return 1;
}
@ -9374,33 +9373,49 @@ output_insn (void)
don't need the explicit prefix. */
if (!i.tm.opcode_modifier.vex && !i.tm.opcode_modifier.evex)
{
switch (i.tm.opcode_length)
switch (i.tm.opcode_modifier.opcodeprefix)
{
case 3:
if (i.tm.base_opcode & 0xff000000)
case PREFIX_0X66:
add_prefix (0x66);
break;
case PREFIX_0XF2:
add_prefix (0xf2);
break;
case PREFIX_0XF3:
add_prefix (0xf3);
break;
case PREFIX_NONE:
switch (i.tm.opcode_length)
{
prefix = (i.tm.base_opcode >> 24) & 0xff;
if (!i.tm.cpu_flags.bitfield.cpupadlock
|| prefix != REPE_PREFIX_OPCODE
|| (i.prefix[REP_PREFIX] != REPE_PREFIX_OPCODE))
add_prefix (prefix);
case 3:
if (i.tm.base_opcode & 0xff000000)
{
prefix = (i.tm.base_opcode >> 24) & 0xff;
if (!i.tm.cpu_flags.bitfield.cpupadlock
|| prefix != REPE_PREFIX_OPCODE
|| (i.prefix[REP_PREFIX] != REPE_PREFIX_OPCODE))
add_prefix (prefix);
}
break;
case 2:
if ((i.tm.base_opcode & 0xff0000) != 0)
{
prefix = (i.tm.base_opcode >> 16) & 0xff;
add_prefix (prefix);
}
break;
case 1:
break;
case 0:
/* Check for pseudo prefixes. */
as_bad_where (insn_start_frag->fr_file,
insn_start_frag->fr_line,
_("pseudo prefix without instruction"));
return;
default:
abort ();
}
break;
case 2:
if ((i.tm.base_opcode & 0xff0000) != 0)
{
prefix = (i.tm.base_opcode >> 16) & 0xff;
add_prefix (prefix);
}
break;
case 1:
break;
case 0:
/* Check for pseudo prefixes. */
as_bad_where (insn_start_frag->fr_file,
insn_start_frag->fr_line,
_("pseudo prefix without instruction"));
return;
default:
abort ();
}

View File

@ -1,3 +1,20 @@
2020-10-13 H.J. Lu <hongjiu.lu@intel.com>
* i386-gen.c (opcode_modifiers): Replace VexOpcode with
OpcodePrefix.
* i386-opc.h (VexOpcode): Renamed to ...
(OpcodePrefix): This.
(PREFIX_NONE): New.
(PREFIX_0X66): Likewise.
(PREFIX_0XF2): Likewise.
(PREFIX_0XF3): Likewise.
* i386-opc.tbl (Prefix_0X66): New.
(Prefix_0XF2): Likewise.
(Prefix_0XF3): Likewise.
Replace VexOpcode= with OpcodePrefix=. Use Prefix_0X66 on xorpd.
Use Prefix_0XF3 on cvtdq2pd. Use Prefix_0XF2 on cvtpd2dq.
* i386-tbl.h: Regenerated.
2020-10-05 Samanta Navarro <ferivoz@riseup.net>
* cgen-asm.c: Fix spelling mistakes.

View File

@ -695,7 +695,7 @@ static bitfield opcode_modifiers[] =
BITFIELD (Vex),
BITFIELD (VexVVVV),
BITFIELD (VexW),
BITFIELD (VexOpcode),
BITFIELD (OpcodePrefix),
BITFIELD (VexSources),
BITFIELD (SIB),
BITFIELD (SSE2AVX),

View File

@ -561,6 +561,16 @@ enum
#define VEXW1 2
#define VEXWIG 3
VexW,
/* Regular opcode prefix:
0: None
1: Add 0x66 opcode prefix.
2: Add 0xf2 opcode prefix.
3: Add 0xf3 opcode prefix.
*/
#define PREFIX_NONE 0
#define PREFIX_0X66 1
#define PREFIX_0XF2 2
#define PREFIX_0XF3 3
/* VEX opcode prefix:
0: VEX 0x0F opcode prefix.
1: VEX 0x0F38 opcode prefix.
@ -575,7 +585,7 @@ enum
#define XOP08 3
#define XOP09 4
#define XOP0A 5
VexOpcode,
OpcodePrefix,
/* number of VEX source operands:
0: <= 2 source operands.
1: 2 XOP source operands.
@ -720,7 +730,7 @@ typedef struct i386_opcode_modifier
unsigned int vex:2;
unsigned int vexvvvv:2;
unsigned int vexw:2;
unsigned int vexopcode:3;
unsigned int opcodeprefix:3;
unsigned int vexsources:2;
unsigned int sib:3;
unsigned int sse2avx:1;

File diff suppressed because it is too large Load Diff

View File

@ -15526,7 +15526,7 @@ const insn_template i386_optab[] =
0, 1, 0, 0, 0, 1, 0 } },
{ { 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 1, 0, 0, 0, 0, 0 } } } },
{ "xorpd", 0x660f57, None, 2, 2,
{ "xorpd", 0xf57, None, 2, 2,
{ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
@ -15534,7 +15534,7 @@ const insn_template i386_optab[] =
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } },
{ 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
{ { { 7, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 1, 0, 0, 0, 0, 0,
0, 1, 0, 0, 0, 1, 0 } },
@ -15554,7 +15554,7 @@ const insn_template i386_optab[] =
0, 1, 0, 0, 0, 1, 0 } },
{ { 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 1, 0, 0, 0, 0, 0 } } } },
{ "cvtdq2pd", 0xf30fe6, None, 2, 2,
{ "cvtdq2pd", 0xfe6, None, 2, 2,
{ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
@ -15562,7 +15562,7 @@ const insn_template i386_optab[] =
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,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