public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
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 5/5] xtensa: Eliminate [DS]Cmode hard register clobber that is immediately followed by whole overwrite the register
Date: Wed, 15 Jun 2022 17:02:31 -0700	[thread overview]
Message-ID: <CAMo8Bf+WKkOcDCF_SGSeXFz41Vk0U-mtc0EhbrCnsakpx=2QdA@mail.gmail.com> (raw)
In-Reply-To: <eab26d15-8cd0-16cb-e786-afe7ee501aa5@yahoo.co.jp>

On Mon, Jun 13, 2022 at 8:54 PM Takayuki 'January June' Suwa
<jjsuwa_sys3175@yahoo.co.jp> wrote:
>
> RTL expansion of substitution to [DS]Cmode hard register includes obstructive
> register clobber.
>
> A simplest example:
>
>     double _Complex test(double _Complex c) {
>       return c;
>     }
>
> will be converted to:
>
>     (set (reg:DF 42 [ c ]) (reg:DF 2 a2))
>     (set (reg:DF 43 [ c+8 ]) (reg:DF 4 a4))
>     (clobber (reg:DC 2 a2))
>     (set (reg:DF 2 a2) (reg:DF 42 [ c ]))
>     (set (reg:DF 4 a4) (reg:DF 43 [ c+8 ]))
>     (use (reg:DC 2 a2))
>     (return)
>
> and then finally:
>
>     test:
>         mov     a8, a2
>         mov     a9, a3
>         mov     a6, a4
>         mov     a7, a5
>         mov     a2, a8
>         mov     a3, a9
>         mov     a4, a6
>         mov     a5, a7
>         ret
>
> As you see, it is so ridiculous.
>
> This patch eliminates such clobber in order to prune away the wasted move
> instructions by the optimizer:
>
>     test:
>         ret
>
> gcc/ChangeLog:
>
>         * config/xtensa/xtensa.md (DSC): New split pattern and mode iterator.
> ---
>  gcc/config/xtensa/xtensa.md | 28 ++++++++++++++++++++++++++++
>  1 file changed, 28 insertions(+)

Regtested for target=xtensa-linux-uclibc, no new regressions.
Committed to master.

-- 
Thanks.
-- Max

      reply	other threads:[~2022-06-16  0:02 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-14  3:53 Takayuki 'January June' Suwa
2022-06-16  0:02 ` 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+WKkOcDCF_SGSeXFz41Vk0U-mtc0EhbrCnsakpx=2QdA@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).