This is the mail archive of the
mailing list for the GCC project.
Re: set_src_cost lying comment
- From: Jeff Law <law at redhat dot com>
- To: Richard Earnshaw <Richard dot Earnshaw at foss dot arm dot com>, gcc at gcc dot gnu dot org
- Date: Thu, 25 Jun 2015 10:27:59 -0600
- 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> <558BF3F7 dot 6080702 at foss dot arm dot com>
On 06/25/2015 06:28 AM, Richard Earnshaw wrote:
Perhaps, but it's also the case on the PPC and a variety of other
architectures that there's no difference between a reg and some
constants. And on some architectures the PLUS is no different than a
logical operation or even a copy.
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.
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
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.
Seems like it's worth an experiment.