Commit a0c3ad80 authored by Christoph Mallon's avatar Christoph Mallon
Browse files

Fix adjustment of ldr/str offsets on ARM.

They just use a 12 bit offset, not an immediate shifter operand.
This fixes the regression in ack/str.c.
parent 23a265fe
......@@ -129,8 +129,7 @@ static void peephole_arm_Str_Ldr(ir_node *node)
{
arm_load_store_attr_t *attr = get_arm_load_store_attr(node);
const int offset = attr->offset;
arm_vals v;
if (allowed_arm_immediate(offset, &v))
if (arm_is_offset12(offset))
return;
/* we should only have too big offsets for frame entities */
......@@ -146,6 +145,8 @@ static void peephole_arm_Str_Ldr(ir_node *node)
ptr = get_irn_n(node, n_arm_Ldr_ptr);
}
arm_vals v;
arm_gen_vals_from_word(offset, &v);
if (use_add) {
ptr = gen_ptr_add(node, ptr, &v);
} else {
......
......@@ -31,4 +31,10 @@ typedef struct arm_vals {
*/
void arm_gen_vals_from_word(uint32_t value, arm_vals *result);
static inline bool arm_is_offset12(int32_t const v)
{
/* Symmetrical, because ARM uses sign+magnitude for offset. */
return -4095 <= v && v <= 4095;
}
#endif
......@@ -1104,8 +1104,7 @@ static arm_am_t transform_am(ir_node *addr)
ir_node *const r = get_Add_right(addr);
if (is_Const(r)) {
long const c = get_Const_long(r);
/* Symmetrical, because ARM uses sign+magnitude for offset. */
if (-4096 < offset && offset < 4096) {
if (arm_is_offset12(offset)) {
offset = c;
addr = get_Add_left(addr);
}
......
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