public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Joern Rennecke <joern.rennecke@embecosm.com>
To: James Greenhalgh <james.greenhalgh@arm.com>
Cc: GCC Patches <gcc-patches@gcc.gnu.org>
Subject: Re: [Patch 3/7 arc] Deprecate *_BY_PIECES_P, move to hookized version
Date: Tue, 04 Nov 2014 16:20:00 -0000	[thread overview]
Message-ID: <CAMqJFCq6jdMb_Nf405aGTn-V2GsJteZ3Dk1cHKj06papdkgfYw@mail.gmail.com> (raw)
In-Reply-To: <20141104142407.GA14885@arm.com>

On 4 November 2014 14:24, James Greenhalgh <james.greenhalgh@arm.com> wrote:
> On Tue, Nov 04, 2014 at 12:07:56PM +0000, Joern Rennecke wrote:
>> On 31 October 2014 15:10, James Greenhalgh <james.greenhalgh@arm.com> wrote:
>>
>> > While I am there, arc defines a macro CAN_MOVE_BY_PIECES, which is
>> > unused, so clean that up too.
>>
>> That's not a clean-up.  This pertains to PR 39350.
>
> Well, it is a clean-up in the sense that this macro is completely unused
> in the compiler and has no effect, but please revert this hunk if that
> is your preference.
>
>> Which, incidentally, this hookization completely ignores, entrenching
>> the conflation of move expander and move cost estimates.
>
> No, I have to disagree. The use_by_pieces_infrastructure_p hook doesn't
> conflate anything - it gives a response to the question "Should the
> by_pieces infrastructure be used?". A target specific movmem pattern
> - though it might itself choose to move things by pieces, is
> categorically not using the move_by_pieces infrastructure.
>
> If we want to keep a clean separation of concerns here, we would
> want a similar target hook asking the single question "will your
> movmem/setmem expander succeed?".

That would not be helpful.  What the rtl optimizers actually want to know is
"will this block copy / memset be cheap?" .
A movmem expander might succeed (or not) for various reasons.  The one that's
interesting for the above question is if the call has been inlined
with a fast set
of instructions.

>> Thus, can_move_by_pieces gives the wrong result for purposes of rtl
>> optimizations
>> when a target-specific movmem etc expander emits target-specific code.
>> The patch at https://gcc.gnu.org/ml/gcc-patches/2009-03/txt00018.txt
>> shows a number of call sites that are affected.
>
> can_move_by_pieces (likewise can_store_by_pieces) gives the right
> result, the RTL expanders are using it wrong.

I could agree with that view if there was a good strategy agreed what the rtl
expanders should do instead.

> I disagree with the approach taken in your patch as it overloads the
> purpose of can_move_by_pieces. However, I would support a patch pulling
> this out in to two hooks, so the call in
> value-prof.c:gimple_stringops_transform would change from:
>
>   if (!can_move_by_pieces (val, MIN (dest_align, src_align)))
>     return false;
>
> to something like:
>
>   if (!can_move_by_pieces (val, MIN (dest_align, src_align))
>       && !targetm.can_expand_mem_op_p (val, MIN (dest_align, src_align),
>                                        MOVE_BY_PIECES))
>     return false;

But this goes back to the problem that it's not about if we can expand the mem
op at all, but if we have a fast expansion.  We can always expand via libcall
(the middle end does this as a fall-back).  Also, the target might do some
target-specific slow expansion, e.g. call a function with another name
and maybe a
modified ABI, but still relatively slow to work.

So, either the new hook would answer the wrong question, or it would be
misnamed, in which case it's likely that the semantics will sooner or
later follow
the name.
it will gravitate to answer the wrong question again.

> But let's not confuse the use of what should be a simple hook!

What would that be?  TARGET_RTX_COST is unsuitable because the RTL
for the call hasn't been made yet, and it it was, it would tend to be multiple
instructions, maybe even a loop.
Should we have an analogous TARGET_TREE_COST hook, so that you can ask the
target what it thinks the cost of a tree will be once it's expanded?

  reply	other threads:[~2014-11-04 16:20 UTC|newest]

Thread overview: 62+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-06  8:50 [AArch64] Implement movmem for the benefit of inline memcpy James Greenhalgh
2014-06-06 10:39 ` Richard Earnshaw
2014-08-01  6:38 ` Andrew Pinski
2014-08-01  9:05   ` Richard Biener
2014-08-01  9:21 ` pinskia
2014-08-05  7:05   ` Andrew Pinski
2014-08-07 14:20     ` James Greenhalgh
2014-08-07 14:34       ` Richard Biener
2014-08-20  9:10         ` [Patch 1/2] Control SRA and IPA-SRA by a param rather than MOVE_RATIO James Greenhalgh
2014-08-20  9:10           ` [Patch AArch64 2/2] Wire up TARGET_DEFAULT_MAX_SCALARIZATION_SIZE James Greenhalgh
2014-08-20  9:21           ` [Patch 1/2] Control SRA and IPA-SRA by a param rather than MOVE_RATIO Richard Biener
2014-09-25 14:58             ` [Patch 0/4] " James Greenhalgh
2014-09-25 14:58               ` [Patchv2 3/4] " James Greenhalgh
2014-09-26  9:11                 ` Richard Biener
2014-10-01 16:38                   ` James Greenhalgh
2014-10-29 14:39                     ` James Greenhalgh
2014-10-31 10:58                       ` Richard Biener
2014-11-06 11:53                         ` [Patchv3] " James Greenhalgh
2014-11-06 14:10                           ` Richard Biener
2014-09-25 14:58               ` [Patch 1/4] Hookize MOVE_BY_PIECES_P, remove most uses of MOVE_RATIO James Greenhalgh
2014-09-25 15:09                 ` Steven Bosscher
2014-09-26  9:16                   ` Richard Biener
2014-10-29 10:45                 ` [Patch 0/6] Hookize MOVE_BY_PIECES_P James Greenhalgh
2014-10-29 10:47                   ` [Patch 1/6] Hookize MOVE_BY_PIECES_P, remove most uses of MOVE_RATIO James Greenhalgh
2014-10-29 12:29                     ` Matthew Fortune
2014-10-29 16:11                       ` James Greenhalgh
2014-10-31 15:09                         ` James Greenhalgh
2014-10-31 15:10                           ` [Patch 1/7] Hookize *_BY_PIECES_P James Greenhalgh
2014-10-31 21:08                             ` Jeff Law
2014-10-31 15:10                           ` [Patch 2/7 s390] Deprecate *_BY_PIECES_P, move to hookized version James Greenhalgh
2014-10-31 15:11                           ` [Patch 3/7 arc] " James Greenhalgh
2014-11-04 12:08                             ` Joern Rennecke
2014-11-04 14:24                               ` James Greenhalgh
2014-11-04 16:20                                 ` Joern Rennecke [this message]
2014-10-31 15:11                           ` [Patch 4/7 sh] " James Greenhalgh
2014-11-01 23:27                             ` Kaz Kojima
2014-10-31 15:12                           ` [Patch 5/7 mips] " James Greenhalgh
2014-10-31 15:16                           ` [Patch 6/7 AArch64] " James Greenhalgh
2014-10-31 15:34                           ` [Patch 7/7] Remove *_BY_PIECES_P James Greenhalgh
2014-10-29 10:49                   ` [Patch 2/6 s390] Deprecate MOVE_BY_PIECES_P, move to hookized version James Greenhalgh
2014-10-29 21:09                     ` Jeff Law
2014-10-29 10:50                   ` [Patch 3/6 arc] " James Greenhalgh
2014-10-29 21:10                     ` Jeff Law
2014-10-29 10:50                   ` [Patch 4/6 sh] " James Greenhalgh
2014-10-29 21:10                     ` Jeff Law
2014-10-30  0:49                     ` Kaz Kojima
2014-10-29 10:51                   ` [Patch 5/6 mips] " James Greenhalgh
2014-10-29 21:18                     ` Jeff Law
2014-10-29 10:53                   ` [Patch 6/6] Remove MOVE_BY_PIECES_P James Greenhalgh
2014-10-29 21:20                     ` Jeff Law
2014-09-25 14:58               ` [Patch 2/4] Hack out a use of MOVE_RATIO in tree-inline.c James Greenhalgh
2014-09-26  8:58                 ` Richard Biener
2014-09-25 14:58               ` [Patch AArch64 4/4] Wire up New target hooks James Greenhalgh
2014-09-26 13:31                 ` James Greenhalgh
2014-08-21 10:34         ` [Patch 1/2] Don't put out a call to memcpy for volatile struct operations James Greenhalgh
2014-08-21 10:34           ` [Patch AArch64 2/2] Do not double-copy bytes in " James Greenhalgh
2014-08-21 11:22           ` [Patch 1/2] Don't put out a call to memcpy for " Richard Biener
2014-08-21 23:47             ` Mike Stump
2014-08-22 15:42               ` Joseph S. Myers
2014-08-22 17:33                 ` Mike Stump
2014-08-26  8:35               ` Richard Biener
2014-08-26 16:42                 ` Mike Stump

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=CAMqJFCq6jdMb_Nf405aGTn-V2GsJteZ3Dk1cHKj06papdkgfYw@mail.gmail.com \
    --to=joern.rennecke@embecosm.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=james.greenhalgh@arm.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).