Georg-Johann Lay <avr@xxxxxxxx> writes: > iii) Expand into MOV+LSHIFTRT and allow the resulting const in > *movsi_insn: > CSE et. al. will reconstruct the original constant and > replace MOV+LSHIFTRT with a single SET: > Bad: expanding was in vain and we Goto i) I think this is the option you should use. You should use TARGET_RTX_COSTS to make the constants which may not be immediate operands expensive. Then CSE will not reconstruct them. >> I don't know exactly what is going on. But it is most likely just a >> coincidence that it is failing when using SHIFTRT. There is probably >> some way to make it fail in other ways as well. > > Would state it like this: If the movMM expander expands the move into > several insns, each insn must be able to handle an alternative (which > reload might select) without needing a reload. Yes, but also when can_create_pseudo_p returns false the move expander must not call force_reg or gen_reg_reg or anything else which creates a new pseudo register. When can_create_pseudo_p returns true, it is often preferable to generate a new pseudo-reg rather than reuse an existing one. Ian