This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: RFC patch: invariant addresses too cheap


Paolo Bonzini <bonzini@gnu.org> writes:
> On 10/31/2009 12:14 PM, Richard Guenther wrote:
>> On Sat, Oct 31, 2009 at 11:58 AM, Paolo Bonzini<bonzini@gnu.org>  wrote:
>>> On 10/31/2009 10:57 AM, Richard Sandiford wrote:
>>>>
>>>> So either I need to hack MIPS so that
>>>> 2 is cheap and 3+ is "expensive", or we need some better way
>>>> of determining this.
>>>
>>> -  return mips_address_insns (addr, SImode, false);
>>> +  int insns = mips_address_insns (addr, SImode, false);
>>> +  return insns == 1 ? 1 : COSTS_N_INSNS (insns - 1);

Ick. ;/

>>>
>>> ?
>>>
>>>> I don't think sticking an x86-specific magic number in the
>>>> middle of generic code is acceptable, regardless of how big
>>>> the comment above it is. ;)
>>>
>>> That's why I suggested using "<= COSTS_N_INSNS (1) / 2" instead of "<  3".
>>>   Also ix86-specific calibration, but not so brutally. :-)
>>
>> But then you should document that address-cost is supposed to be
>> insn-cost based.  Otherwise comparing apples with oranges doesn't
>> make sense, even if it might look less magic to you.
>
> That's true.

Yeah.  We'd also have to document that "half an insn" is considered cheap.
And what does that really mean?  Are we saying that "at most half of an
insn can be given over to address calculation"?  Seems a bit of a weird
concept to hard-wire into the compiler.

And if we did that, I think we'd also want to rewrite the x86 hook so
that it does use COSTS_N_INSNS.  Backends shouldn't really be assuming
that COSTS_N_INSNS(1) == 4.

I prefer the abstract address costs we have now, and in that situation,
Michael's original suggestion of having a target-defined threshold
macro seems more natural.  I'm not sure why it got shot down.

Richard


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]