Commit dd033f1a authored by Matthias Braun's avatar Matthias Braun
Browse files

implement load after store for different modes in big endian

parent 61c66f56
...@@ -707,32 +707,28 @@ static int try_load_after_store(ir_node *load, ...@@ -707,32 +707,28 @@ static int try_load_after_store(ir_node *load,
delta = load_offset - store_offset; delta = load_offset - store_offset;
store_value = get_Store_value(store); store_value = get_Store_value(store);
if (delta != 0 || store_mode != load_mode) { if (delta < 0 || delta+load_mode_len > store_mode_len)
/* TODO: implement for big-endian */ return 0;
if (delta < 0 || delta + load_mode_len > store_mode_len
|| (be_get_backend_param()->byte_order_big_endian
&& load_mode_len != store_mode_len))
return 0;
if (get_mode_arithmetic(store_mode) != irma_twos_complement ||
get_mode_arithmetic(load_mode) != irma_twos_complement)
return 0;
if (store_mode != load_mode &&
get_mode_arithmetic(store_mode) == irma_twos_complement &&
get_mode_arithmetic(load_mode) == irma_twos_complement) {
/* produce a shift to adjust offset delta */ /* produce a shift to adjust offset delta */
if (delta > 0) { unsigned const shift = be_get_backend_param()->byte_order_big_endian
ir_node *cnst; ? store_mode_len - load_mode_len - delta
ir_graph *irg = get_irn_irg(load); : delta;
if (shift != 0) {
cnst = new_r_Const_long(irg, mode_Iu, delta * 8); ir_graph *const irg = get_irn_irg(load);
ir_node *const cnst = new_r_Const_long(irg, mode_Iu, shift * 8);
store_value = new_r_Shr(get_nodes_block(load), store_value = new_r_Shr(get_nodes_block(load),
store_value, cnst, store_mode); store_value, cnst, store_mode);
} }
/* add an convert if needed */ store_value = new_r_Conv(get_nodes_block(load), store_value, load_mode);
if (store_mode != load_mode) { } else {
store_value = new_r_Conv(get_nodes_block(load), store_value, load_mode); /* we would need some kind of bitcast node here */
} return 0;
} }
DBG_OPT_RAW(load, store_value); DBG_OPT_RAW(load, store_value);
......
Supports Markdown
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