This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Fix PR optimization/8366 (Sparc)
> This is ok, except for SYMBOLIC_CONST. You might as well
> call symbolic_operand directly all the time.
Of course. The modified patch is attached.
> > If so, on which branch(es) are you willing to accept the fix?
>
> All of them.
Ok, I'm going to enter a round of testing and I'll report tomorrow.
Thanks for your help.
--
Eric Botcazou
2003-03-16 Eric Botcazou <ebotcazou at libertysurf dot fr>
Richard Henderson <rth at redhat dot com>
PR optimization/8366
* config/sparc/sparc.h: (SYMBOLIC_CONST): New.
(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.
Index: config/sparc/sparc.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/sparc/sparc.h,v
retrieving revision 1.161.2.27
diff -u -r1.161.2.27 sparc.h
--- config/sparc/sparc.h 24 Jun 2002 16:50:44 -0000 1.161.2.27
+++ config/sparc/sparc.h 16 Mar 2003 08:34:18 -0000
@@ -2203,6 +2203,8 @@
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 @@
&& 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 @@
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; \
+ } \
+ } \
+}
/* Try machine-dependent ways of modifying an illegitimate address
to be legitimate. If we find one, return the new, valid address.
@@ -2400,12 +2432,6 @@
} \
/* ??? 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