aboutsummaryrefslogtreecommitdiff
path: root/gcc/config
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2014-01-20 10:52:21 +0100
committerJakub Jelinek <jakub@gcc.gnu.org>2014-01-20 10:52:21 +0100
commit0fabe5f34ff7f53f92f055aff02170ef6a305cac (patch)
tree72ae1b0d8c429da9fb93082e460c754929b43049 /gcc/config
parent6fc00404fa5037b61bd85d1825c2504e70d4992c (diff)
downloadgcc-0fabe5f34ff7f53f92f055aff02170ef6a305cac.zip
gcc-0fabe5f34ff7f53f92f055aff02170ef6a305cac.tar.gz
gcc-0fabe5f34ff7f53f92f055aff02170ef6a305cac.tar.bz2
re PR target/59880 (ix86_avoid_lea_for_addr is buggy)
PR target/59880 * config/i386/i386.c (ix86_avoid_lea_for_addr): Return false if operands[1] is a REG or ZERO_EXTEND of a REG. * gcc.target/i386/pr59880.c: New test. From-SVN: r206792
Diffstat (limited to 'gcc/config')
-rw-r--r--gcc/config/i386/i386.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index ff210c8..9991c30 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -18159,8 +18159,19 @@ ix86_avoid_lea_for_addr (rtx insn, rtx operands[])
if (!TARGET_AVOID_LEA_FOR_ADDR || optimize_function_for_size_p (cfun))
return false;
+ /* The "at least two components" test below might not catch simple
+ *mov[sd]i_internal or *zero_extendsidi2 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 or zero extensions are the common
+ case, do this check first. */
+ if (REG_P (operands[1])
+ || (GET_CODE (operands[1]) == ZERO_EXTEND
+ && REG_P (XEXP (operands[1], 0))))
+ return false;
+
/* Check it is correct to split here. */
- if (!ix86_ok_to_clobber_flags(insn))
+ if (!ix86_ok_to_clobber_flags (insn))
return false;
ok = ix86_decompose_address (operands[1], &parts);