public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: YunQiang Su <syq@debian.org>
To: "Maciej W. Rozycki" <macro@orcam.me.uk>
Cc: Jeff Law <jeffreyalaw@gmail.com>,
	YunQiang Su <yunqiang.su@cipunited.com>,
	 gcc-patches@gcc.gnu.org, jiaxun.yang@flygoat.com,
	richard.sandiford@arm.com
Subject: Re: [PATCH] MIPS: don't expand large block move
Date: Wed, 24 May 2023 10:04:49 +0800	[thread overview]
Message-ID: <CAKcpw6Wgx3R5A31fnEAH_0+dPK4_Yw6MwCxODPyUth5rVbcK_w@mail.gmail.com> (raw)
In-Reply-To: <alpine.DEB.2.21.2305192000570.50034@angie.orcam.me.uk>

Maciej W. Rozycki <macro@orcam.me.uk> 于2023年5月20日周六 03:21写道:
>
> On Fri, 19 May 2023, Jeff Law wrote:
>
> > > diff --git a/gcc/config/mips/mips.cc b/gcc/config/mips/mips.cc
> > > index ca491b981a3..00f26d5e923 100644
> > > --- a/gcc/config/mips/mips.cc
> > > +++ b/gcc/config/mips/mips.cc
> > > @@ -8313,6 +8313,12 @@ mips_expand_block_move (rtx dest, rtx src, rtx
> > > length)
> > >     }
> > >         else if (optimize)
> > >     {
> > > +     /* When the length is big enough, the lib call has better performace
> > > +        than load/store insns.
> > > +        In most platform, the value is about 64-128.
> > > +        And in fact lib call may be optimized with SIMD */
> > > +     if (INTVAL(length) >= 64)
> > > +       return false;
> > Just a formatting nit.  Space between INTVAL and the open paren for its
> > argument list.
>
>  This is oddly wrapped too.  I'd move "performace" (typo there!) to the
> second line, to align better with the rest of the text.
>
>  Plus s/platform/platforms/ and there's a full stop missing along with two
> spaces at the end.  Also there's inconsistent style around <= and >=; the
> GNU Coding Standards ask for spaces around binary operators.  And "don't"
> in the change heading ought to be capitalised.
>
>  In fact, I'd justify the whole paragraph as each sentence doesn't have to
> start on a new line, and the commit description could benefit from some
> reformatting too, as it's now odd to read.
>

Thank you. I will fix these problems.

> > OK with that change.
>
>  I think the conditional would be better readable if it was flattened
> though:
>
>       if (INTVAL (length) <= MIPS_MAX_MOVE_BYTES_STRAIGHT)
>         ...
>       else if (INTVAL (length) >= 64)
>         ...
>       else if (optimize)
>         ...
>

This sounds good.

> or even:
>
>       if (INTVAL (length) <= MIPS_MAX_MOVE_BYTES_STRAIGHT)
>         ...
>       else if (INTVAL (length) < 64 && optimize)
>         ...
>

I don't think this is a good option, since somebody may add some code,
and may break our logic.

> One just wouldn't write it as proposed if creating the whole piece from
> scratch rather than retrofitting this extra conditional.
>
>  Ultimately it may have to be tunable as LWL/LWR, etc. may be subject to
> fusion and may be faster after all.
>

oohhh, you are right.
And in fact this patch has some problems:
If the data is aligned, the value is about 1024, instead of 64-128.

>   Maciej

  reply	other threads:[~2023-05-24  2:05 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-19  6:11 YunQiang Su
2023-05-19 16:56 ` Jeff Law
2023-05-19 19:21   ` Maciej W. Rozycki
2023-05-24  2:04     ` YunQiang Su [this message]
2023-05-30 11:44       ` Maciej W. Rozycki

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=CAKcpw6Wgx3R5A31fnEAH_0+dPK4_Yw6MwCxODPyUth5rVbcK_w@mail.gmail.com \
    --to=syq@debian.org \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jeffreyalaw@gmail.com \
    --cc=jiaxun.yang@flygoat.com \
    --cc=macro@orcam.me.uk \
    --cc=richard.sandiford@arm.com \
    --cc=yunqiang.su@cipunited.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).