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

--- Comment #7 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
```
void f(long *a, int *b)
{
  *b = *a;
}
```

Shows the difference.

propagating insn 7 into insn 8, replacing:
(set (mem:SI (reg/v/f:DI 22 [ bD.1854 ]) [2 *b_5(D)+0 S4 A32])
    (subreg:SI (reg:DI 23 [ *a_4(D) ]) 0))
successfully matched this instruction to *movsi:
(set (mem:SI (reg/v/f:DI 22 [ bD.1854 ]) [2 *b_5(D)+0 S4 A32])
    (mem:SI (reg/v/f:DI 21 [ aD.1853 ]) [1 *a_4(D)+0 S4 A64]))


Note one most RISC like targets in GCC have the a check in their mov to make
sure that either operand is a reg so reload/LRA does not need to create a
temporary:.
e.g rs6000:
  "gpc_reg_operand (operands[0], <MODE>mode)
   || gpc_reg_operand (operands[1], <MODE>mode)"

aarch64:
  "(register_operand (operands[0], <MODE>mode)
    || aarch64_reg_or_zero (operands[1], <MODE>mode))"

Which might prevent this case from happening.

Reply via email to