diff options
author | H.J. Lu <hjl.tools@gmail.com> | 2007-09-26 04:42:47 +0000 |
---|---|---|
committer | H.J. Lu <hjl.tools@gmail.com> | 2007-09-26 04:42:47 +0000 |
commit | 4dffcebc10670489b064181a62e9588e72fb566a (patch) | |
tree | 5afda928aebbd6b85b99edaa635d72b92c598f01 /gas/config | |
parent | c828a49faf94e9b2cba6d2870a5bfeaef2da5a3f (diff) | |
download | gdb-4dffcebc10670489b064181a62e9588e72fb566a.zip gdb-4dffcebc10670489b064181a62e9588e72fb566a.tar.gz gdb-4dffcebc10670489b064181a62e9588e72fb566a.tar.bz2 |
gas/
2007-09-25 H.J. Lu <hongjiu.lu@intel.com>
* config/tc-i386.c (output_insn): Use i.tm.opcode_length to
check opcode length.
opcodes/
2007-09-25 H.J. Lu <hongjiu.lu@intel.com>
* i386-gen.c (process_i386_opcodes): Process opcode_length.
* i386-opc.h (template): Add opcode_length.
* 386-opc.tbl: Likewise.
* i386-tbl.h: Regenerated.
Diffstat (limited to 'gas/config')
-rw-r--r-- | gas/config/tc-i386.c | 57 |
1 files changed, 30 insertions, 27 deletions
diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c index 7192c66..8664619 100644 --- a/gas/config/tc-i386.c +++ b/gas/config/tc-i386.c @@ -4976,38 +4976,35 @@ output_insn (void) char *p; unsigned char *q; unsigned int prefix; - int opc_3b; - - /* All opcodes on i386 have either 1 or 2 bytes. SSSE3 and - SSE4 and SSE5 instructions have 3 bytes. We may use one - more higher byte to specify a prefix the instruction - requires. Exclude instructions which are in both SSE4.2 - and ABM. */ - opc_3b = (i.tm.cpu_flags.bitfield.cpussse3 - || i.tm.cpu_flags.bitfield.cpusse5 - || i.tm.cpu_flags.bitfield.cpusse4_1 - || (i.tm.cpu_flags.bitfield.cpusse4_2 - && !i.tm.cpu_flags.bitfield.cpuabm)); - if (opc_3b) + + switch (i.tm.opcode_length) { + case 3: if (i.tm.base_opcode & 0xff000000) { prefix = (i.tm.base_opcode >> 24) & 0xff; goto check_prefix; } - } - else if ((i.tm.base_opcode & 0xff0000) != 0) - { - prefix = (i.tm.base_opcode >> 16) & 0xff; - if (i.tm.cpu_flags.bitfield.cpupadlock) + break; + case 2: + if ((i.tm.base_opcode & 0xff0000) != 0) { - check_prefix: - if (prefix != REPE_PREFIX_OPCODE - || i.prefix[LOCKREP_PREFIX] != REPE_PREFIX_OPCODE) + prefix = (i.tm.base_opcode >> 16) & 0xff; + if (i.tm.cpu_flags.bitfield.cpupadlock) + { +check_prefix: + if (prefix != REPE_PREFIX_OPCODE + || i.prefix[LOCKREP_PREFIX] != REPE_PREFIX_OPCODE) + add_prefix (prefix); + } + else add_prefix (prefix); } - else - add_prefix (prefix); + break; + case 1: + break; + default: + abort (); } /* The prefix bytes. */ @@ -5023,19 +5020,25 @@ output_insn (void) } /* Now the opcode; be careful about word order here! */ - if (fits_in_unsigned_byte (i.tm.base_opcode)) + if (i.tm.opcode_length == 1) { FRAG_APPEND_1_CHAR (i.tm.base_opcode); } else { - if (opc_3b) + switch (i.tm.opcode_length) { + case 3: p = frag_more (3); *p++ = (i.tm.base_opcode >> 16) & 0xff; + break; + case 2: + p = frag_more (2); + break; + default: + abort (); + break; } - else - p = frag_more (2); /* Put out high byte first: can't use md_number_to_chars! */ *p++ = (i.tm.base_opcode >> 8) & 0xff; |