This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: set_src_cost lying comment
- From: Richard Earnshaw <Richard dot Earnshaw at foss dot arm dot com>
- To: Jeff Law <law at redhat dot com>, gcc at gcc dot gnu dot org
- Date: Thu, 25 Jun 2015 13:28:39 +0100
- Subject: Re: set_src_cost lying comment
- Authentication-results: sourceware.org; auth=none
- References: <20150622055710 dot GQ1723 at bubble dot grove dot modra dot org> <558A3AA9 dot 6090406 at redhat dot com> <20150624091846 dot GC1723 at bubble dot grove dot modra dot org> <558ADF04 dot 9040807 at redhat dot com>
On 24/06/15 17:47, Jeff Law wrote:
> On 06/24/2015 03:18 AM, Alan Modra wrote:
>>
>> So in these examples we'd really like register moves to cost one
>> insn. Hmm, at least, moves from hard regs ought to cost something.
> The more I think about it, the more I think that's a reasonable step.
> Nothing should have cost 0.
>
> Jeff
It really means what you mean by cost here. I think rtx_cost is really
talking about delta costs much of the time, so when recursing down
plus (op1, op2)
there's a cost from the plus, a cost from op1 and a cost from op2.
I believe the idea behind reg being cost 0 is that when op1 and op2 are
both registers in the above expression the overall cost is just the cost
of the plus, with no additional cost coming from the operands.
This leaves only one problem: if the entire expression is just
reg
then the overall cost becomes zero. We hit this problem because we only
look at the source cost, not the overall insn cost. Mostly that's ok,
but in the specific case of a move instruction it doesn't really
generate the desired result.
Perhaps the best thing to do is to use the OUTER code to spot the
specific case where you've got a SET and return non-zero in that case.
R.