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

--- Comment #13 from Tamar Christina <tnfchris at gcc dot gnu.org> ---
(In reply to Jakub Jelinek from comment #12)
> E.g. the i386 backend usually uses force_reg in this case.  If the operand
> is a REG, it does nothing, if it is a SUBREG, it is forced into a temporary
> and then the subreg in the pattern will DTRT.

We had force_regs before but this is suboptimal as that will always force a
register even when it was valid to just change the subreg.  It would also force
constants to registers.  Both of these operations break the optimal codegen if
the operands or return registers are hardregs.

combine will then insert a move it doesn't cleanup and the register allocator
thinks it has choice in where the operation happens (GPR/FPR).

So we only really want to force a reg if the subreg relationship isn't valid.
So Andrew's suggestion is probably the least destructive for the cases we care
to be optimal.

I did write and regest a patch here and just forgot to post it. doing so now.

Reply via email to