[patch] MIPS: Size optimization costs.

Eric Christopher echristo@apple.com
Mon Nov 6 20:19:00 GMT 2006


On Nov 6, 2006, at 12:15 PM, Richard Sandiford wrote:

> Eric Christopher <echristo@apple.com> writes:
>>> Too much indentation: the COST_N_INSNS() lines are too indented.
>>> OK otherwise.
>>>
>>> I'm not a great fan of the current MIPS cost model, not least  
>>> because
>>> it fails to take things like -mhard-float and -msoft-float into
>>> account.
>>> However, your patch is a strict improvement on what we have now.
>>>
>>
>> FWIW a simple improvement on this would be to bias the cost count in
>> favor of the cheaper instructions, i.e. multiplication over division
>> using something like CONST_N_INSNS(1) + 1.
>
> I don't think that's a good idea.  The expressions given to rtx_costs
> can be arbitrarily complex, and taken literally, the higher cost would
> suggest that 4 divisions have the same cost as 5 multiplications.

Yeah, I've just never seen a case where we've done something like that
in the middle end. I'm willing to stipulate it could happen though.

> If we're optimising for size, I think something should only have
> a higher cost if it really is bigger.  Adding +1 to the cost of X
> might be appropriate if using X sometimes causes extra code to
> be generated (e.g. if we sometimes have to insert nops to avoid
> pipeline hazards).

That's a good idea though.

-eric



More information about the Gcc-patches mailing list