public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: hjl@lucon.org (H.J. Lu)
To: egcs@cygnus.com
Subject: A patch for CONST_DOUBLE
Date: Fri, 13 Mar 1998 18:47:00 -0000	[thread overview]
Message-ID: <m0yDgyo-00058fC@ocean.lucon.org> (raw)

Hi,

I have to use this patch to make egcs generate correct asm code
on PPro. I don't understand the way force_const_mem () handles
CONST_DOUBLE in nested function. It doesn't look right to me.
When you force a double into memory, you have to assign a label
to the memory location even if it is in nested function. Otherwise,
force_const_mem () doesn't really do anything for nested function.
I will happen to resend a test case which I have sent to the egcs
list earlier.

BTW, if my patch is wrong, I would appreciate a test case to show it.

Thanks.


-- 
H.J. Lu (hjl@gnu.org)
---
Fri Mar 13 18:40:57 1998  H.J. Lu  (hjl@gnu.org)

	* varasm.c (force_const_mem): Always update the label for
	CONST_DOUBLE even in nested function.
	(mark_constants): Enable searching inside a CONST_DOUBLE.

Index: varasm.c
===================================================================
RCS file: /home/work/cvs/gnu/egcs/gcc/varasm.c,v
retrieving revision 1.1.1.11
diff -u -p -r1.1.1.11 varasm.c
--- varasm.c	1998/03/12 17:18:41	1.1.1.11
+++ varasm.c	1998/03/14 02:35:18
@@ -3423,6 +3431,7 @@ force_const_mem (mode, x)
   CONSTANT_POOL_ADDRESS_P (XEXP (def, 0)) = 1;
   current_function_uses_const_pool = 1;
 
+#if 0
   if (outer_function_chain == 0)
     if (GET_CODE (x) == CONST_DOUBLE)
       {
@@ -3433,6 +3442,17 @@ force_const_mem (mode, x)
 	  }
 	CONST_DOUBLE_MEM (x) = def;
       }
+#else
+  if (GET_CODE (x) == CONST_DOUBLE)
+    {
+      if (outer_function_chain == 0 && CONST_DOUBLE_MEM (x) == cc0_rtx)
+	{
+	  CONST_DOUBLE_CHAIN (x) = const_double_chain;
+	  const_double_chain = x;
+	}
+      CONST_DOUBLE_MEM (x) = def;
+    }
+#endif
 
   return def;
 }
@@ -3625,6 +3645,7 @@ mark_constants (x)
 	find_pool_constant (x)->mark = 1;
       return;
     }
+#if 0
   /* Never search inside a CONST_DOUBLE, because CONST_DOUBLE_MEM may be
      a MEM, but does not constitute a use of that MEM.  This is particularly
      important inside a nested function, because CONST_DOUBLE_MEM may be
@@ -3632,6 +3653,7 @@ mark_constants (x)
      in force_const_mem.  */
   else if (GET_CODE (x) == CONST_DOUBLE)
     return;
+#endif
 
   /* Insns may appear inside a SEQUENCE.  Only check the patterns of
      insns, not any notes that may be attached.  We don't want to mark

             reply	other threads:[~1998-03-13 18:47 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-03-13 18:47 H.J. Lu [this message]
1998-03-16 20:25 ` Jim Wilson
1998-03-17 11:27   ` H.J. Lu
1998-03-17 11:27     ` Jim Wilson
1998-03-17 11:33       ` H.J. Lu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m0yDgyo-00058fC@ocean.lucon.org \
    --to=hjl@lucon.org \
    --cc=egcs@cygnus.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).