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

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Oleg Endo from comment #2)
> (In reply to Andrew Pinski from comment #1)
> > This is most likely a cost model issue on sh3.
> 
> You mean this one (sh.cc, sh_rtx_costs)?
> 
>     /* The cost of a mem access is mainly the cost of the address mode.  */
>     case MEM:
>       *total = sh_address_cost (XEXP (x, 0), GET_MODE (x), MEM_ADDR_SPACE
> (x),
>                               true);
>       return true;

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. 

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.

Reply via email to