From 731458a46df64853cfea759eecdb3f704752dcbd Mon Sep 17 00:00:00 2001 From: Eric Botcazou Date: Fri, 21 Mar 2003 10:46:38 +0100 Subject: [PATCH] re PR target/8366 ([sparc-sun-solaris2.7] C testsuite failure w/-m64 -fpic -O in execute/loop-2d.c) 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 From-SVN: r64657 --- gcc/ChangeLog | 10 ++++++++++ gcc/config/sparc/sparc.h | 38 ++++++++++++++++++++++++++++++++------ 2 files changed, 42 insertions(+), 6 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 118ff21be71a..2178dac3b0d8 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,13 @@ +2003-03-21 Eric Botcazou + Richard Henderson + + 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 * config/stormy16/stormy16.c (xstormy16_expand_arith): Make diff --git a/gcc/config/sparc/sparc.h b/gcc/config/sparc/sparc.h index a41f6b594288..2e47ba456e74 100644 --- a/gcc/config/sparc/sparc.h +++ b/gcc/config/sparc/sparc.h @@ -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; \ + } \ + } \ +} /* 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) /* Specify the machine mode that this machine uses for the index in the tablejump instruction. */