summaryrefslogtreecommitdiff
path: root/opcodes/i386-gen.c
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2016-05-27 08:02:56 -0700
committerH.J. Lu <hjl.tools@gmail.com>2016-05-27 08:03:17 -0700
commite92bae62606702c1c07e095789ffed103e0e34c5 (patch)
tree65b78ae2185c0c62cb24468da9fb8740a931bf6e /opcodes/i386-gen.c
parentc185ba27ca74b02bcca8d016e2d82b09aa6df28b (diff)
downloadbinutils-gdb-e92bae62606702c1c07e095789ffed103e0e34c5.tar.gz
Replace CpuAMD64/CpuIntel64 with AMD64/Intel64
AMD64 vs CpuIntel64 ISA should be handled similar as AT&T vs Intel syntax. Since cpu_flags isn't sorted by position, we need to check the whole cpu_flags array for the maximum position when verifying CpuMax. gas/ PR gas/20154 * config/tc-i386.c (cpu_flags_match): Don't set cpuamd64 nor cpuintel64. (match_template): Check Intel64/AMD64 ISA. opcodes/ PR gas/20154 * i386-gen.c (cpu_flags): Remove CpuAMD64 and CpuIntel64. (opcode_modifiers): Add AMD64 and Intel64. (main): Properly verify CpuMax. * i386-opc.h (CpuAMD64): Removed. (CpuIntel64): Likewise. (CpuMax): Set to CpuNo64. (i386_cpu_flags): Remove cpuamd64 and cpuintel64. (AMD64): New. (Intel64): Likewise. (i386_opcode_modifier): Add amd64 and intel64. (i386-opc.tbl): Replace CpuAMD64/CpuIntel64 with AMD64/Intel64 on call and jmp. * i386-init.h: Regenerated. * i386-tbl.h: Likewise.
Diffstat (limited to 'opcodes/i386-gen.c')
-rw-r--r--opcodes/i386-gen.c22
1 files changed, 13 insertions, 9 deletions
diff --git a/opcodes/i386-gen.c b/opcodes/i386-gen.c
index 0afdc90c716..a935024d9d8 100644
--- a/opcodes/i386-gen.c
+++ b/opcodes/i386-gen.c
@@ -469,8 +469,6 @@ static bitfield cpu_flags[] =
BITFIELD (CpuCLZERO),
BITFIELD (CpuOSPKE),
BITFIELD (CpuRDPID),
- BITFIELD (CpuAMD64),
- BITFIELD (CpuIntel64),
#ifdef CpuUnused
BITFIELD (CpuUnused),
#endif
@@ -540,6 +538,8 @@ static bitfield opcode_modifiers[] =
BITFIELD (ATTMnemonic),
BITFIELD (ATTSyntax),
BITFIELD (IntelSyntax),
+ BITFIELD (AMD64),
+ BITFIELD (Intel64),
};
static bitfield operand_types[] =
@@ -1344,6 +1344,7 @@ main (int argc, char **argv)
extern int chdir (char *);
char *srcdir = NULL;
int c;
+ unsigned int i, cpumax;
FILE *table;
program_name = *argv;
@@ -1378,16 +1379,19 @@ main (int argc, char **argv)
fail (_("unable to change directory to \"%s\", errno = %s\n"),
srcdir, xstrerror (errno));
+ /* cpu_flags isn't sorted by position. */
+ cpumax = 0;
+ for (i = 0; i < ARRAY_SIZE (cpu_flags); i++)
+ if (cpu_flags[i].position > cpumax)
+ cpumax = cpu_flags[i].position;
+
/* Check the unused bitfield in i386_cpu_flags. */
#ifdef CpuUnused
- if (cpu_flags[ARRAY_SIZE (cpu_flags) - 2].position != CpuMax)
- fail (_("CpuMax != %d!\n"),
- cpu_flags[ARRAY_SIZE (cpu_flags) - 2].position);
-
+ if ((cpumax - 1) != CpuMax)
+ fail (_("CpuMax != %d!\n"), cpumax);
#else
- if (cpu_flags[ARRAY_SIZE (cpu_flags) - 1].position != CpuMax)
- fail (_("CpuMax != %d!\n"),
- cpu_flags[ARRAY_SIZE (cpu_flags) - 1].position);
+ if (cpumax != CpuMax)
+ fail (_("CpuMax != %d!\n"), cpumax);
c = CpuNumOfBits - CpuMax - 1;
if (c)