From 460837de09418a2457c2701af9ebc75e2f2ddeef Mon Sep 17 00:00:00 2001 From: uros Date: Wed, 22 Jan 2014 19:57:30 +0000 Subject: [PATCH] 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-4_7-branch@206940 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 8 ++++++++ gcc/config/i386/i386.c | 15 +++++++++++---- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 4d3f1e5fa33..8660db337f3 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2014-01-22 Uros Bizjak + Jakub Jelinek + + 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 Backport from mainline diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index 8e0185623a3..447f6f27f14 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -16986,16 +16986,23 @@ ix86_avoid_lea_for_addr (rtx insn, rtx operands[]) 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); -- 2.11.0