x86: undo Prefix_0X<nn> use in opcode table
The table entries are more natural to read (and slightly shorter) when the prefixes, like is the case for VEX/XOP/EVEX-encoded entries, are specified as part of the opcode. This is particularly noticable for side-by-side legacy and SSE2AVX entries. An implication is that we now need to use "unsigned long long" for the initially parsed opcode in i386-gen. I don't expect this to be an issue.
This commit is contained in:
parent
9df6f676c2
commit
73e45eb208
3 changed files with 383 additions and 375 deletions
|
@ -1,3 +1,11 @@
|
|||
2021-03-29 Jan Beulich <jbeulich@suse.com>
|
||||
|
||||
* i386-gen.c (output_i386_opcode): Widen type of "opcode". Use
|
||||
strtoull(). Bump upper loop bound. Widen masks. Sanity check
|
||||
"length".
|
||||
* i386-opc.tbl (Prefix_0X66, Prefix_0XF2, Prefix_0XF3): Delete.
|
||||
Convert all of their uses to representation in opcode.
|
||||
|
||||
2021-03-29 Jan Beulich <jbeulich@suse.com>
|
||||
|
||||
* i386-opc.h (struct insn_template): Shrink base_opcode to 16
|
||||
|
|
|
@ -1371,7 +1371,7 @@ output_i386_opcode (FILE *table, const char *name, char *str,
|
|||
unsigned int i, length, prefix = 0, space = 0;
|
||||
char *base_opcode, *extension_opcode, *end;
|
||||
char *cpu_flags, *opcode_modifier, *operand_types [MAX_OPERANDS];
|
||||
unsigned long int opcode;
|
||||
unsigned long long opcode;
|
||||
|
||||
/* Find base_opcode. */
|
||||
base_opcode = next_field (str, ',', &str, last);
|
||||
|
@ -1418,10 +1418,10 @@ output_i386_opcode (FILE *table, const char *name, char *str,
|
|||
}
|
||||
}
|
||||
|
||||
opcode = strtoul (base_opcode, &end, 0);
|
||||
opcode = strtoull (base_opcode, &end, 0);
|
||||
|
||||
/* Determine opcode length. */
|
||||
for (length = 1; length < 4; ++length)
|
||||
for (length = 1; length < 8; ++length)
|
||||
if (!(opcode >> (8 * length)))
|
||||
break;
|
||||
|
||||
|
@ -1437,7 +1437,7 @@ output_i386_opcode (FILE *table, const char *name, char *str,
|
|||
}
|
||||
|
||||
if (prefix)
|
||||
opcode &= (1UL << (8 * --length)) - 1;
|
||||
opcode &= (1ULL << (8 * --length)) - 1;
|
||||
}
|
||||
|
||||
/* Transform opcode space encoded in the opcode into opcode modifier
|
||||
|
@ -1454,10 +1454,14 @@ output_i386_opcode (FILE *table, const char *name, char *str,
|
|||
if (space != SPACE_0F && --length == 1)
|
||||
fail (_("%s:%d: %s: unrecognized opcode encoding space\n"),
|
||||
filename, lineno, name);
|
||||
opcode &= (1UL << (8 * --length)) - 1;
|
||||
opcode &= (1ULL << (8 * --length)) - 1;
|
||||
}
|
||||
|
||||
fprintf (table, " { \"%s\", 0x%0*lx%s, %s, %lu,\n",
|
||||
if (length > 2)
|
||||
fail (_("%s:%d: %s: residual opcode (0x%0*llx) too large\n"),
|
||||
filename, lineno, name, 2 * length, opcode);
|
||||
|
||||
fprintf (table, " { \"%s\", 0x%0*llx%s, %s, %lu,\n",
|
||||
name, 2 * (int)length, opcode, end, extension_opcode, i);
|
||||
|
||||
process_i386_opcode_modifier (table, opcode_modifier, space, prefix,
|
||||
|
|
File diff suppressed because it is too large
Load diff
Loading…
Add table
Reference in a new issue