https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90088

--- Comment #4 from Hongtao.liu <crazylht at gmail dot com> ---
(In reply to Richard Biener from comment #3)
> We have two related tunables, X86_TUNE_OPT_AGU and
> X86_TUNE_AVOID_LEA_FOR_ADDR.
> 
> Probably related is that most uarchs have extra cost for complex addressing
> modes for moves (extra uop to generate the addres).  But I wasn't aware
> that there's extra costs for the AGU op itself.

Yes, m_SANDYBRIDGE is not in X86_TUNE_OPT_AGU and X86_TUNE_AVOID_LEA_FOR_ADDR.

But when I try

gcc -O2 test.c -S -mtune=bonnell

It fails to avoid LEAL instruction, since m_BONNELL is in both tunables,
I believe there's other places need to be handled such as

/* Return true if usage of lea INSN has performance advantage
   over a sequence of instructions.  Instructions sequence has
   SPLIT_COST cycles higher latency than lea latency.  */

static bool
ix86_lea_outperforms (rtx_insn *insn, unsigned int regno0, unsigned int regno1,
                      unsigned int regno2, int split_cost, bool has_scale)
{
  int dist_define, dist_use;

Reply via email to