+2014-01-22 Uros Bizjak <ubizjak@gmail.com>
+ Jakub Jelinek <jakub@redhat.com>
+
+ PR target/59880
+ * config/i386/i386.c (ix86_avoid_lea_for_addr): Return false
+ for SImode_address_operand operands. Return false
+ if operands[1] is a REG.
+
2014-01-21 Andrey Belevantsev <abel@ispras.ru>
Backport from mainline
int ok;
/* FIXME: Handle zero-extended addresses. */
- if (GET_CODE (operands[1]) == ZERO_EXTEND
- || GET_CODE (operands[1]) == AND)
+ if (SImode_address_operand (operands[1], VOIDmode))
return false;
/* Check we need to optimize. */
if (!TARGET_OPT_AGU || optimize_function_for_size_p (cfun))
return false;
- /* Check it is correct to split here. */
- if (!ix86_ok_to_clobber_flags(insn))
+ /* The "at least two components" test below might not catch simple
+ move insns if parts.base is non-NULL and parts.disp is const0_rtx
+ as the only components in the address, e.g. if the register is
+ %rbp or %r13. As this test is much cheaper and moves are the
+ common case, do this check first. */
+ if (REG_P (operands[1]))
+ return false;
+
+ /* Check if it is OK to split here. */
+ if (!ix86_ok_to_clobber_flags (insn))
return false;
ok = ix86_decompose_address (operands[1], &parts);