public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: "Jiang, Haochen" <haochen.jiang@intel.com>
To: Segher Boessenkool <segher@kernel.crashing.org>
Cc: "gcc-patches@gcc.gnu.org" <gcc-patches@gcc.gnu.org>,
	"rguenther@suse.de" <rguenther@suse.de>,
	"Liu, Hongtao" <hongtao.liu@intel.com>,
	"ubizjak@gmail.com" <ubizjak@gmail.com>,
	"richard.earnshaw@arm.com" <richard.earnshaw@arm.com>,
	"richard.sandiford@arm.com" <richard.sandiford@arm.com>,
	"marcus.shawcroft@arm.com" <marcus.shawcroft@arm.com>,
	"kyrylo.tkachov@arm.com" <kyrylo.tkachov@arm.com>,
	"rth@gcc.gnu.org" <rth@gcc.gnu.org>,
	"gnu@amylaar.uk" <gnu@amylaar.uk>,
	"claziss@synopsys.com" <claziss@synopsys.com>,
	"nickc@redhat.com" <nickc@redhat.com>,
	"ramana.radhakrishnan@arm.com" <ramana.radhakrishnan@arm.com>,
	"aoliva@gcc.gnu.org" <aoliva@gcc.gnu.org>,
	"hubicka@ucw.cz" <hubicka@ucw.cz>,
	"mfortune@gmail.com" <mfortune@gmail.com>,
	"dje.gcc@gmail.com" <dje.gcc@gmail.com>,
	"linkw@gcc.gnu.org" <linkw@gcc.gnu.org>,
	"uweigand@de.ibm.com" <uweigand@de.ibm.com>,
	"krebbel@linux.ibm.com" <krebbel@linux.ibm.com>,
	"olegendo@gcc.gnu.org" <olegendo@gcc.gnu.org>,
	"davem@redhat.com" <davem@redhat.com>,
	"ebotcazou@libertysurf.fr" <ebotcazou@libertysurf.fr>,
	"jeffreyalaw@gmail.com" <jeffreyalaw@gmail.com>,
	"dave.anglin@bell.net" <dave.anglin@bell.net>
Subject: RE: [PATCH 1/2] Add a parameter for the builtin function of prefetch to align with LLVM
Date: Thu, 20 Oct 2022 07:34:13 +0000	[thread overview]
Message-ID: <SA1PR11MB5946BAF96F117BA64BD006FFEC2A9@SA1PR11MB5946.namprd11.prod.outlook.com> (raw)
In-Reply-To: <20221019210645.GP25951@gate.crashing.org>

> -----Original Message-----
> From: Segher Boessenkool <segher@kernel.crashing.org>
> Sent: Thursday, October 20, 2022 5:07 AM
> To: Jiang, Haochen <haochen.jiang@intel.com>
> Cc: gcc-patches@gcc.gnu.org; rguenther@suse.de; Liu, Hongtao
> <hongtao.liu@intel.com>; ubizjak@gmail.com; richard.earnshaw@arm.com;
> richard.sandiford@arm.com; marcus.shawcroft@arm.com;
> kyrylo.tkachov@arm.com; rth@gcc.gnu.org; gnu@amylaar.uk;
> claziss@synopsys.com; nickc@redhat.com; ramana.radhakrishnan@arm.com;
> aoliva@gcc.gnu.org; hubicka@ucw.cz; mfortune@gmail.com;
> dje.gcc@gmail.com; linkw@gcc.gnu.org; uweigand@de.ibm.com;
> krebbel@linux.ibm.com; olegendo@gcc.gnu.org; davem@redhat.com;
> ebotcazou@libertysurf.fr; jeffreyalaw@gmail.com; dave.anglin@bell.net
> Subject: Re: [PATCH 1/2] Add a parameter for the builtin function of prefetch
> to align with LLVM
> 
> On Fri, Oct 14, 2022 at 04:34:05PM +0800, Haochen Jiang wrote:
> > 	* config/s390/s390.cc (s390_expand_cpymem): Generate fourth
> parameter for
> 
> (Many too long lines here, this is the first one.  Changelog lines are
> max. 80 positions; a tab is eight).

I will change that in next patch.

> 
> > +  /* Argument 3 must be either zero or one.  */
> > +  if (INTVAL (op3) != 0 && INTVAL (op3) != 1)
> > +    {
> > +      warning (0, "invalid fourth argument to %<__builtin_prefetch%>;"
> > +	" using one");
> 
> "using 1" makes sense maybe, but "using one" reads as "using an
> argument", not very sane.
> 
> An error would be better here anyway?

Will change to 1 to avoid confusion in that. The reason why this is a warning
is because previous ones related to constant arguments out of range in prefetch
are also using warning.

/* Argument 2 must be 0, 1, 2, or 3.  */
  if (INTVAL (op2) < 0 || INTVAL (op2) > 3)
    {
      warning (0, "invalid third argument to %<__builtin_prefetch%>; using zero");
      op2 = const0_rtx;
    }

Therefore I use warning to align with them.

> 
> > --- a/gcc/config/rs6000/rs6000.md
> > +++ b/gcc/config/rs6000/rs6000.md
> > @@ -14060,10 +14060,25 @@
> >    DONE;
> >  })
> >
> > -(define_insn "prefetch"
> > +(define_expand "prefetch"
> > +  [(prefetch (match_operand 0 "indexed_or_indirect_address")
> > +	     (match_operand:SI 1 "const_int_operand")
> > +	     (match_operand:SI 2 "const_int_operand")
> > +	     (match_operand:SI 3 "const_int_operand"))]
> > +  ""
> > +{
> > +  if (INTVAL (operands[3]) == 0)
> > +  {
> 
> Broken indentation.

I will fix that in updated patch.

> 
> > +    warning (0, "instruction prefetch is not supported; using data prefetch");
> 
> Please use a separate pattern for this, and leave prefetch to mean data
> prefetch, as documented!  Documentation you didn't change btw.  Call the
> new one instruction_prefetch or something equally boring maybe :-)
> 

Actually I changed documentation for prefetch but it is flooded in the patch
(Sorry for that).

In gcc/doc/rtl.texi

-@item (prefetch:@var{m} @var{addr} @var{rw} @var{locality})
+@item (prefetch:@var{m} @var{addr} @var{rw} @var{locality} @var{cache})
 
+Operand @var{cache} is 1 if the prefetch is prefetching data, 0 for prefetching
+instruction;
+targets that do not support instruction prefetch should treat all as data
+prefetch.
 
And for the implementation on the instruction prefetch, actually I have thought
of that way previously. But I chose the way how patch current goes for the
following reasons.

1. Previously we are using parameter to indicate r/w and locality in prefetch. I
suppose it is quite similar in this case. Since the pattern is already there, I prefer
reusing them.

2. It will be more natural for developers to extend their prefetch in future.

If anyone have points, welcome further discussion on that.

> When you send an updated patch, please split it up better?  Generic
> changes and documentation in one patch, target changes in a separate
> patch or patches, and testsuite is distinct as well.  It isn't nice to
> have to scroll through thousands of lines to see if there is anything
> relevant to you.

Really sorry for that. Hongtao has explained the reason for why we arrange
this patch and I will split the testcase to another patch.

Also if the change on testsuites on this patch change to minimal change,
the patch will be much smaller than current one.

BRs,
Haochen

> 
> Thanks,
> 
> 
> Segher

  parent reply	other threads:[~2022-10-20  7:34 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-14  8:34 [PATCH 0/2] Add a Fourth parameter for prefetch and Support Intel PREFETCHI Haochen Jiang
2022-10-14  8:34 ` [PATCH 1/2] Add a parameter for the builtin function of prefetch to align with LLVM Haochen Jiang
2022-10-14  8:46   ` Hongtao Liu
2022-10-17 15:28   ` Richard Earnshaw
2022-10-18  9:20     ` [PATCH v2] " Haochen Jiang
2022-10-19 17:14   ` [PATCH 1/2] " Andrew Pinski
2022-10-19 21:14     ` Segher Boessenkool
2022-10-20  1:27       ` Hongtao Liu
2022-10-20  1:44       ` Jiang, Haochen
2022-10-20 17:25         ` Segher Boessenkool
2022-10-20 17:37           ` Andrew Pinski
2022-10-21 10:17             ` Richard Earnshaw
2022-10-21 18:08               ` Segher Boessenkool
2022-10-19 21:06   ` Segher Boessenkool
2022-10-20  1:39     ` Hongtao Liu
2022-10-20  3:12       ` Hongtao Liu
2022-10-20 18:44         ` Segher Boessenkool
2022-10-20  7:34     ` Jiang, Haochen [this message]
2022-10-20 18:54       ` Segher Boessenkool
2022-10-21  3:17         ` Jiang, Haochen
2022-10-24 10:00         ` Richard Sandiford
2022-10-24 21:19           ` Segher Boessenkool
2022-10-14  8:34 ` [PATCH 2/2] Support Intel prefetchit0/t1 Haochen Jiang
2022-10-20  3:45   ` H.J. Lu
2022-10-20  4:04     ` Hongtao Liu
2022-10-19 20:49 ` [PATCH 0/2] Add a Fourth parameter for prefetch and Support Intel PREFETCHI Segher Boessenkool

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=SA1PR11MB5946BAF96F117BA64BD006FFEC2A9@SA1PR11MB5946.namprd11.prod.outlook.com \
    --to=haochen.jiang@intel.com \
    --cc=aoliva@gcc.gnu.org \
    --cc=claziss@synopsys.com \
    --cc=dave.anglin@bell.net \
    --cc=davem@redhat.com \
    --cc=dje.gcc@gmail.com \
    --cc=ebotcazou@libertysurf.fr \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=gnu@amylaar.uk \
    --cc=hongtao.liu@intel.com \
    --cc=hubicka@ucw.cz \
    --cc=jeffreyalaw@gmail.com \
    --cc=krebbel@linux.ibm.com \
    --cc=kyrylo.tkachov@arm.com \
    --cc=linkw@gcc.gnu.org \
    --cc=marcus.shawcroft@arm.com \
    --cc=mfortune@gmail.com \
    --cc=nickc@redhat.com \
    --cc=olegendo@gcc.gnu.org \
    --cc=ramana.radhakrishnan@arm.com \
    --cc=rguenther@suse.de \
    --cc=richard.earnshaw@arm.com \
    --cc=richard.sandiford@arm.com \
    --cc=rth@gcc.gnu.org \
    --cc=segher@kernel.crashing.org \
    --cc=ubizjak@gmail.com \
    --cc=uweigand@de.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).