diff options
Diffstat (limited to 'gas/config/tc-i386.c')
-rw-r--r-- | gas/config/tc-i386.c | 61 |
1 files changed, 33 insertions, 28 deletions
diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c index 9da95c3..d169274 100644 --- a/gas/config/tc-i386.c +++ b/gas/config/tc-i386.c @@ -12922,13 +12922,43 @@ s_insn (int dummy ATTRIBUTE_UNUSED) } } + /* Parse operands, if any, before evaluating encoding space. */ + if (*line == ',') + { + i.memshift = -1; + + ptr = parse_operands (line + 1, &i386_mnemonics[MN__insn]); + this_operand = -1; + if (!ptr) + goto bad; + line = ptr; + + if (!i.operands) + { + as_bad (_("expecting operand after ','; got nothing")); + goto done; + } + + if (i.mem_operands > 1) + { + as_bad (_("too many memory references for `%s'"), + &i386_mnemonics[MN__insn]); + goto done; + } + + /* No need to distinguish encoding_evex and encoding_evex512. */ + if (i.encoding == encoding_evex512) + i.encoding = encoding_evex; + } + /* Trim off encoding space. */ if (j > 1 && !i.insn_opcode_space && (val >> ((j - 1) * 8)) == 0x0f) { uint8_t byte = val >> ((--j - 1) * 8); i.insn_opcode_space = SPACE_0F; - switch (byte & -(j > 1)) + switch (byte & -(j > 1 && !i.rex2_encoding + && (i.encoding != encoding_egpr || evex))) { case 0x38: i.insn_opcode_space = SPACE_0F38; @@ -12951,42 +12981,17 @@ s_insn (int dummy ATTRIBUTE_UNUSED) if (j > 2) { as_bad (_("opcode residual (%#"PRIx64") too wide"), (uint64_t) val); - goto bad; + goto done; } i.opcode_length = j; /* Handle operands, if any. */ - if (*line == ',') + if (i.operands) { i386_operand_type combined; expressionS *disp_exp = NULL; bool changed; - i.memshift = -1; - - ptr = parse_operands (line + 1, &i386_mnemonics[MN__insn]); - this_operand = -1; - if (!ptr) - goto bad; - line = ptr; - - if (!i.operands) - { - as_bad (_("expecting operand after ','; got nothing")); - goto done; - } - - if (i.mem_operands > 1) - { - as_bad (_("too many memory references for `%s'"), - &i386_mnemonics[MN__insn]); - goto done; - } - - /* No need to distinguish encoding_evex and encoding_evex512. */ - if (i.encoding == encoding_evex512) - i.encoding = encoding_evex; - if (i.encoding == encoding_egpr) { if (vex || xop) |