re PR target/8366 ([sparc-sun-solaris2.7] C testsuite failure w/-m64 -fpic -O in...
authorEric Botcazou <ebotcazou@libertysurf.fr>
Fri, 21 Mar 2003 09:46:38 +0000 (10:46 +0100)
committerEric Botcazou <ebotcazou@gcc.gnu.org>
Fri, 21 Mar 2003 09:46:38 +0000 (09:46 +0000)
PR optimization/8366
* config/sparc/sparc.h: (SYMBOLIC_CONST): New macro.
(GO_IF_LEGITIMATE_ADDRESS): Use it. Reject the form
PIC+SYMBOLIC_CONST in other modes than Pmode.
(GO_IF_MODE_DEPENDENT_ADDRESS): Use it. Mark
the form PIC+SYMBOLIC_CONST as mode dependent.

Co-Authored-By: Richard Henderson <rth@redhat.com>
From-SVN: r64657

gcc/ChangeLog
gcc/config/sparc/sparc.h

index 118ff21..2178dac 100644 (file)
@@ -1,3 +1,13 @@
+2003-03-21  Eric Botcazou  <ebotcazou@libertysurf.fr>
+            Richard Henderson  <rth@redhat.com>
+
+       PR optimization/8366
+       * config/sparc/sparc.h: (SYMBOLIC_CONST): New macro.
+       (GO_IF_LEGITIMATE_ADDRESS): Use it. Reject the form
+       PIC+SYMBOLIC_CONST in other modes than Pmode.
+       (GO_IF_MODE_DEPENDENT_ADDRESS): Use it. Mark
+       the form PIC+SYMBOLIC_CONST as mode dependent.
+
 2003-03-21  DJ Delorie  <dj@redhat.com>
 
        * config/stormy16/stormy16.c (xstormy16_expand_arith): Make
index a41f6b5..2e47ba4 100644 (file)
@@ -2180,6 +2180,8 @@ do {                                                                      \
 
    If you change this, execute "rm explow.o recog.o reload.o".  */
 
+#define SYMBOLIC_CONST(X) symbolic_operand (X, VOIDmode)
+
 #define RTX_OK_FOR_BASE_P(X)                                           \
   ((GET_CODE (X) == REG && REG_OK_FOR_BASE_P (X))                      \
   || (GET_CODE (X) == SUBREG                                           \
@@ -2213,6 +2215,8 @@ do {                                                                      \
                   && GET_CODE (op1) != REG             \
                   && GET_CODE (op1) != LO_SUM          \
                   && GET_CODE (op1) != MEM             \
+                  && (! SYMBOLIC_CONST (op1)           \
+                      || MODE == Pmode)                \
                   && (GET_CODE (op1) != CONST_INT      \
                       || SMALL_INT (op1)))             \
            goto ADDR;                                  \
@@ -2300,6 +2304,34 @@ do {                                                                     \
   else if (GET_CODE (X) == CONST_INT && SMALL_INT (X)) \
     goto ADDR;                                         \
 }
+
+/* Go to LABEL if ADDR (a legitimate address expression)
+   has an effect that depends on the machine mode it is used for.
+
+   In PIC mode,
+
+      (mem:HI [%l7+a])
+
+   is not equivalent to
+   
+      (mem:QI [%l7+a]) (mem:QI [%l7+a+1])
+
+   because [%l7+a+1] is interpreted as the address of (a+1).  */
+
+#define GO_IF_MODE_DEPENDENT_ADDRESS(ADDR, LABEL)      \
+{                                                      \
+  if (flag_pic == 1)                                   \
+    {                                                  \
+      if (GET_CODE (ADDR) == PLUS)                     \
+       {                                               \
+         rtx op0 = XEXP (ADDR, 0);                     \
+         rtx op1 = XEXP (ADDR, 1);                     \
+         if (op0 == pic_offset_table_rtx               \
+             && SYMBOLIC_CONST (op1))                  \
+           goto LABEL;                                 \
+       }                                               \
+    }                                                  \
+}
 \f
 /* Try machine-dependent ways of modifying an illegitimate address
    to be legitimate.  If we find one, return the new, valid address.
@@ -2377,12 +2409,6 @@ do {                                                                    \
     }                                                                  \
   /* ??? 64-bit reloads.  */                                           \
 } while (0)
-
-/* Go to LABEL if ADDR (a legitimate address expression)
-   has an effect that depends on the machine mode it is used for.
-   On the SPARC this is never true.  */
-
-#define GO_IF_MODE_DEPENDENT_ADDRESS(ADDR,LABEL)
 \f
 /* Specify the machine mode that this machine uses
    for the index in the tablejump instruction.  */