aboutsummaryrefslogtreecommitdiff
path: root/gas
diff options
context:
space:
mode:
authorJan Beulich <jbeulich@suse.com>2019-11-12 09:09:31 +0100
committerJan Beulich <jbeulich@suse.com>2019-11-12 09:09:31 +0100
commit51c8edf68bf1e16c6d05fbb31a36e0cc436a9750 (patch)
treeca465dc8565167792ae44eb3f95b338720c813e0 /gas
parent474da251bf92a11a08583080af77fa197570767f (diff)
downloadgdb-51c8edf68bf1e16c6d05fbb31a36e0cc436a9750.zip
gdb-51c8edf68bf1e16c6d05fbb31a36e0cc436a9750.tar.gz
gdb-51c8edf68bf1e16c6d05fbb31a36e0cc436a9750.tar.bz2
x86: fold EsSeg into IsString
EsSeg (a per-operand bit) is used with IsString (a per-insn attribute) only. Extend the attribute to 2 bits, thus allowing to encode - not a string insn, - string insn with neither operand requiring use of %es:, - string insn with 1st operand requiring use of %es:, - string insn with 2nd operand requiring use of %es:, which covers all possible cases, allowing to drop EsSeg. The (transient) need to comment out the OTUnused #define did uncover an oversight in the earlier OTMax -> OTNum conversion, which is being taken care of here.
Diffstat (limited to 'gas')
-rw-r--r--gas/ChangeLog8
-rw-r--r--gas/config/tc-i386.c57
2 files changed, 31 insertions, 34 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog
index 65e327d..223ea8d 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,5 +1,13 @@
2019-11-12 Jan Beulich <jbeulich@suse.com>
+ * config/tc-i386.c (type_names): Remove OPERAND_TYPE_ESSEG
+ entry.
+ (md_assemble): Adjust isstring field use. Add assertion.
+ (check_string): Mostly re-write.
+ (i386_index_check): Adjust isstring field use and related code.
+
+2019-11-12 Jan Beulich <jbeulich@suse.com>
+
* config/tc-i386.c (process_immext): Remove SSE3, SVME, and
MWAITX special case logic.
(process_suffix): Replace immext field uses by instance ones.
diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c
index f3e77d7..c559041 100644
--- a/gas/config/tc-i386.c
+++ b/gas/config/tc-i386.c
@@ -3161,7 +3161,6 @@ const type_names[] =
{ OPERAND_TYPE_REGYMM, "rYMM" },
{ OPERAND_TYPE_REGZMM, "rZMM" },
{ OPERAND_TYPE_REGMASK, "Mask reg" },
- { OPERAND_TYPE_ESSEG, "es" },
};
static void
@@ -4386,8 +4385,9 @@ md_assemble (char *line)
}
/* Check string instruction segment overrides. */
- if (i.tm.opcode_modifier.isstring && i.mem_operands != 0)
+ if (i.tm.opcode_modifier.isstring >= IS_STRING_ES_OP0)
{
+ gas_assert (i.mem_operands);
if (!check_string ())
return;
i.disp_operands = 0;
@@ -6168,35 +6168,24 @@ check_reverse:
static int
check_string (void)
{
- unsigned int mem_op = i.flags[0] & Operand_Mem ? 0 : 1;
+ unsigned int es_op = i.tm.opcode_modifier.isstring - IS_STRING_ES_OP0;
+ unsigned int op = i.tm.operand_types[0].bitfield.baseindex ? es_op : 0;
- if (i.tm.operand_types[mem_op].bitfield.esseg)
+ if (i.seg[op] != NULL && i.seg[op] != &es)
{
- if (i.seg[0] != NULL && i.seg[0] != &es)
- {
- as_bad (_("`%s' operand %d must use `%ses' segment"),
- i.tm.name,
- intel_syntax ? i.tm.operands - mem_op : mem_op + 1,
- register_prefix);
- return 0;
- }
- /* There's only ever one segment override allowed per instruction.
- This instruction possibly has a legal segment override on the
- second operand, so copy the segment to where non-string
- instructions store it, allowing common code. */
- i.seg[0] = i.seg[1];
- }
- else if (i.tm.operand_types[mem_op + 1].bitfield.esseg)
- {
- if (i.seg[1] != NULL && i.seg[1] != &es)
- {
- as_bad (_("`%s' operand %d must use `%ses' segment"),
- i.tm.name,
- intel_syntax ? i.tm.operands - mem_op - 1 : mem_op + 2,
- register_prefix);
- return 0;
- }
+ as_bad (_("`%s' operand %u must use `%ses' segment"),
+ i.tm.name,
+ intel_syntax ? i.tm.operands - es_op : es_op + 1,
+ register_prefix);
+ return 0;
}
+
+ /* There's only ever one segment override allowed per instruction.
+ This instruction possibly has a legal segment override on the
+ second operand, so copy the segment to where non-string
+ instructions store it, allowing common code. */
+ i.seg[op] = i.seg[1];
+
return 1;
}
@@ -9780,16 +9769,16 @@ i386_index_check (const char *operand_string)
if (current_templates->start->opcode_modifier.repprefixok)
{
- i386_operand_type type = current_templates->end[-1].operand_types[0];
+ int es_op = current_templates->end[-1].opcode_modifier.isstring
+ - IS_STRING_ES_OP0;
+ int op = 0;
- if (!type.bitfield.baseindex
+ if (!current_templates->end[-1].operand_types[0].bitfield.baseindex
|| ((!i.mem_operands != !intel_syntax)
&& current_templates->end[-1].operand_types[1]
.bitfield.baseindex))
- type = current_templates->end[-1].operand_types[1];
- expected_reg = hash_find (reg_hash,
- di_si[addr_mode][type.bitfield.esseg]);
-
+ op = 1;
+ expected_reg = hash_find (reg_hash, di_si[addr_mode][op == es_op]);
}
else
expected_reg = hash_find (reg_hash, bx[addr_mode]);