aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlrich Weigand <uweigand@de.ibm.com>2007-11-15 14:30:58 +0000
committerUlrich Weigand <uweigand@gcc.gnu.org>2007-11-15 14:30:58 +0000
commit3f61b42f2b8727a4fd00d6956c91fb2bbe77dd88 (patch)
tree93e5da469c246c089f6519c410dcf37b1b4a5407
parentdd4ba939839ddf0b34b6ea847c55f6b7798aefb9 (diff)
downloadgcc-3f61b42f2b8727a4fd00d6956c91fb2bbe77dd88.zip
gcc-3f61b42f2b8727a4fd00d6956c91fb2bbe77dd88.tar.gz
gcc-3f61b42f2b8727a4fd00d6956c91fb2bbe77dd88.tar.bz2
spu-protos.h (legitimate_const): Remove prototype.
* config/spu/spu-protos.h (legitimate_const): Remove prototype. * config/spu/spu.c (legitimate_const): Remove. (classify_immediate): Inline call to legitimate_const. (spu_legitimate_address): Likewise. Allow SMBOL_REF + CONST_INT for any constant, not just -512 .. 511. From-SVN: r130200
-rw-r--r--gcc/ChangeLog8
-rw-r--r--gcc/config/spu/spu-protos.h1
-rw-r--r--gcc/config/spu/spu.c51
3 files changed, 33 insertions, 27 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 23ba940..d5683b9 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,11 @@
+2007-11-15 Ulrich Weigand <Ulrich.Weigand@de.ibm.com>
+
+ * config/spu/spu-protos.h (legitimate_const): Remove prototype.
+ * config/spu/spu.c (legitimate_const): Remove.
+ (classify_immediate): Inline call to legitimate_const.
+ (spu_legitimate_address): Likewise. Allow SMBOL_REF + CONST_INT
+ for any constant, not just -512 .. 511.
+
2007-11-15 Sa Liu <saliu@de.ibm.com>
* config/spu/spu.c (spu_emit_branch_or_set): Remove PROCESSOR_CELL
diff --git a/gcc/config/spu/spu-protos.h b/gcc/config/spu/spu-protos.h
index b00fc5d..ab85d5d 100644
--- a/gcc/config/spu/spu-protos.h
+++ b/gcc/config/spu/spu-protos.h
@@ -52,7 +52,6 @@ extern int logical_immediate_p (rtx op, enum machine_mode mode);
extern int iohl_immediate_p (rtx op, enum machine_mode mode);
extern int arith_immediate_p (rtx op, enum machine_mode mode,
HOST_WIDE_INT low, HOST_WIDE_INT high);
-extern int legitimate_const (rtx x, int aligned);
extern int spu_constant_address_p (rtx x);
extern int spu_legitimate_constant_p (rtx x);
extern int spu_legitimate_address (enum machine_mode mode, rtx x,
diff --git a/gcc/config/spu/spu.c b/gcc/config/spu/spu.c
index 1f2efb6..79693b8 100644
--- a/gcc/config/spu/spu.c
+++ b/gcc/config/spu/spu.c
@@ -2475,29 +2475,6 @@ spu_float_const (const char *string, enum machine_mode mode)
return CONST_DOUBLE_FROM_REAL_VALUE (value, mode);
}
-/* Given a (CONST (PLUS (SYMBOL_REF) (CONST_INT))) return TRUE when the
- CONST_INT fits constraint 'K', i.e., is small. */
-int
-legitimate_const (rtx x, int aligned)
-{
- /* We can never know if the resulting address fits in 18 bits and can be
- loaded with ila. Instead we should use the HI and LO relocations to
- load a 32-bit address. */
- rtx sym, cst;
-
- gcc_assert (GET_CODE (x) == CONST);
-
- if (GET_CODE (XEXP (x, 0)) != PLUS)
- return 0;
- sym = XEXP (XEXP (x, 0), 0);
- cst = XEXP (XEXP (x, 0), 1);
- if (GET_CODE (sym) != SYMBOL_REF || GET_CODE (cst) != CONST_INT)
- return 0;
- if (aligned && ((INTVAL (cst) & 15) != 0 || !ALIGNED_SYMBOL_REF_P (sym)))
- return 0;
- return satisfies_constraint_K (cst);
-}
-
int
spu_constant_address_p (rtx x)
{
@@ -2618,8 +2595,20 @@ classify_immediate (rtx op, enum machine_mode mode)
return TARGET_LARGE_MEM ? IC_IL2s : IC_IL1s;
case CONST:
- return TARGET_LARGE_MEM
- || !legitimate_const (op, 0) ? IC_IL2s : IC_IL1s;
+ /* We can never know if the resulting address fits in 18 bits and can be
+ loaded with ila. For now, assume the address will not overflow if
+ the displacement is "small" (fits 'K' constraint). */
+ if (!TARGET_LARGE_MEM && GET_CODE (XEXP (op, 0)) == PLUS)
+ {
+ rtx sym = XEXP (XEXP (op, 0), 0);
+ rtx cst = XEXP (XEXP (op, 0), 1);
+
+ if (GET_CODE (sym) == SYMBOL_REF
+ && GET_CODE (cst) == CONST_INT
+ && satisfies_constraint_K (cst))
+ return IC_IL1s;
+ }
+ return IC_IL2s;
case HIGH:
return IC_IL1s;
@@ -2870,7 +2859,17 @@ spu_legitimate_address (enum machine_mode mode ATTRIBUTE_UNUSED,
return !TARGET_LARGE_MEM;
case CONST:
- return !TARGET_LARGE_MEM && legitimate_const (x, 0);
+ if (!TARGET_LARGE_MEM && GET_CODE (XEXP (x, 0)) == PLUS)
+ {
+ rtx sym = XEXP (XEXP (x, 0), 0);
+ rtx cst = XEXP (XEXP (x, 0), 1);
+
+ /* Accept any symbol_ref + constant, assuming it does not
+ wrap around the local store addressability limit. */
+ if (GET_CODE (sym) == SYMBOL_REF && GET_CODE (cst) == CONST_INT)
+ return 1;
+ }
+ return 0;
case CONST_INT:
return INTVAL (x) >= 0 && INTVAL (x) <= 0x3ffff;