On 04/27/2013 10:39 AM, Richard Sandiford wrote: > Argh, that's unfortunate. The point of that change was to make > simplify_gen_unary (TRUNCATE, ...) no worse than using a subreg. > Would the equivalent lowpart simplify_gen_subreg call succeed > (return nonnull)? If so, I think we want truncate to do the same. > > What simplification is this blocking, and why does it lead to > reload failures?
There's an explicit (set (reg:PSI) (truncate:PSI (reg:SI)) insn which currently gets changed to (set (reg:PSI) (subreg:PSI (reg:SI)) during cse1. Reload fails because the subreg gets propagated into a memory address, which requires a class of A_REGS, but A_REGS can only hold PSImode values, not SImode. This shows that the truncation is not always a no-op: in this case it involves a register move, but there's no way to describe this using TRULY_NOOP_TRUNCATION. Bernd