public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Richard Biener <rguenther@suse.de>
To: Segher Boessenkool <segher@kernel.crashing.org>
Cc: "Kewen.Lin" <linkw@linux.ibm.com>,
	    Richard Biener <richard.guenther@gmail.com>,
	    GCC Patches <gcc-patches@gcc.gnu.org>,
	    Bill Schmidt <wschmidt@linux.ibm.com>,
	    "bin.cheng" <bin.cheng@linux.alibaba.com>,
	    Jakub Jelinek <jakub@redhat.com>
Subject: Re: [PATCH v2 3/3] Consider doloop cmp use in ivopts
Date: Thu, 16 May 2019 07:25:00 -0000	[thread overview]
Message-ID: <alpine.LSU.2.20.1905160918480.10704@zhemvz.fhfr.qr> (raw)
In-Reply-To: <20190515161734.GI8599@gate.crashing.org>

On Wed, 15 May 2019, Segher Boessenkool wrote:

> On Wed, May 15, 2019 at 10:47:31AM +0200, Richard Biener wrote:
> > Ah, so the key issue is that the doloop IV is "free"?  That
> > is, it doesn't consume a general register and whatnot?  That
> > is allocating this IV doesn't really interfere with other IVs?
> 
> That is one half of it, yes.
> 
> > But can other uses be based on the doloop IV easily (if the
> > IV doesn't reside in a general reg?)?
> 
> Getting the value of the count reg can be expensive, that is the
> other half of it.
> 
> > Otherwise I understand that IVOPTs doesn't properly cost
> > the doloop IV update and conditional branch.
> 
> Currently it doesn't even *know* something is or isn't a doloop.
> And yeah that matters a lot for proper costing, on all targets that
> have a doloop.

Ah, OK.  So for general handling IVOPTs would add a new
candidate kind (doloop kind) which is costed differently
at the various uses.  The "guessed" RTL we create for
costing also needs to properly create a proper counter reg
(IIRC it always creates pseudos right now, but here it would
need to be a hard reg so costing can properly pessimize uses
in addresses/memory?).

> > That's clearly
> > something we should fix (maybe even indepenently on other
> > changes).  One important thing is that we need to base costs
> > on a common base to not compare apples and oranges, didn't
> > dig into your patch in detail enough to see whether it
> > fits into the general cost model or whether it is a hack
> > ontop of everything.
> 
> The different cost for a doloop is pretty easy...  Might have to
> be a target hook though; on Power the decrement + compare-to-zero
> are "free", while on some other targets only the "compare" is.
> The cost for using the IV...  For us we could just disallow it
> being used at all (except for the looping itself of course), but
> not sure what is optimal in general.  Another hook?

Indeed the easiest thing is to simply disallow uses of the doloop
IV outside of the increment, compare and branch (maybe have a
target hook that says whether a particular IV may be used for
a particular USE).

We'd still need to cost the spilling thing around calls of course,
but this can maybe be done incrementally.  It's still RTL doloop
that ultimatively decides on the doloop use.

Richard.

  reply	other threads:[~2019-05-16  7:25 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-14  3:10 linkw
2019-05-14  7:26 ` Richard Biener
2019-05-15  5:03   ` Kewen.Lin
2019-05-15  8:47     ` Richard Biener
2019-05-15 16:17       ` Segher Boessenkool
2019-05-16  7:25         ` Richard Biener [this message]
2019-05-16 17:35           ` Segher Boessenkool
2019-05-16  3:53       ` Kewen.Lin
2019-05-16 18:41       ` Jeff Law
2019-05-16 21:42         ` Segher Boessenkool
2019-06-19 11:47 ` [PATCH v3 3/3] PR80791 " Kewen.Lin
2019-06-20  9:09   ` Segher Boessenkool
2019-06-20 12:08     ` Kewen.Lin
2019-06-20 12:17       ` Kewen.Lin
2019-07-10  2:31         ` [PING^1][PATCH v4 " Kewen.Lin
2019-07-12 12:40           ` Richard Biener
2019-07-12 14:10             ` Segher Boessenkool
2019-07-15  6:40             ` Kewen.Lin
2019-07-15  6:50             ` Bin.Cheng
2019-07-21  9:06   ` [PATCH v3 " Bin.Cheng
2019-07-22  5:42     ` Kewen.Lin
2019-07-22  6:53       ` Segher Boessenkool
2019-07-22  7:18         ` Kewen.Lin
2019-07-22  8:02         ` Richard Biener
2019-07-22 21:47           ` Segher Boessenkool
2019-07-23  6:14             ` Kewen.Lin
2019-07-23  7:38             ` Richard Biener
2019-07-23  6:09           ` Kewen.Lin
2019-07-23  8:05             ` Richard Biener
2019-07-23  6:28       ` [PATCH v5 " Kewen.Lin
2019-08-14  7:48         ` [PATCH v6 " Kewen.Lin
2019-08-21 13:42           ` Bin.Cheng
2019-08-22  7:09             ` Kewen.Lin
2019-08-22  8:07               ` Bin.Cheng
2019-08-22  9:16                 ` Kewen.Lin
2019-08-23  5:31                   ` Bin.Cheng
2019-08-23  9:57                     ` Kewen.Lin
2019-08-23 10:43                       ` Bin.Cheng
2019-08-23 11:02                         ` Segher Boessenkool
2019-09-11  6:18                           ` Kewen.Lin
2019-09-12  8:14                             ` Richard Biener
2019-09-14  9:35                               ` Kewen.Lin
2019-08-24 22:43                         ` Kewen.Lin

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=alpine.LSU.2.20.1905160918480.10704@zhemvz.fhfr.qr \
    --to=rguenther@suse.de \
    --cc=bin.cheng@linux.alibaba.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jakub@redhat.com \
    --cc=linkw@linux.ibm.com \
    --cc=richard.guenther@gmail.com \
    --cc=segher@kernel.crashing.org \
    --cc=wschmidt@linux.ibm.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).