Index: lra-constraints.c =================================================================== --- lra-constraints.c (revision 199762) +++ lra-constraints.c (working copy) @@ -1997,15 +1997,8 @@ process_alt_operands (int only_alternati (op, this_alternative) == NO_REGS)))) reject += LRA_MAX_REJECT; - if (MEM_P (op) && offmemok) - { - /* If we know offset and this non-offsetable memory, - something wrong with this memory and it is better - to try other memory possibilities. */ - if (MEM_OFFSET_KNOWN_P (op)) - reject += LRA_MAX_REJECT; - } - else if (! (const_to_mem && constmemok)) + if (! (MEM_P (op) && offmemok) + && ! (const_to_mem && constmemok)) { /* We prefer to reload pseudos over reloading other things, since such reloads may be able to be Index: lra.c =================================================================== --- lra.c (revision 199753) +++ lra.c (working copy) @@ -306,11 +306,11 @@ lra_emit_add (rtx x, rtx y, rtx z) || (disp != NULL_RTX && ! CONSTANT_P (disp)) || (scale != NULL_RTX && ! CONSTANT_P (scale))) { - /* Its is not an address generation. Probably we have no 3 op + /* It is not an address generation. Probably we have no 3 op add. Last chance is to use 2-op add insn. */ lra_assert (x != y && x != z); - emit_move_insn (x, z); - insn = gen_add2_insn (x, y); + emit_move_insn (x, y); + insn = gen_add2_insn (x, z); emit_insn (insn); } else Index: testsuite/gcc.target/s390/pr57559.c =================================================================== --- testsuite/gcc.target/s390/pr57559.c (revision 0) +++ testsuite/gcc.target/s390/pr57559.c (working copy) @@ -0,0 +1,24 @@ +/* PR rtl-optimization/57559 */ + +/* { dg-do compile } */ +/* { dg-options "-march=z10 -m64 -mzarch -O1" } */ + +typedef int int32_t; +typedef unsigned char uint8_t; +typedef unsigned int uint32_t; +struct _IO_marker +{ +}; +static const int32_t mfcone = 1; +static const uint8_t *mfctop = (const uint8_t *) &mfcone; +int32_t +decContextTestEndian (uint8_t quiet) +{ + int32_t res = 0; + uint32_t dle = (uint32_t) 0; + if (*(int *) 10 != 0) + { + res = (int32_t) * mfctop - dle; + } + return res; +}