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

--- Comment #5 from Oleg Endo <olegendo at gcc dot gnu.org> ---
(In reply to Andrew Pinski from comment #3)

> That seems to make the cost of a load/store if just an index, the same as the 
> cost
> as the index. Which definitely seems wrong. It should be the cost of the 
> load/store
> and the cost of the address formation. 

Yep, that doesn't seem to be accurate.

> The way aarch64 implements its _rtx_costs is that it cases SET and if the LHS 
> is a
> mem, then it is the cost of the store there and returns true (though you 
> might need
> to take into RHS if it can be more than just a register like). And then MEM
> includes the cost of the load.

That's what I'd also do intuitively.

> i386 does something similar too.

If every backend does that same thing, isn't it better to do it as a default
for everybody?  I can imagine the minimalist backends (like RX) will regress on
this case as well. (Haven't checked it though)

Reply via email to