From: Max Filippov <jcmvbkbc@gmail.com>
To: "Takayuki 'January June' Suwa" <jjsuwa_sys3175@yahoo.co.jp>
Cc: GCC Patches <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH] xtensa: Make instruction cost estimation for size more accurate
Date: Tue, 10 Jan 2023 21:55:38 -0800 [thread overview]
Message-ID: <CAMo8Bf+XP+xaU8pxTx_B=jgg77J+bnnn38YkPr_oVzf8--vPZg@mail.gmail.com> (raw)
In-Reply-To: <2203c450-66c4-f100-2fc1-ab7e45cc008f@yahoo.co.jp>
On Mon, Jan 9, 2023 at 7:34 PM Takayuki 'January June' Suwa
<jjsuwa_sys3175@yahoo.co.jp> wrote:
>
> Until now, we applied COSTS_N_INSNS() (multiplying by 4) after dividing
> the instruction length by 3, so we couldn't express the difference less
> than modulo 3 in insn cost for size (e.g. 11 Bytes and 12 bytes cost the
> same).
>
> This patch fixes that.
>
> ;; 2 bytes
> addi.n a2, a2, -1 ; cost 3
>
> ;; 3 bytes
> addmi a2, a2, 1024 ; cost 4
>
> ;; 4 bytes
> movi.n a3, 80 ; cost 5
> bnez.n a2, a3, .L4
>
> ;; 5 bytes
> srli a2, a3, 1 ; cost 7
> add.n a2, a2, a2
>
> ;; 6 bytes
> ssai 8 ; cost 8
> src a4, a2, a3
>
> :: 3 + 4 bytes
> l32r a2, .L5 ; cost 9
>
> ;; 11 bytes ; cost 15
> ;; 12 bytes ; cost 16
>
> gcc/ChangeLog:
>
> * config/xtensa/xtensa.cc (xtensa_insn_cost):
> Let insn cost for size be obtained by applying COSTS_N_INSNS()
> to instruction length and then dividing by 3.
> ---
> gcc/config/xtensa/xtensa.cc | 11 +++++++----
> 1 file changed, 7 insertions(+), 4 deletions(-)
Regtested for target=xtensa-linux-uclibc, no new regressions.
Committed to master.
--
Thanks.
-- Max
prev parent reply other threads:[~2023-01-11 5:55 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <2203c450-66c4-f100-2fc1-ab7e45cc008f.ref@yahoo.co.jp>
2023-01-10 3:34 ` Takayuki 'January June' Suwa
2023-01-11 5:55 ` Max Filippov [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='CAMo8Bf+XP+xaU8pxTx_B=jgg77J+bnnn38YkPr_oVzf8--vPZg@mail.gmail.com' \
--to=jcmvbkbc@gmail.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=jjsuwa_sys3175@yahoo.co.jp \
/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).