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]

accept 64-bit constant addresses in mips n32


Even though n32 has a 32-bit address space, sometimes it is important
to be able to reference uncached memory regions or so in n32, and
having the assembler drop the upper 32 bits of such addresses surely
doesn't help.  This patch fixes the problem.  Approved by Eric
Christopher.  I'm checking it in.

Index: gas/ChangeLog
from  Chris Demetriou  <cgd at broadcom dot com>

	* config/tc-mips.c (HAVE_64BIT_ADDRESS_CONSTANTS): New.
	(macro): Use new macro to decide whether to emit constant address
	as 32 or 64 bits if addresses are 32-bit wide but registers are
	64-bit wide.

Index: gas/config/tc-mips.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-mips.c,v
retrieving revision 1.199
diff -u -p -r1.199 tc-mips.c
--- gas/config/tc-mips.c 2 Apr 2003 18:43:16 -0000 1.199
+++ gas/config/tc-mips.c 6 Apr 2003 03:14:06 -0000
@@ -294,6 +294,8 @@ static int mips_32bitmode = 0;
         && mips_pic != EMBEDDED_PIC))
 
 #define HAVE_64BIT_ADDRESSES (! HAVE_32BIT_ADDRESSES)
+#define HAVE_64BIT_ADDRESS_CONSTANTS (HAVE_64BIT_ADDRESSES \
+				      || HAVE_64BIT_GPRS)
 
 /* Return true if the given CPU supports the MIPS16 ASE.  */
 #define CPU_HAS_MIPS16(cpu)						\
@@ -5845,9 +5847,10 @@ macro (ip)
 	     probably attempt to generate 64-bit constants more
 	     efficiently in general.
 	   */
-	  if (HAVE_64BIT_ADDRESSES
-	      && !(offset_expr.X_op == O_constant
-		   && IS_SEXT_32BIT_NUM (offset_expr.X_add_number + 0x8000)))
+	  if ((offset_expr.X_op != O_constant && HAVE_64BIT_ADDRESSES)
+	      || (offset_expr.X_op == O_constant
+		  && !IS_SEXT_32BIT_NUM (offset_expr.X_add_number)
+		  && HAVE_64BIT_ADDRESS_CONSTANTS))
 	    {
 	      p = NULL;
 
@@ -5894,6 +5897,9 @@ macro (ip)
 
 	      return;
 	    }
+	  else if (offset_expr.X_op == O_constant
+		   && !IS_SEXT_32BIT_NUM (offset_expr.X_add_number))
+	    as_bad (_("load/store address overflow (max 32 bits)"));
 
 	  if (breg == 0)
 	    {
-- 
Alexandre Oliva   Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer                 aoliva at {redhat dot com, gcc.gnu.org}
CS PhD student at IC-Unicamp        oliva at {lsd dot ic dot unicamp dot br, gnu.org}
Free Software Evangelist                Professional serial bug killer

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