PR target/50962
* config/i386/i386-protos.h (ix86_use_lea_for_mov): New.
* config/i386/i386.c (ix86_use_lea_for_mov): Likewise.
* config/i386/i386.md (movsi_internal): Emit lea if profitable.
(movdi_internal_rex64): Likewise.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@181077
138bc75d-0d04-0410-961f-
82ee72b054a4
extern bool ix86_lea_outperforms (rtx, unsigned int, unsigned int,
unsigned int, unsigned int);
extern bool ix86_avoid_lea_for_add (rtx, rtx[]);
+extern bool ix86_use_lea_for_mov (rtx, rtx[]);
extern bool ix86_avoid_lea_for_addr (rtx, rtx[]);
extern void ix86_split_lea_for_addr (rtx[], enum machine_mode);
extern bool ix86_lea_for_add_ok (rtx, rtx[]);
return !ix86_lea_outperforms (insn, regno0, regno1, regno2, 1);
}
+/* Return true if we should emit lea instruction instead of mov
+ instruction. */
+
+bool
+ix86_use_lea_for_mov (rtx insn, rtx operands[])
+{
+ unsigned int regno0;
+ unsigned int regno1;
+
+ /* Check if we need to optimize. */
+ if (!TARGET_OPT_AGU || optimize_function_for_size_p (cfun))
+ return false;
+
+ /* Use lea for reg to reg moves only. */
+ if (!REG_P (operands[0]) || !REG_P (operands[1]))
+ return false;
+
+ regno0 = true_regnum (operands[0]);
+ regno1 = true_regnum (operands[1]);
+
+ return ix86_lea_outperforms (insn, regno0, regno1, -1, 0);
+}
+
/* Return true if we need to split lea into a sequence of
instructions to avoid AGU stalls. */
return "mov{l}\t{%k1, %k0|%k0, %k1}";
else if (which_alternative == 2)
return "movabs{q}\t{%1, %0|%0, %1}";
+ else if (ix86_use_lea_for_mov(insn, operands))
+ return "lea{q}\t{%a1, %0|%0, %a1}";
else
return "mov{q}\t{%1, %0|%0, %1}";
}
default:
gcc_assert (!flag_pic || LEGITIMATE_PIC_OPERAND_P (operands[1]));
- return "mov{l}\t{%1, %0|%0, %1}";
+ if (ix86_use_lea_for_mov(insn, operands))
+ return "lea{l}\t{%a1, %0|%0, %a1}";
+ else
+ return "mov{l}\t{%1, %0|%0, %1}";
}
}
[(set (attr "type")
+2011-11-07 Enkovich Ilya <ilya.enkovich@intel.com>
+
+ PR target/50962
+ * config/i386/i386-protos.h (ix86_use_lea_for_mov): New.
+ * config/i386/i386.c (ix86_use_lea_for_mov): Likewise.
+ * config/i386/i386.md (movsi_internal): Emit lea if profitable.
+ (movdi_internal_rex64): Likewise.
2011-11-07 Sergey Ostanevich <sergos.gnu@gmail.com>