From 0691188992efa4afab80bfdf966479bc331ce0a4 Mon Sep 17 00:00:00 2001 From: Claudiu Zissulescu Date: Mon, 5 Dec 2016 15:09:48 +0100 Subject: [PATCH] [ARC] Don't check extAuxRegister second argument for sign. gas/ 2016-12-05 Claudiu Zissulescu * 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 | 12 +++++++++ gas/config/tc-arc.c | 27 ++++++++++++-------- gas/testsuite/gas/arc/textauxregister-1.d | 10 ++++++++ gas/testsuite/gas/arc/textauxregister-1.s | 5 ++++ gas/testsuite/gas/arc/textcondcode-err.s | 2 ++ gas/testsuite/gas/arc/textcoreregister-err.s | 2 ++ 6 files changed, 47 insertions(+), 11 deletions(-) create mode 100644 gas/testsuite/gas/arc/textauxregister-1.d create mode 100644 gas/testsuite/gas/arc/textauxregister-1.s create mode 100644 gas/testsuite/gas/arc/textcondcode-err.s create mode 100644 gas/testsuite/gas/arc/textcoreregister-err.s diff --git a/gas/ChangeLog b/gas/ChangeLog index a721bb20d04..18ff1b27e52 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,15 @@ +2016-12-05 Claudiu Zissulescu + + * 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 * config/tc-arm.c (arm_ext_v8_3, do_vjcvt): Define. diff --git a/gas/config/tc-arc.c b/gas/config/tc-arc.c index 13e925fc7f8..cebf198cae6 100644 --- a/gas/config/tc-arc.c +++ b/gas/config/tc-arc.c @@ -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 index 00000000000..ce8e52ef1ca --- /dev/null +++ b/gas/testsuite/gas/arc/textauxregister-1.d @@ -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 index 00000000000..b4c5ead0674 --- /dev/null +++ b/gas/testsuite/gas/arc/textauxregister-1.s @@ -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 index 00000000000..0a0a954d4ae --- /dev/null +++ b/gas/testsuite/gas/arc/textcondcode-err.s @@ -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 index 00000000000..2b7d9189a3c --- /dev/null +++ b/gas/testsuite/gas/arc/textcoreregister-err.s @@ -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" } -- 2.30.2