This is the mail archive of the binutils@sourceware.org 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]

Re: [PATCH] gas: sparc: allow ASR registers in the 0..31 range in V9 and later


    
    > +	* config/tc-sparc.c (sparc_ip): Remove the V9 restriction on ASR
    > +	registers to be in the 16..31 range.
    
    Approved - please apply, but...
    
    > +                      if (num < 0 || 31 < num)
    > +                        {
    > +                          error_message = _(": asr number must be between 0 and 31");
    > +                          goto error;
    > +                        }
    
    Please could you add a comment here, explaining the rationale that you
    mentioned in your email.  That way a reader of the sources who wonders
    why the assembler is not complaining about "invalid" asr names, will 
    know what is going on.
    
Applied as below.  Thanks.

diff --git a/gas/ChangeLog b/gas/ChangeLog
index f1f588e..493d779 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -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
diff --git a/gas/config/tc-sparc.c b/gas/config/tc-sparc.c
index 5d4e0d6..dfb84ef 100644
--- a/gas/config/tc-sparc.c
+++ b/gas/config/tc-sparc.c
@@ -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;


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