]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
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 10:20:50 +0000 (11:20 +0100)
committerEric Botcazou <ebotcazou@gcc.gnu.org>
Fri, 21 Mar 2003 10:20:50 +0000 (10:20 +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: r64659

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

index dfe5a4df263c60045220d88e9f0ebf71917bb21a..11e1b44b02620f68578221be777fa3797356712b 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-20  Richard Henderson  <rth@redhat.com>
 
        * fold-const.c (extract_muldiv_1): Revert changing order of
index 2902f06ce8cd2fdea04f56a3c742531e03e130ae..58b10cd773d10123f6ef12f6b4e762f8cbc03f9d 100644 (file)
@@ -2203,6 +2203,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                                           \
@@ -2236,6 +2238,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;                                  \
@@ -2323,6 +2327,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.
@@ -2401,12 +2433,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)
-
 /* If we are referencing a function make the SYMBOL_REF special.
    In the Embedded Medium/Anywhere code model, %g4 points to the data segment
    so we must not add it to function addresses.  */