From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alan Modra To: hjl@lucon.org (H.J. Lu) Subject: A gas patch Date: Mon, 16 Mar 1998 08:08:00 -0000 Message-id: <199803161150.WAA00761@mullet.Levels.UniSA.Edu.Au> X-SW-Source: 1998/msg00060.html Here is a patch you might like to include in your next release of binutils for linux. I've sent it off to Ian Taylor, but he's on vacation for another week, so it may not get into the official sources for a while. 1998-03-15 Alan Modra * config/tc-i386.c (md_assemble): Add no_word_prefix_needed variable and don't emit a data-size prefix byte for segment register or control/debug register moves. Check for incorrect suffix on these instructions too. diff -ur gas-980310/gas/config/tc-i386.c gas/gas/config/tc-i386.c --- gas-980310/gas/config/tc-i386.c Tue Mar 3 19:40:21 1998 +++ gas/gas/config/tc-i386.c Sun Mar 15 15:47:46 1998 @@ -1093,6 +1093,7 @@ expressionS *exp; unsigned int overlap2; unsigned int found_reverse_match; + int no_word_prefix_needed = 0; overlap0 = overlap1 = overlap2 = found_reverse_match = 0; for (t = current_templates->start; @@ -1276,6 +1277,22 @@ if (overlap0 & Imm1) i.imm_operands = 0; /* kludge for shift insns */ + if (t->operand_types[0] & (SReg3|SReg2|Control|Debug|Test)) + { + no_word_prefix_needed = 1; + if (i.suffix) + { + if ((i.suffix != WORD_OPCODE_SUFFIX + && (t->operand_types[0] & (SReg3|SReg2))) + || (i.suffix != DWORD_OPCODE_SUFFIX + && (t->operand_types[0] & (Control|Debug|Test)))) + { + as_bad ("register does not match opcode suffix"); + return; + } + } + } + if (found_reverse_match) { unsigned int save; @@ -1301,7 +1318,8 @@ t->base_opcode |= W; /* Now select between word & dword operations via the operand size prefix. */ - if ((i.suffix == WORD_OPCODE_SUFFIX) ^ flag_16bit_code) + if ((i.suffix == WORD_OPCODE_SUFFIX) != flag_16bit_code + && !no_word_prefix_needed) { if (i.prefixes == MAX_PREFIXES) { -- H.J. Lu (hjl@gnu.org)