Hello! > Here is a fix for PR 50962. Fix improves AGU stall avoidance > optimization by adding opportunity to emit lea instead of mov when it > is profitable. > > 2011-11-03 Enkovich Ilya <ilya.enkov...@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.
OK for mainline SVN with a small change, see below. +/* 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 we can transform mov to lea. */ + if (!REG_P (operands[0]) || !REG_P (operands[1])) + return false; Please fix the comment and ... + /* Check if we need to optimize. */ + if (!TARGET_OPT_AGU || optimize_function_for_size_p (cfun)) + return false; ... switch this check with the one above, it is faster to exit early this way. + regno0 = true_regnum (operands[0]); + regno1 = true_regnum (operands[1]); + + return ix86_lea_outperforms (insn, regno0, regno1, -1, 0); +} Thanks, Uros.