gas: sparc: allow ASR registers in the 0..31 range in V9 and later
authorJose E. Marchesi <jose.marchesi@oracle.com>
Thu, 24 Mar 2016 17:28:41 +0000 (10:28 -0700)
committerJose E. Marchesi <jose.marchesi@oracle.com>
Thu, 24 Mar 2016 17:28:41 +0000 (10:28 -0700)
In the SPARC V9 (and later) versions of the SPARC specification, the
section C.1.1 "Register Names" specifies that:

"asr_reg.  An asr_reg is an Ancillary State Register name.  It may have
 one of the following values:

  %asr16-%asr31"

The rationale of having this restriction was that the registers from 16
to 31 are reserved to implementations, and are therefore "non-V9".  It
also assumes that the existing ASR registers in the range 0..31 will
have their own names such as %y, that can be used to access such
registers.

However, this is problematic.  When a new ASR register is introduced,
such as %mcdper a.k.a. %asr14, it is useful to be able to use %asr14 in
order to not depend on the latest version of the assembler.

The Solaris assembler is lax and allows to assembly instructions
referring to %asr0 to %asr31.  This patch makes the GNU assembler to
mimic that behavior.

gas/ChangeLog:

  2016-03-24  Jose E. Marchesi  <jose.marchesi@oracle.com>

* config/tc-sparc.c (sparc_ip): Remove the V9 restriction on ASR
registers to be in the 16..31 range.

gas/ChangeLog
gas/config/tc-sparc.c

index f1f588e7ea42113db006000a9d2329c7ee35373e..493d779a7c66effe512ccead58649d32dbff74c5 100644 (file)
@@ -1,3 +1,8 @@
+2016-03-24  Jose E. Marchesi  <jose.marchesi@oracle.com>
+
+       * config/tc-sparc.c (sparc_ip): Remove the V9 restriction on ASR
+       registers to be in the 16..31 range.
+
 2016-03-24  Trevor Saunders  <tbsaunde+binutils@tbsaunde.org>
 
        * config/tc-microblaze.c (md_assemble): Cast opc to char * when calling
index 5d4e0d6631ce995abebc9c68d92e22e03f069e94..dfb84ef6829656d92f98d3ce7382c1bee84681c9 100644 (file)
@@ -1841,22 +1841,22 @@ sparc_ip (char *str, const struct sparc_opcode **pinsn)
                          ++s;
                        }
 
-                     if (current_architecture >= SPARC_OPCODE_ARCH_V9)
-                       {
-                         if (num < 16 || 31 < num)
-                           {
-                             error_message = _(": asr number must be between 16 and 31");
-                             goto error;
-                           }
-                       }
-                     else
-                       {
-                         if (num < 0 || 31 < num)
-                           {
-                             error_message = _(": asr number must be between 0 and 31");
-                             goto error;
-                           }
-                       }
+                      /* We used to check here for the asr number to
+                         be between 16 and 31 in V9 and later, as
+                         mandated by the section C.1.1 "Register
+                         Names" in the SPARC spec.  However, we
+                         decided to remove this restriction as a) it
+                         introduces problems when new V9 asr registers
+                         are introduced, b) the Solaris assembler
+                         doesn't implement this restriction and c) the
+                         restriction will go away in future revisions
+                         of the Oracle SPARC Architecture.  */
+
+                      if (num < 0 || 31 < num)
+                        {
+                          error_message = _(": asr number must be between 0 and 31");
+                          goto error;
+                        }
 
                      opcode |= (*args == 'M' ? RS1 (num) : RD (num));
                      continue;
This page took 0.029337 seconds and 4 git commands to generate.