Commit b1dd92fd by Bernd Schmidt Committed by Bernd Schmidt

tree-ssa-loop-ivopts.c (get_address_cost): Make sure memory addresses we…

tree-ssa-loop-ivopts.c (get_address_cost): Make sure memory addresses we generate for testing are aligned.

	* tree-ssa-loop-ivopts.c (get_address_cost): Make sure memory
	addresses we generate for testing are aligned.

From-SVN: r118863
parent f9f63ff2
2006-11-15 Bernd Schmidt <bernd.schmidt@analog.com>
* tree-ssa-loop-ivopts.c (get_address_cost): Make sure memory
addresses we generate for testing are aligned.
2006-11-15 Andrew Pinski <andrew_pinski@playstation.sony.com> 2006-11-15 Andrew Pinski <andrew_pinski@playstation.sony.com>
PR tree-opt/29788 PR tree-opt/29788
......
...@@ -3318,7 +3318,8 @@ multiply_by_cost (HOST_WIDE_INT cst, enum machine_mode mode) ...@@ -3318,7 +3318,8 @@ multiply_by_cost (HOST_WIDE_INT cst, enum machine_mode mode)
return cost; return cost;
} }
/* Returns true if multiplying by RATIO is allowed in address. */ /* Returns true if multiplying by RATIO is allowed in an address. Test the
validity for a memory reference accessing memory of mode MODE. */
bool bool
multiplier_allowed_in_address_p (HOST_WIDE_INT ratio, enum machine_mode mode) multiplier_allowed_in_address_p (HOST_WIDE_INT ratio, enum machine_mode mode)
...@@ -3361,7 +3362,8 @@ multiplier_allowed_in_address_p (HOST_WIDE_INT ratio, enum machine_mode mode) ...@@ -3361,7 +3362,8 @@ multiplier_allowed_in_address_p (HOST_WIDE_INT ratio, enum machine_mode mode)
/* Returns cost of address in shape symbol + var + OFFSET + RATIO * index. /* Returns cost of address in shape symbol + var + OFFSET + RATIO * index.
If SYMBOL_PRESENT is false, symbol is omitted. If VAR_PRESENT is false, If SYMBOL_PRESENT is false, symbol is omitted. If VAR_PRESENT is false,
variable is omitted. The created memory accesses MODE. variable is omitted. Compute the cost for a memory reference that accesses
a memory location of mode MEM_MODE.
TODO -- there must be some better way. This all is quite crude. */ TODO -- there must be some better way. This all is quite crude. */
...@@ -3383,6 +3385,7 @@ get_address_cost (bool symbol_present, bool var_present, ...@@ -3383,6 +3385,7 @@ get_address_cost (bool symbol_present, bool var_present,
if (!initialized[mem_mode]) if (!initialized[mem_mode])
{ {
HOST_WIDE_INT i; HOST_WIDE_INT i;
HOST_WIDE_INT start = BIGGEST_ALIGNMENT / BITS_PER_UNIT;
int old_cse_not_expected; int old_cse_not_expected;
unsigned sym_p, var_p, off_p, rat_p, add_c; unsigned sym_p, var_p, off_p, rat_p, add_c;
rtx seq, addr, base; rtx seq, addr, base;
...@@ -3393,22 +3396,22 @@ get_address_cost (bool symbol_present, bool var_present, ...@@ -3393,22 +3396,22 @@ get_address_cost (bool symbol_present, bool var_present,
reg1 = gen_raw_REG (Pmode, LAST_VIRTUAL_REGISTER + 1); reg1 = gen_raw_REG (Pmode, LAST_VIRTUAL_REGISTER + 1);
addr = gen_rtx_fmt_ee (PLUS, Pmode, reg1, NULL_RTX); addr = gen_rtx_fmt_ee (PLUS, Pmode, reg1, NULL_RTX);
for (i = 1; i <= 1 << 20; i <<= 1) for (i = start; i <= 1 << 20; i <<= 1)
{ {
XEXP (addr, 1) = gen_int_mode (i, Pmode); XEXP (addr, 1) = gen_int_mode (i, Pmode);
if (!memory_address_p (mem_mode, addr)) if (!memory_address_p (mem_mode, addr))
break; break;
} }
max_offset[mem_mode] = i >> 1; max_offset[mem_mode] = i == start ? 0 : i >> 1;
off[mem_mode] = max_offset[mem_mode]; off[mem_mode] = max_offset[mem_mode];
for (i = 1; i <= 1 << 20; i <<= 1) for (i = start; i <= 1 << 20; i <<= 1)
{ {
XEXP (addr, 1) = gen_int_mode (-i, Pmode); XEXP (addr, 1) = gen_int_mode (-i, Pmode);
if (!memory_address_p (mem_mode, addr)) if (!memory_address_p (mem_mode, addr))
break; break;
} }
min_offset[mem_mode] = -(i >> 1); min_offset[mem_mode] = i == start ? 0 : -(i >> 1);
if (dump_file && (dump_flags & TDF_DETAILS)) if (dump_file && (dump_flags & TDF_DETAILS))
{ {
......
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