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]

[PATCH] [GAS] sparc: support %dN and %qN syntax for FP registers.


The SPARC Refence Manual documents the %dN and %qN syntax to refer to
double and quad-precision floating-point registers, respectively.  See
OSA2015 Appendix C, Assembly Language Syntax, C1.1 Register Names.

This patch adds support for these names to GAS.  This eases the porting
of software from Solaris to GNU/Linux, as these register names have been
supported by the Solaris linker for a long time and many assembler
require that support.

gas/ChangeLog:

2015-11-18  Jose E. Marchesi  <jose.marchesi@oracle.com>

	* config/tc-sparc.c (sparc_ip): Support %dN and %qN notation for
	double and quad-precision floating-point registers.
---
 gas/ChangeLog         |  5 +++++
 gas/config/tc-sparc.c | 14 +++++++++++++-
 2 files changed, 18 insertions(+), 1 deletion(-)

diff --git a/gas/ChangeLog b/gas/ChangeLog
index 41e44b5..5f43551 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,3 +1,8 @@
+2015-11-18  Jose E. Marchesi  <jose.marchesi@oracle.com>
+
+	* config/tc-sparc.c (sparc_ip): Support %dN and %qN notation for
+	double and quad-precision floating-point registers.
+
 2015-11-16  Mike Frysinger  <vapier@gentoo.org>
 
 	* config/tc-microblaze.c (parse_imm): Add an offsetT cast.
diff --git a/gas/config/tc-sparc.c b/gas/config/tc-sparc.c
index 28e6ec8..8b90758 100644
--- a/gas/config/tc-sparc.c
+++ b/gas/config/tc-sparc.c
@@ -2370,7 +2370,9 @@ sparc_ip (char *str, const struct sparc_opcode **pinsn)
 		char format;
 
 		if (*s++ == '%'
-		    && ((format = *s) == 'f')
+		    && ((format = *s) == 'f'
+                        || format == 'd'
+                        || format == 'q')
 		    && ISDIGIT (*++s))
 		  {
 		    for (mask = 0; ISDIGIT (*s); ++s)
@@ -2378,6 +2380,16 @@ sparc_ip (char *str, const struct sparc_opcode **pinsn)
 			mask = 10 * mask + (*s - '0');
 		      }		/* read the number */
 
+                    if (format == 'd' && (mask & 1))
+                      {
+                        break;
+                      };	/* register must be even numbered */
+
+                    if (format == 'q' && (mask & 3))
+                      {
+                        break;
+                      }		/* register must be even numbered */
+
 		    if ((*args == 'v'
 			 || *args == 'B'
 			 || *args == '5'
-- 
2.3.4


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