* config/tc-mn10300.c (mn10300_insert_operand): Handle
authorJeff Law <law@redhat.com>
Mon, 4 Nov 1996 19:54:50 +0000 (19:54 +0000)
committerJeff Law <law@redhat.com>
Mon, 4 Nov 1996 19:54:50 +0000 (19:54 +0000)
        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
gas/config/tc-mn10300.c

index 5867b293a6d34fb89969cdd57e394a6a8360867e..c90d55f96a128c4cf7e2c1aa69871cc1fcbbf34c 100644 (file)
@@ -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  <ian@cygnus.com>
 
        * doc/as.texinfo: Added section on reporting bugs.
index 601a860fd9bf0a4631e01fb7cf5035e2100f078d..a4e08efeac4535c908576014b43b514b11f46e9e 100644 (file)
@@ -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;
 }
 
This page took 0.032536 seconds and 4 git commands to generate.