aboutsummaryrefslogtreecommitdiff
path: root/gcc/config
diff options
context:
space:
mode:
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);