]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
* config/tc-metag.c: Make SWAP instruction less permissive with its operands.
authorNick Clifton <nickc@redhat.com>
Wed, 30 Jan 2013 13:21:01 +0000 (13:21 +0000)
committerNick Clifton <nickc@redhat.com>
Wed, 30 Jan 2013 13:21:01 +0000 (13:21 +0000)
  * gas/metag/metacore21-invalid.s: Add invalid SWAP testcases
  * gas/metag/metacore21-invalid.l: Add expected output for invalid SWAP testcases

gas/ChangeLog
gas/config/tc-metag.c
gas/testsuite/ChangeLog
gas/testsuite/gas/metag/metacore21-invalid.l
gas/testsuite/gas/metag/metacore21-invalid.s

index b4a211f594b088825ddc6626dc96b1df7f5857e6..e14f75c16f364fbf6ab2126f6141a416178eec1e 100644 (file)
@@ -1,3 +1,8 @@
+2013-01-30  Markos Chandras  <markos.chandras@imgtec.com>
+
+       * config/tc-metag.c: Make SWAP instruction less permissive with
+       its operands.
+
 2013-01-29  DJ Delorie  <dj@redhat.com>
 
        * config/tc-rl78.c (rl78_cons_fix_new): Handle user-specified
index d5e603aa0fd0f3c82b653e9b2c159646e6fefc4e..f42d2f187cbf32169592e1e7617445486c8885c2 100644 (file)
@@ -2026,11 +2026,37 @@ parse_swap (const char *line, metag_insn *insn,
   if (l == NULL)
     return NULL;
 
-  insn->bits = (template->meta_opcode |
-               (regs[1]->no << 19) |
-               (regs[0]->no << 14) |
-               (regs[1]->unit << 10) |
-               (regs[0]->unit << 5));
+  /* PC.r | CT.r | TR.r | TT.r are treated as if they are a single unit.  */
+  switch (regs[0]->unit)
+    {
+    case UNIT_PC:
+    case UNIT_CT:
+    case UNIT_TR:
+    case UNIT_TT:
+      if (regs[1]->unit == UNIT_PC
+         || regs[1]->unit == UNIT_CT
+         || regs[1]->unit == UNIT_TR
+         || regs[1]->unit == UNIT_TT)
+       {
+         as_bad (_("PC, CT, TR and TT are treated as if they are a single unit but operands must be in different units"));
+         return NULL;
+       }
+
+    default:
+      /* Registers must be in different units.  */
+      if (regs[0]->unit == regs[1]->unit)
+       {
+         as_bad (_("source and destination register must be in different units"));
+         return NULL;
+       }
+      break;
+    }
+
+  insn->bits = (template->meta_opcode
+               | (regs[1]->no << 19)
+               | (regs[0]->no << 14)
+               | (regs[1]->unit << 10)
+               | (regs[0]->unit << 5));
 
   insn->len = 4;
   return l;
index 85dd2c136447ae0cef0f01dbc6783f0c968f5089..28467852de94f8258e8e81bb640031c592f4c96a 100644 (file)
@@ -1,3 +1,9 @@
+2013-01-30  Markos Chandras  <markos.chandras@imgtec.com>
+
+       * gas/metag/metacore21-invalid.s: Add invalid SWAP testcases.
+       * gas/metag/metacore21-invalid.l: Add expected output for invalid
+       SWAP testcases.
+
 2013-01-28  Alexis Deruelle  <alexis.deruelle@gmail.com>
 
        PR gas/15069
index 33524570624176183781a7ed0e86cf9e7a98cf47..4c27c53553f8b9087251c660721aac4f8c72f5d3 100644 (file)
@@ -15,3 +15,9 @@
 .*:8: Error: .*
 .*:8: Error: .*
 .*:8: Error: .*
+.*:9: Error: .*
+.*:9: Error: .*
+.*:10: Error: .*
+.*:10: Error: .*
+.*:11: Error: .*
+.*:11: Error: .*
index be23532a5b5cc0a71de2ca53577f3ebc13c45b1d..8dd4c046a5e7039936854945fba63985ab7493b4 100644 (file)
@@ -6,3 +6,6 @@ _start:
        SETD    [A0.0+A0.1],A0.2
        ASL     D0.0,D1.0,D0.0
        GETD    D0.0,[D0.0--D0.0]
+       SWAP    PC,PCX
+       SWAP    CT.0,PCX
+       SWAP    D0.1,D0.2