From: Kyrill Tkachov <kyrylo.tkachov@arm.com>
To: Yury Usishchev <y.usishchev@samsung.com>,
gcc-patches <gcc-patches@gcc.gnu.org>
Cc: Vyacheslav Barinov <v.barinov@samsung.com>,
Ramana Radhakrishnan <ramana.radhakrishnan@arm.com>,
Richard Earnshaw <Richard.Earnshaw@arm.com>
Subject: Re: [PATCH][ARM] PR/66433: Reduce cost of memory instructions with autoincrement
Date: Wed, 17 Jun 2015 09:39:00 -0000 [thread overview]
Message-ID: <55813B70.6010000@arm.com> (raw)
In-Reply-To: <87bngfwxz9.fsf@samsung.com>
Hi Yury [cc'ing the ARM maintainers]
On 16/06/15 15:04, Yury Usishchev wrote:
> Hello!
>
> Following patch fixes PR target/66433.
>
> As described in PR, cost of memory operation with autoincrement is
> considered to be greater than same operation without autoincrement. This
> causes auto-inc-dec pass not to optimize vector memory operations like
> vld and vst.
The autoincrement form may not always be as cheap as a
simple memory op, since it does involve an implicit addition
operation.
I've tried out your patch and I do see the autoincrement forms
being used more aggressively. Do you have any benchmark data
for making this change?
>
> Bootstrapped and regtested on armv7l-linux-gnueabi on trunk.
> OK for trunk?
case MEM:
/* A memory access costs 1 insn if the mode is small, or the address is
a single register, otherwise it costs one insn per word. */
- if (REG_P (XEXP (x, 0)))
+ if (REG_P (XEXP (x, 0))
+ || (GET_RTX_CLASS (GET_CODE (XEXP (x, 0))) == RTX_AUTOINC
+ && REG_P (XEXP (XEXP (x, 0), 0))))
*cost = COSTS_N_INSNS (1);
else if (flag_pic
&& GET_CODE (XEXP (x, 0)) == PLUS
I would have hoped that auto-inc-dec.c would be using address costs rather than rtx costs
here, but I don't think it's well defined who is responsible for choosing preferences between
these autoinc ops :(
I note that in our arm_arm_address_cost we already consider the autoinc modes to be cheap.
One situation that we want to avoid is for non-NEON memory ops sequences of the form:
ldr ra, [rn, #4]
ldr rb, [rn, #8]
ldr rc, [rn, #12]
add rn, rn, #16
being transformed into:
ldr ra, [rn]!
ldr rb, [rn]!
ldr rc, [rn]!
So I think at least for non-vector/FP modes where we can use offsets we should consider
autoinc ops to be slightly more expensive (COSTS_N_INSNS (2) instead of COSTS_N_INSNS (1)).
But when optimising for size, we should prefer the autoinc forms since they can save us on
add/sub instructions.
Thanks,
Kyrill
>
> --
> BR,
> Yury Usishchev
>
prev parent reply other threads:[~2015-06-17 9:18 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-16 14:11 Yury Usishchev
2015-06-17 9:39 ` Kyrill Tkachov [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=55813B70.6010000@arm.com \
--to=kyrylo.tkachov@arm.com \
--cc=Richard.Earnshaw@arm.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=ramana.radhakrishnan@arm.com \
--cc=v.barinov@samsung.com \
--cc=y.usishchev@samsung.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).