From 4db3896a69df05a763b345db21f77f7a888cec0f Mon Sep 17 00:00:00 2001 From: Eric Botcazou Date: Fri, 21 Mar 2003 11:20:50 +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: r64659 --- 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 dfe5a4df263c..11e1b44b0262 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-20 Richard Henderson * fold-const.c (extract_muldiv_1): Revert changing order of diff --git a/gcc/config/sparc/sparc.h b/gcc/config/sparc/sparc.h index 2902f06ce8cd..58b10cd773d1 100644 --- a/gcc/config/sparc/sparc.h +++ b/gcc/config/sparc/sparc.h @@ -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; \ + } \ + } \ +} /* 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. */ -- 2.47.2