Skip to content

Commit

Permalink
x86: re-work insn/suffix recognition
Browse files Browse the repository at this point in the history
Having templates with a suffix explicitly present has always been
quirky. Introduce a 2nd matching pass in case the 1st one couldn't find
a suitable template _and_ didn't itself already need to trim off a
suffix to find a match at all. This requires error reporting adjustments
(albeit luckily fewer than I was afraid might be necessary), as errors
previously reported during matching now need deferring until after the
2nd pass (because, obviously, we must not emit any error if the 2nd pass
succeeds). While also related to PR gas/29524, it was requested that
move-with-sign-extend be left as broken as it always was.

PR gas/29525
Note that with the dropped CMPSD and MOVSD Intel Syntax string insn
templates taking operands, mixed IsString/non-IsString template groups
(with memory operands) cannot occur anymore. With that
maybe_adjust_templates() becomes unnecessary (and is hence being
removed).

PR gas/29526
Note further that while the additions to the intel16 testcase aren't
really proper Intel syntax, we've been permitting all of those except
for the MOVD variant. The test therefore is to avoid re-introducing such
an inconsistency.
  • Loading branch information
jbeulich authored and ouuleilei-bot committed Nov 4, 2022
1 parent 9155921 commit 9cc2165
Show file tree
Hide file tree
Showing 8 changed files with 199 additions and 178 deletions.
11 changes: 1 addition & 10 deletions gas/config/tc-i386-intel.c
Original file line number Diff line number Diff line change
Expand Up @@ -993,10 +993,7 @@ i386_intel_operand (char *operand_string, int got_a_float)
|| intel_state.is_mem)
{
/* Memory operand. */
if (i.mem_operands == 1 && !maybe_adjust_templates ())
return 0;
if ((int) i.mem_operands
>= 2 - !current_templates->start->opcode_modifier.isstring)
if (i.mem_operands)
{
/* Handle
Expand Down Expand Up @@ -1041,10 +1038,6 @@ i386_intel_operand (char *operand_string, int got_a_float)
}
}
}

as_bad (_("too many memory references for `%s'"),
current_templates->start->name);
return 0;
}

/* Swap base and index in 16-bit memory operands like
Expand Down Expand Up @@ -1158,8 +1151,6 @@ i386_intel_operand (char *operand_string, int got_a_float)
return 0;

i.flags[this_operand] |= Operand_Mem;
if (i.mem_operands == 0)
i.memop1_string = xstrdup (operand_string);
++i.mem_operands;
}
else
Expand Down
Loading

0 comments on commit 9cc2165

Please sign in to comment.