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

--- Comment #12 from Hongtao Liu <liuhongt at gcc dot gnu.org> ---
short a;
short c;
short d;
void
foo (short b, short f)
{
  c = b + a;
  d = f + a;
}

foo(short, short):
        addw    a(%rip), %di
        addw    a(%rip), %si
        movw    %di, c(%rip)
        movw    %si, d(%rip)
        ret

this one is bad since gcc10.1 and there's no subreg, The problem is if the
operand is used by more than 1 insn, and they all support separate m
constraint, mem_cost is quite small(just 1, reg move cost is 2), and this makes
RA more inclined to propagate memory across insns. I guess RA assumes the
separate m means the insn only support memory_operand?

 961                  if (op_class == NO_REGS)
 962                    /* Although we don't need insn to reload from
 963                       memory, still accessing memory is usually more
 964                       expensive than a register.  */
 965                    pp->mem_cost = frequency;
 966                  else

Reply via email to