From 68328dc6bdb8a3ed4bb6cb2e6183af85995aa30b Mon Sep 17 00:00:00 2001 From: Jeff Law Date: Mon, 4 Nov 1996 19:54:50 +0000 Subject: [PATCH] * config/tc-mn10300.c (mn10300_insert_operand): Handle repeated register operands. For mov imm8,dn mov imm8,an cmp imm8,dn cmp imm8,an The register appears twice in the bit pattern... Egad. --- gas/ChangeLog | 5 +++++ gas/config/tc-mn10300.c | 27 ++++++++++++++++++++++----- 2 files changed, 27 insertions(+), 5 deletions(-) diff --git a/gas/ChangeLog b/gas/ChangeLog index 5867b293a6..c90d55f96a 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,8 @@ +Mon Nov 4 12:53:40 1996 Jeffrey A Law (law@cygnus.com) + + * config/tc-mn10300.c (mn10300_insert_operand): Handle + repeated register operands. + Fri Nov 1 10:42:49 1996 Ian Lance Taylor * doc/as.texinfo: Added section on reporting bugs. diff --git a/gas/config/tc-mn10300.c b/gas/config/tc-mn10300.c index 601a860fd9..a4e08efeac 100644 --- a/gas/config/tc-mn10300.c +++ b/gas/config/tc-mn10300.c @@ -435,6 +435,7 @@ md_assemble (str) const char *errmsg = NULL; int op_idx; char *hold; + int extra_shift = 0; fc = 0; match = 0; @@ -587,8 +588,18 @@ md_assemble (str) goto error; } + if (opcode->format == FMT_D1 || opcode->format == FMT_S1) + extra_shift = 8; + else if (opcode->format == FMT_D2 || opcode->format == FMT_D4 + || opcode->format == FMT_S2 || opcode->format == FMT_S4 + || opcode->format == FMT_S6 || opcode->format == FMT_D5) + extra_shift = 16; + else + extra_shift = 0; + insn = mn10300_insert_operand (insn, operand, ex.X_add_number, - (char *) NULL, 0); + (char *) NULL, 0, extra_shift); + break; case O_constant: @@ -604,7 +615,7 @@ md_assemble (str) } insn = mn10300_insert_operand (insn, operand, ex.X_add_number, - (char *) NULL, 0); + (char *) NULL, 0, 0); break; default: @@ -795,7 +806,7 @@ md_apply_fix3 (fixp, valuep, seg) insn = bfd_getl32((unsigned char *) where); insn = mn10300_insert_operand (insn, operand, (offsetT) value, - fixp->fx_file, fixp->fx_line); + fixp->fx_file, fixp->fx_line, 0); bfd_putl32((bfd_vma) insn, (unsigned char *) where); if (fixp->fx_done) @@ -833,12 +844,13 @@ md_apply_fix3 (fixp, valuep, seg) /* Insert an operand value into an instruction. */ static unsigned long -mn10300_insert_operand (insn, operand, val, file, line) +mn10300_insert_operand (insn, operand, val, file, line, shift) unsigned long insn; const struct mn10300_operand *operand; offsetT val; char *file; unsigned int line; + unsigned int shift; { if (operand->bits != 32) { @@ -873,7 +885,12 @@ mn10300_insert_operand (insn, operand, val, file, line) } } - insn |= (((long) val & ((1 << operand->bits) - 1)) << operand->shift); + insn |= (((long) val & ((1 << operand->bits) - 1)) + << (operand->shift + shift)); + + if ((operand->flags & MN10300_OPERAND_REPEATED) != 0) + insn |= (((long) val & ((1 << operand->bits) - 1)) + << (operand->shift + shift + 2)); return insn; } -- 2.34.1