On 06/05/12 19:55, Richard Sandiford wrote: > Georg-Johann Lay <a...@gjlay.de> writes: >> TARGET_RTX_COSTS gets called with x = (const_int 1) and outer = SET >> for example. How do I get SET_DEST from that information? >> >> I don't now if lower-subreg.s ever emits such cost requests, but several >> passes definitely do. > > Gah! I really should have remembered that insn_rtx_cost happily ignores > both SETs and SET_DESTs, and skips straight to the SET_SRC. This caught > me out when looking at the auto-inc-dec rewrite last year too. (The problem > in that case was that insn_rtx_cost ignored the cost of MEMs in stores, > and only took into account the cost of MEMs in loads.) > > While that probably ought to change, I felt like I was going down a > rathole last time I looked at it, so this patch does what I should > have done originally. > > For the record: I wondered whether rtlanal.c should base the default > register-to-register copy cost for mode M on the lowest move_cost[M][c][c]. > The problem is that move_cost has traditionally been used to choose > between difference classes in the same mode, rather than between modes, > with 2 as the base cost. So I don't think it's suitable. > > Tested on x86_64-linux-gnu and with the upcoming MIPS costs. Installed. > > Sorry for the breakage. > > Richard > > > gcc/ > * lower-subreg.c (shift_cost): Use set_src_cost, avoiding the SET. > (compute_costs): Likewise for the zero extension. Use set_rtx_cost > to compute the cost of moves. Set the mode of the target register. >
FTR, this caused http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53278 R.