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]

Re: [PATCH] Fix s390x PR target/14533


Jakub Jelinek wrote:

> On Thu, Mar 11, 2004 at 11:42:44PM +0100, Ulrich Weigand wrote:
> > Hi Jakub,
> > 
> > > (const:DI (plus:DI (unspec:DI [
> > >                 (symbol_ref:DI ("b"))
> > >             ] UNSPEC_GOT)
> > >         (const_int 4 [0x4])))
> > 
> > This could actually be accepted as legitimate in the first place.
> 
> Gas doesn't like them though, for:
> a.s:
>         lg      %r2,b@GOT(%r12)
>         lg      %r2,b+4@GOT(%r12)
>         lg      %r2,4+b@GOT(%r12)
> I get:
> a.s:2: Warning: identifier+constant@got means identifier@got+constant
> a.s:3: Warning: identifier+constant@got means identifier@got+constant
> and there is no way to turn off that warning.

There is: just use b@GOT+4(%r12) to start with.

The following experimental patch against 3.3 accepts the above
address as legitimate and appears to generate correct code;
I haven't tested it yet though.

Bye,
Ulrich

Index: gcc/config/s390/s390.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/s390/s390.c,v
retrieving revision 1.70.2.14
diff -c -p -r1.70.2.14 s390.c
*** gcc/config/s390/s390.c	6 Mar 2004 19:18:40 -0000	1.70.2.14
--- gcc/config/s390/s390.c	11 Mar 2004 22:39:43 -0000
*************** s390_decompose_address (addr, out)
*** 1852,1857 ****
--- 1852,1872 ----
  	  pointer = TRUE;
          }
  
+       /* Likewise if a small constant offset is present.  */
+       else if (GET_CODE (disp) == CONST
+ 	       && GET_CODE (XEXP (disp, 0)) == PLUS
+                && GET_CODE (XEXP (XEXP (disp, 0), 1)) == CONST_INT
+ 	       && INTVAL (XEXP (XEXP (disp, 0), 1)) < GET_MODE_SIZE (Pmode)
+                && GET_CODE (XEXP (XEXP (disp, 0), 0)) == UNSPEC
+                && (XINT (XEXP (XEXP (disp, 0), 0), 1) == 110
+ 		   || XINT (XEXP (XEXP (disp, 0), 0), 1) == UNSPEC_GOTNTPOFF))
+         {
+           if (flag_pic != 1)
+             return FALSE;
+ 
+ 	  pointer = TRUE;
+         }
+ 
        /* Accept chunkfied literal pool symbol references.  */
        else if (GET_CODE (disp) == CONST
                 && GET_CODE (XEXP (disp, 0)) == MINUS
*************** legitimize_pic_address (orig, reg)
*** 2272,2278 ****
              {
  	      if (XVECLEN (op0, 0) != 1)
                  abort ();
!               if (XINT (op0, 1) != 100)
                  abort ();
  
                new = force_const_mem (Pmode, orig);
--- 2287,2294 ----
              {
  	      if (XVECLEN (op0, 0) != 1)
                  abort ();
!               if (XINT (op0, 1) != 100
! 		  && XINT (op0, 1) != 112)
                  abort ();
  
                new = force_const_mem (Pmode, orig);

-- 
  Dr. Ulrich Weigand
  weigand@informatik.uni-erlangen.de


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