This is the mail archive of the
mailing list for the GCC project.
Re: rtx_cost of insns
- From: Segher Boessenkool <segher at kernel dot crashing dot org>
- To: Richard Earnshaw <Richard dot Earnshaw at foss dot arm dot com>, Jeff Law <law at redhat dot com>, gcc at gcc dot gnu dot org
- Date: Tue, 30 Jun 2015 01:44:51 -0500
- Subject: Re: rtx_cost of insns
- 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> <20150629074639 dot GG1723 at bubble dot grove dot modra dot org> <20150629143440 dot GA28537 at gate dot crashing dot org> <20150630044619 dot GH1723 at bubble dot grove dot modra dot org>
On Tue, Jun 30, 2015 at 02:16:19PM +0930, Alan Modra wrote:
> On Mon, Jun 29, 2015 at 09:34:40AM -0500, Segher Boessenkool wrote:
> > On Mon, Jun 29, 2015 at 05:16:39PM +0930, Alan Modra wrote:
> > > Note that we already have insn_rtx_cost, and it returns a minimum cost
> > > for a SET, so register move insns get a cost of 1 insn. However,
> > > despite insn_rtx_cost starting life in combine.c, even combine doesn't
> > > use it in all whole insn cases. :-(
> > In what cases does it not?
> Practically all of the occurrences of set_src_cost in combine.c can be
> called on whole insns. By "whole insn" I mean of course the right
> hand side of a set, or a single set inside a parallel. I'm not saying
> that this causes trouble, since I haven't seen a register move there
> (but I haven't looked very hard either).
All (all five) places in combine where it uses set_src_cost it is
comparing two possible simplifications, to see if they are
simplifications at all. So all is good as far as I see -- certainly
simplifying anything to just a register is the best you can do, so a
cost of 0 for that is fine.
For all instructions (including those that are not single sets) combine
uses insn_rtx_cost to decide the cost of the whole instructions, to see
if the final instruction combination it came up with is profitable.
insn_rtx_cost could certainly use some improvement though :-/