This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Thumb32 assembler (35/69)


Convert do_mrs to parse_operands.  Note that this introduces a small
amount of slop in the grammar - "CPSR_cf" is now acceptable.  I think
this is harmless.

zw

	* config/tc-arm.c (do_mrs): Use parse_operands.

===================================================================
Index: gas/config/tc-arm.c
--- gas/config/tc-arm.c	(revision 37)
+++ gas/config/tc-arm.c	(revision 38)
@@ -5689,35 +5689,18 @@
 static void
 do_mrs (char * str)
 {
-  /* Only one syntax.  */
-  reg_or_fail (&str, 12, REG_TYPE_RN);
-  comma_or_fail (&str);
+  if (parse_operands (str, OPERANDS2(RR,PSR)))
+    return;
 
-  /* Lower case accepted for backwards compatibility.  */
-  if (*str == 'c' || *str == 'C')
-    ; /* SPSR bit is already clear.  */
-  else if (*str == 's' || *str == 'S')
-    inst.instruction |= SPSR_BIT;
-  else
+  /* mrs only accepts CPSR/SPSR/CPSR_all/SPSR_all.  */
+  if ((inst.operands[1].imm & (PSR_c|PSR_x|PSR_s|PSR_f)) != (PSR_c|PSR_f))
     {
       inst.error = _("'CPSR' or 'SPSR' expected");
       return;
     }
-  str++;
 
-  if (strncasecmp (str, "PSR", 3) != 0)
-    {
-      inst.error = _("'CPSR' or 'SPSR' expected");
-      return;
-    }
-  str += 3;
-
-  /* For backward compatibility, allow a trailing "_all"
-     (lowercase only).  */
-  if (strncmp (str, "_all", 4) == 0)
-    str += 4;
-
-  end_of_line (str);
+  inst.instruction |= inst.operands[0].reg << 12;
+  inst.instruction |= (inst.operands[1].imm & SPSR_BIT);
 }
 
 /* Two possible forms:

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]