This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [RFC: Patch 1/6] New target hook: rtx_branch_cost
- From: Richard Biener <richard dot guenther at gmail dot com>
- To: James Greenhalgh <james dot greenhalgh at arm dot com>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>, nd at arm dot com, Ramana Radhakrishnan <ramana dot radhakrishnan at arm dot com>, Bernd Schmidt <bernds_cb1 at t-online dot de>, Jeff Law <law at redhat dot com>, Eric Botcazou <ebotcazou at libertysurf dot fr>, Steven Bosscher <steven at gcc dot gnu dot org>
- Date: Fri, 3 Jun 2016 12:39:42 +0200
- Subject: Re: [RFC: Patch 1/6] New target hook: rtx_branch_cost
- Authentication-results: sourceware.org; auth=none
- References: <5617A4DE dot 6020004 at redhat dot com> <1464886438-17892-1-git-send-email-james dot greenhalgh at arm dot com> <1464886438-17892-2-git-send-email-james dot greenhalgh at arm dot com>
On Thu, Jun 2, 2016 at 6:53 PM, James Greenhalgh
<james.greenhalgh@arm.com> wrote:
>
> Hi,
>
> This patch introduces a new target hook, to be used like BRANCH_COST but
> with a guaranteed unit of measurement. We want this to break away from
> the current ambiguous uses of BRANCH_COST.
>
> BRANCH_COST is used in ifcvt.c in two types of comparisons. One against
> instruction counts - where it is used as the limit on the number of new
> instructions we are permitted to generate. The other (after multiplying
> by COSTS_N_INSNS (1)) directly against RTX costs.
>
> Of these, a comparison against RTX costs is the more easily understood
> metric across the compiler, and the one I've pulled out to the new hook.
> To keep things consistent for targets which don't migrate, this new hook
> has a default value of BRANCH_COST * COSTS_N_INSNS (1).
>
> OK?
How does the caller compute "predictable"? There are some archs where
an information on whether this is a forward or backward jump is more
useful I guess. Also at least for !speed_p the distance of the branch is
important given not all targets support arbitrary branch offsets.
I remember that at the last Cauldron we discussed to change things to
compare costs of sequences of instructions rather than giving targets no
context with just asking for single (sub-)insn rtx costs.
That said, the patch is certainly an improvement.
Thanks,
Richard.
> Thanks,
> James
>
> ---
> 2016-06-02 James Greenhalgh <james.greenhalgh@arm.com>
>
> * target.def (rtx_branch_cost): New.
> * doc/tm.texi.in (TARGET_RTX_BRANCH_COST): Document it.
> * doc/tm.texi: Regenerate.
> * targhooks.h (default_rtx_branch_cost): New.
> * targhooks.c (default_rtx_branch_cost): New.