Allow symbols in MEMORY region specification
[deliverable/binutils-gdb.git] / gas / config / tc-metag.c
index d5e603aa0fd0f3c82b653e9b2c159646e6fefc4e..8d78349bc0c30fe575731e3bfc8429197888ca2d 100644 (file)
@@ -1,5 +1,5 @@
 /* tc-metag.c -- Assembler for the Imagination Technologies Meta.
-   Copyright (C) 2013 Free Software Foundation, Inc.
+   Copyright (C) 2013-2015 Free Software Foundation, Inc.
    Contributed by Imagination Technologies Ltd.
 
    This file is part of GAS, the GNU Assembler.
@@ -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;
This page took 0.024932 seconds and 4 git commands to generate.