From a8b4d977b34bbe3793b6e4d2c0e6907b35037f6e Mon Sep 17 00:00:00 2001
From: kenner <kenner@138bc75d-0d04-0410-961f-82ee72b054a4>
Date: Tue, 10 Jul 2001 22:09:10 +0000
Subject: [PATCH] 	* recog.c (offsettable_address_p): Handle LO_SUM case.
 	* config/mips/mips.c (double_memory_operand): Use adjust_address_nv 
 instead of plus_constant.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@43912 138bc75d-0d04-0410-961f-82ee72b054a4
---
 gcc/ChangeLog          |  6 ++++++
 gcc/config/mips/mips.c | 12 ++++--------
 gcc/recog.c            | 10 +++++++---
 3 files changed, 17 insertions(+), 11 deletions(-)

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index a15eb81ea562..34b7610b6358 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+Tue Jul 10 07:27:53 2001  Richard Kenner  <kenner@vlsi1.ultra.nyu.edu>
+
+	* recog.c (offsettable_address_p): Handle LO_SUM case.
+	* config/mips/mips.c (double_memory_operand): Use adjust_address_nv
+	instead of plus_constant.
+	
 2001-07-10  Stephane Carrez  <Stephane.Carrez@worldnet.fr>
 
 	* reload1.c (merge_assigned_reloads): After a RELOAD_OTHER merge,
diff --git a/gcc/config/mips/mips.c b/gcc/config/mips/mips.c
index 03356671ddb6..48c391590b95 100644
--- a/gcc/config/mips/mips.c
+++ b/gcc/config/mips/mips.c
@@ -838,8 +838,6 @@ double_memory_operand (op, mode)
      rtx op;
      enum machine_mode mode;
 {
-  rtx addr;
-
   if (GET_CODE (op) != MEM
       || ! memory_operand (op, mode))
     {
@@ -939,14 +937,12 @@ double_memory_operand (op, mode)
   /* Make sure that 4 added to the address is a valid memory address.
      This essentially just checks for overflow in an added constant.  */
 
-  addr = XEXP (op, 0);
-
-  if (CONSTANT_ADDRESS_P (addr))
+  if (CONSTANT_ADDRESS_P (XEXP (op, 0)))
     return 1;
 
-  return memory_address_p ((GET_MODE_CLASS (mode) == MODE_INT
-			    ? SImode : SFmode),
-			   plus_constant (addr, 4));
+  op = adjust_address_nv (op, GET_MODE_CLASS (mode) == MODE_INT
+			  ? SImode : SFmode, 4);
+  return memory_address_p (XEXP (op, 0));
 }
 
 /* Return nonzero if the code of this rtx pattern is EQ or NE.  */
diff --git a/gcc/recog.c b/gcc/recog.c
index 01bc1f3a373a..26ff03021898 100644
--- a/gcc/recog.c
+++ b/gcc/recog.c
@@ -1963,9 +1963,13 @@ offsettable_address_p (strictp, mode, y)
   /* The offset added here is chosen as the maximum offset that
      any instruction could need to add when operating on something
      of the specified mode.  We assume that if Y and Y+c are
-     valid addresses then so is Y+d for all 0<d<c.  */
-
-  z = plus_constant (y, mode_sz - 1);
+     valid addresses then so is Y+d for all 0<d<c.  adjust_address will
+     go inside a LO_SUM here, so we do so as well.  */
+  if (GET_CODE (y) == LO_SUM)
+    z = gen_rtx_LO_SUM (GET_MODE (y), XEXP (y, 0),
+			plus_constant (XEXP (y, 1), mode_sz - 1));
+  else
+    z = plus_constant (y, mode_sz - 1);
 
   /* Use QImode because an odd displacement may be automatically invalid
      for any wider mode.  But it should be valid for a single byte.  */
-- 
GitLab