public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* Fix x86-64 PIC
@ 2002-10-29 11:23 Jan Hubicka
  2002-10-29 12:39 ` Jakub Jelinek
  0 siblings, 1 reply; 10+ messages in thread
From: Jan Hubicka @ 2002-10-29 11:23 UTC (permalink / raw)
  To: gcc-patches, rth


Hi,
I've found that we generate lousy code for x86-64 PIC because we refuse any
symbolic addresses in address operand. 
This patch reorders the checks to be done in proper order (IE do not check
sign_extended_value for values otherwise special cased for PIC)

Bootstrapped x86-64 with -fPIC forced into the bootstrap flags, i386 bootstrap in progress. OK?
Honza
Tue Oct 29 20:19:33 CET 2002  Jan Hubicka  <jh@suse.cz>
	* i386.c (legitimate_address_p): Reorder checks.

Index: i386.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/i386/i386.c,v
retrieving revision 1.446.2.2
diff -c -3 -p -r1.446.2.2 i386.c
*** i386.c	23 Oct 2002 15:48:29 -0000	1.446.2.2
--- i386.c	29 Oct 2002 19:17:53 -0000
*************** legitimate_address_p (mode, addr, strict
*** 5406,5428 ****
      {
        reason_rtx = disp;
  
-       if (TARGET_64BIT)
- 	{
- 	  if (!x86_64_sign_extended_value (disp))
- 	    {
- 	      reason = "displacement is out of range";
- 	      goto report_error;
- 	    }
- 	}
-       else
- 	{
- 	  if (GET_CODE (disp) == CONST_DOUBLE)
- 	    {
- 	      reason = "displacement is a const_double";
- 	      goto report_error;
- 	    }
- 	}
- 
        if (GET_CODE (disp) == CONST
  	  && GET_CODE (XEXP (disp, 0)) == UNSPEC)
  	switch (XINT (XEXP (disp, 0), 1))
--- 5426,5431 ----
*************** legitimate_address_p (mode, addr, strict
*** 5491,5496 ****
--- 5494,5515 ----
  	  reason = "displacement is not constant";
  	  goto report_error;
  	}
+       else if (TARGET_64BIT)
+ 	{
+ 	  if (!x86_64_sign_extended_value (disp))
+ 	    {
+ 	      reason = "displacement is out of range";
+ 	      goto report_error;
+ 	    }
+ 	}
+       else
+ 	{
+ 	  if (GET_CODE (disp) == CONST_DOUBLE)
+ 	    {
+ 	      reason = "displacement is a const_double";
+ 	      goto report_error;
+ 	    }
+ 	}
      }
  
    /* Everything looks valid.  */

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2002-10-29 22:46 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-10-29 11:23 Fix x86-64 PIC Jan Hubicka
2002-10-29 12:39 ` Jakub Jelinek
2002-10-29 12:41   ` Jan Hubicka
2002-10-29 12:47     ` Jakub Jelinek
2002-10-29 12:48       ` Jan Hubicka
2002-10-29 12:55       ` Jan Hubicka
2002-10-29 12:48     ` Jan Hubicka
2002-10-29 12:55       ` Jakub Jelinek
2002-10-29 13:04         ` Jan Hubicka
2002-10-29 14:46         ` Jan Hubicka

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).