Commit 3f61b42f by Ulrich Weigand Committed by Ulrich Weigand

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
parent dd4ba939
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> 2007-11-15 Sa Liu <saliu@de.ibm.com>
* config/spu/spu.c (spu_emit_branch_or_set): Remove PROCESSOR_CELL * config/spu/spu.c (spu_emit_branch_or_set): Remove PROCESSOR_CELL
...@@ -52,7 +52,6 @@ extern int logical_immediate_p (rtx op, enum machine_mode mode); ...@@ -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 iohl_immediate_p (rtx op, enum machine_mode mode);
extern int arith_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); 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_constant_address_p (rtx x);
extern int spu_legitimate_constant_p (rtx x); extern int spu_legitimate_constant_p (rtx x);
extern int spu_legitimate_address (enum machine_mode mode, rtx x, extern int spu_legitimate_address (enum machine_mode mode, rtx x,
......
...@@ -2475,29 +2475,6 @@ spu_float_const (const char *string, enum machine_mode mode) ...@@ -2475,29 +2475,6 @@ spu_float_const (const char *string, enum machine_mode mode)
return CONST_DOUBLE_FROM_REAL_VALUE (value, 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 int
spu_constant_address_p (rtx x) spu_constant_address_p (rtx x)
{ {
...@@ -2618,8 +2595,20 @@ classify_immediate (rtx op, enum machine_mode mode) ...@@ -2618,8 +2595,20 @@ classify_immediate (rtx op, enum machine_mode mode)
return TARGET_LARGE_MEM ? IC_IL2s : IC_IL1s; return TARGET_LARGE_MEM ? IC_IL2s : IC_IL1s;
case CONST: case CONST:
return TARGET_LARGE_MEM /* We can never know if the resulting address fits in 18 bits and can be
|| !legitimate_const (op, 0) ? IC_IL2s : IC_IL1s; 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: case HIGH:
return IC_IL1s; return IC_IL1s;
...@@ -2870,7 +2859,17 @@ spu_legitimate_address (enum machine_mode mode ATTRIBUTE_UNUSED, ...@@ -2870,7 +2859,17 @@ spu_legitimate_address (enum machine_mode mode ATTRIBUTE_UNUSED,
return !TARGET_LARGE_MEM; return !TARGET_LARGE_MEM;
case CONST: 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: case CONST_INT:
return INTVAL (x) >= 0 && INTVAL (x) <= 0x3ffff; return INTVAL (x) >= 0 && INTVAL (x) <= 0x3ffff;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment