I've been working on some patches to make insn_rtx_cost take account
of the cost of SET_DESTs as well as SET_SRCs. But I'm slowly beginning
to realise that I don't understand what rtx costs are supposed to represent.
AIUI the rules have historically been:
1) Registers have zero cost.
2) Constants have a cost relative to that of registers. By extension,
constants have zero cost if they are as cheap as a register.
3) With an outer code of SET, actual operations have the cost
of the associated instruction. E.g. the cost of a PLUS
is the cost of an addition instruction.
4) With other outer codes, actual operations have the cost
of the combined instruction, if available, or the cost of
a separate instruction otherwise. E.g. the cost of a NEG
inside an AND might be zero on targets that support BIC-like
instructions, and COSTS_N_INSNS (1) on most others.
[...]
But that hardly seems clean either. Perhaps we should instead make
the SET_SRC always include the cost of the SET, even for registers,
constants and the like. Thoughts?