re PR target/50962 (Additional opportunity for AGU stall avoidance optimization for Atom processor)

gcc/
	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.

From-SVN: r181077
This commit is contained in:
Enkovich Ilya 2011-11-07 08:47:15 +00:00 committed by Kirill Yukhin
parent e0f0ee74f0
commit f3b61b784d
4 changed files with 37 additions and 1 deletions

View File

@ -93,6 +93,7 @@ extern bool ix86_binary_operator_ok (enum rtx_code, enum machine_mode, rtx[]);
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[]);

View File

@ -16509,6 +16509,29 @@ ix86_avoid_lea_for_add (rtx insn, rtx operands[])
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. */

View File

@ -2053,6 +2053,8 @@
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}";
}
@ -2288,7 +2290,10 @@
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")

View File

@ -1,3 +1,10 @@
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>