This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC 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]

Fix x86-64 PIC


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.  */


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