[ARC] Don't check extAuxRegister second argument for sign.
authorClaudiu Zissulescu <claziss@synopsys.com>
Mon, 5 Dec 2016 14:09:48 +0000 (15:09 +0100)
committerClaudiu Zissulescu <claziss@synopsys.com>
Mon, 5 Dec 2016 14:16:28 +0000 (15:16 +0100)
gas/
2016-12-05  Claudiu Zissulescu  <claziss@synopsys.com>

* testsuite/gas/arc/textauxregister-1.d: New file.
* testsuite/gas/arc/textauxregister-1.s: Likewise.
* testsuite/gas/arc/textcondcode-err.s: Likewise.
* testsuite/gas/arc/textcoreregister-err.s: Likewise.
* config/tc-arc.c (tokenize_extregister): Return bfd_boolean,
don't check second argument of extension auxiliary register for
signess.
(arc_extcorereg): Consider the return of tokenize_extregister
function call.

gas/ChangeLog
gas/config/tc-arc.c
gas/testsuite/gas/arc/textauxregister-1.d [new file with mode: 0644]
gas/testsuite/gas/arc/textauxregister-1.s [new file with mode: 0644]
gas/testsuite/gas/arc/textcondcode-err.s [new file with mode: 0644]
gas/testsuite/gas/arc/textcoreregister-err.s [new file with mode: 0644]

index a721bb20d0454bf83244c36d2b685fc53e4b4bc1..18ff1b27e52817b3f25622a440155c75d712c166 100644 (file)
@@ -1,3 +1,15 @@
+2016-12-05  Claudiu Zissulescu  <claziss@synopsys.com>
+
+       * testsuite/gas/arc/textauxregister-1.d: New file.
+       * testsuite/gas/arc/textauxregister-1.s: Likewise.
+       * testsuite/gas/arc/textcondcode-err.s: Likewise.
+       * testsuite/gas/arc/textcoreregister-err.s: Likewise.
+       * config/tc-arc.c (tokenize_extregister): Return bfd_boolean,
+       don't check second argument of extension auxiliary register for
+       signess.
+       (arc_extcorereg): Consider the return of tokenize_extregister
+       function call.
+
 2016-12-05  Szabolcs Nagy  <szabolcs.nagy@arm.com>
 
        * config/tc-arm.c (arm_ext_v8_3, do_vjcvt): Define.
index 13e925fc7f8402315f01a7a8163f5bfe28e914b7..cebf198cae67cfe4d6f91025932702f5fbab50b2 100644 (file)
@@ -4545,7 +4545,7 @@ arc_extinsn (int ignore ATTRIBUTE_UNUSED)
   create_extinst_section (&einsn);
 }
 
-static void
+static bfd_boolean
 tokenize_extregister (extRegister_t *ereg, int opertype)
 {
   char *name;
@@ -4570,20 +4570,23 @@ tokenize_extregister (extRegister_t *ereg, int opertype)
 
   if (*input_line_pointer != ',')
     {
-      as_bad (_("expected comma after register name"));
+      as_bad (_("expected comma after name"));
       ignore_rest_of_line ();
       free (name);
-      return;
+      return FALSE;
     }
   input_line_pointer++;
   number = get_absolute_expression ();
 
-  if (number < 0)
+  if ((number < 0)
+      && (opertype != EXT_AUX_REGISTER))
     {
-      as_bad (_("negative operand number %d"), number);
+      as_bad (_("%s second argument cannot be a negative number %d"),
+             isCore_p ? "extCoreRegister's" : "extCondCode's",
+             number);
       ignore_rest_of_line ();
       free (name);
-      return;
+      return FALSE;
     }
 
   if (isReg_p)
@@ -4596,7 +4599,7 @@ tokenize_extregister (extRegister_t *ereg, int opertype)
          as_bad (_("expected comma after register number"));
          ignore_rest_of_line ();
          free (name);
-         return;
+         return FALSE;
        }
 
       input_line_pointer++;
@@ -4617,7 +4620,7 @@ tokenize_extregister (extRegister_t *ereg, int opertype)
          as_bad (_("invalid mode"));
          ignore_rest_of_line ();
          free (name);
-         return;
+         return FALSE;
        }
       else
        {
@@ -4635,7 +4638,7 @@ tokenize_extregister (extRegister_t *ereg, int opertype)
          as_bad (_("expected comma after register mode"));
          ignore_rest_of_line ();
          free (name);
-         return;
+         return FALSE;
        }
 
       input_line_pointer++;
@@ -4650,7 +4653,7 @@ tokenize_extregister (extRegister_t *ereg, int opertype)
          as_bad (_("shortcut designator invalid"));
          ignore_rest_of_line ();
          free (name);
-         return;
+         return FALSE;
        }
       else
        {
@@ -4662,6 +4665,7 @@ tokenize_extregister (extRegister_t *ereg, int opertype)
   ereg->name = name;
   ereg->number = number;
   ereg->imode  = imode;
+  return TRUE;
 }
 
 /* Create an extension register/condition description in the arc
@@ -4737,7 +4741,8 @@ arc_extcorereg (int opertype)
   struct arc_flag_operand *ccode;
 
   memset (&ereg, 0, sizeof (ereg));
-  tokenize_extregister (&ereg, opertype);
+  if (!tokenize_extregister (&ereg, opertype))
+    return;
 
   switch (opertype)
     {
diff --git a/gas/testsuite/gas/arc/textauxregister-1.d b/gas/testsuite/gas/arc/textauxregister-1.d
new file mode 100644 (file)
index 0000000..ce8e52e
--- /dev/null
@@ -0,0 +1,10 @@
+#objdump: -dr
+
+.*: +file format .*arc.*
+
+
+Disassembly of section .text:
+
+[0-9a-f]+ <.text>:
+\s+0:\s+222a 0f80 8001 8000\s+lr\s+r2,\[myreg1\]
+\s+8:\s+21aa 003c\s+lr\s+r1,\[myreg2\]
diff --git a/gas/testsuite/gas/arc/textauxregister-1.s b/gas/testsuite/gas/arc/textauxregister-1.s
new file mode 100644 (file)
index 0000000..b4c5ead
--- /dev/null
@@ -0,0 +1,5 @@
+       .extAuxRegister myreg1, 0x80018000, r|w
+       .extAuxRegister myreg2, -256, r|w
+
+       lr      r2, [myreg1]
+       lr      r1, [myreg2]
diff --git a/gas/testsuite/gas/arc/textcondcode-err.s b/gas/testsuite/gas/arc/textcondcode-err.s
new file mode 100644 (file)
index 0000000..0a0a954
--- /dev/null
@@ -0,0 +1,2 @@
+; { dg-do assemble { target arc*-*-* } }
+       .extCondCode    cctst, -12 ; { dg-error "Error: extCondCode's second argument cannot be a negative number -12" }
diff --git a/gas/testsuite/gas/arc/textcoreregister-err.s b/gas/testsuite/gas/arc/textcoreregister-err.s
new file mode 100644 (file)
index 0000000..2b7d918
--- /dev/null
@@ -0,0 +1,2 @@
+; { dg-do assemble { target arc*-*-* } }
+       .extCoreRegister r32c, -32, r|w, can_shortcut ; { dg-error "Error: extCoreRegister's second argument cannot be a negative number -32" }