This is the mail archive of the gcc-bugs@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]

Re: 3.4 i386 code generation problem with leal


> > > But that line is:
> > >    52511         leal    $1196+lf at GOTOFF, %esi
> > > 
> > > And this looks really broken,
> > 
> > Yes, that may be leftout of my PIC changes.  I will dig into this.
> 
> I filed a proper PR for this as target/10327; unfortunately, I hit
> return on the web form when I tried to hit ] and sent it with an
> incomplete subject line; maybe someone with GNATS write access can fix this.

Hi,
the problem is caused by allowing (unspec GOTOFF (const (plus (symbol) (int))))
as well as (plus (unspec GOTOFF (symbol)) (int)).
This patch allows only the second alternative (as it works better for
adjust_address.

Honza

Mon Apr  7 21:52:54 CEST 2003  Jan Hubicka  <jh at suse dot cz>
	* i386.c (legitimate_pic_address_disp_p): Do not accept PLUS in the
	GOTOFF operand.
	(legitimize_pic_address): Move plus outside the unspec.
Index: config/i386/i386.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/i386/i386.c,v
retrieving revision 1.557
diff -c -3 -p -r1.557 i386.c
*** config/i386/i386.c	3 Apr 2003 17:40:47 -0000	1.557
--- config/i386/i386.c	7 Apr 2003 19:52:33 -0000
*************** legitimate_pic_address_disp_p (disp)
*** 5833,5838 ****
--- 5833,5840 ----
  	return false;
        return GET_CODE (XVECEXP (disp, 0, 0)) == SYMBOL_REF;
      case UNSPEC_GOTOFF:
+       if (GET_CODE (XVECEXP (disp, 0, 0)) == SYMBOL_REF
+ 	  || GET_CODE (XVECEXP (disp, 0, 0)) == LABEL_REF)
        return local_symbolic_operand (XVECEXP (disp, 0, 0), Pmode);
      case UNSPEC_GOTTPOFF:
      case UNSPEC_GOTNTPOFF:
*************** legitimize_pic_address (orig, reg)
*** 6146,6152 ****
  
        if (reload_in_progress)
  	regs_ever_live[PIC_OFFSET_TABLE_REGNUM] = 1;
!       new = gen_rtx_UNSPEC (Pmode, gen_rtvec (1, addr), UNSPEC_GOTOFF);
        new = gen_rtx_CONST (Pmode, new);
        new = gen_rtx_PLUS (Pmode, pic_offset_table_rtx, new);
  
--- 6148,6162 ----
  
        if (reload_in_progress)
  	regs_ever_live[PIC_OFFSET_TABLE_REGNUM] = 1;
!       if (GET_CODE (addr) == CONST)
! 	addr = XEXP (addr, 0);
!       if (GET_CODE (addr) == PLUS)
! 	  {
!             new = gen_rtx_UNSPEC (Pmode, gen_rtvec (1, XEXP (addr, 0)), UNSPEC_GOTOFF);
! 	    new = gen_rtx_PLUS (Pmode, new, XEXP (addr, 1));
! 	  }
! 	else
!           new = gen_rtx_UNSPEC (Pmode, gen_rtvec (1, addr), UNSPEC_GOTOFF);
        new = gen_rtx_CONST (Pmode, new);
        new = gen_rtx_PLUS (Pmode, pic_offset_table_rtx, new);
  


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