From: Aaron Sawdey <acsawdey@linux.ibm.com>
To: Michael Matz <matz@suse.de>
Cc: gcc@gcc.gnu.org, Joseph Myers <joseph@codesourcery.com>,
Jakub Jelinek <jakub@redhat.com>,
Richard Biener <richard.guenther@gmail.com>,
law@redhat.com,
Segher Boessenkool <segher@kernel.crashing.org>,
David Edelsohn <dje.gcc@gmail.com>,
Bill Schmidt <wschmidt@linux.ibm.com>
Subject: Re: Fixing inline expansion of overlapping memmove and non-overlapping memcpy
Date: Wed, 15 May 2019 13:16:00 -0000 [thread overview]
Message-ID: <8f95d652-aec3-7f7e-bf6b-a89aabddb9dc@linux.ibm.com> (raw)
In-Reply-To: <alpine.LSU.2.21.1905151302540.8064@wotan.suse.de>
On 5/15/19 8:10 AM, Michael Matz wrote:> On Tue, 14 May 2019, Aaron Sawdey wrote:
>
>> memcpy -> expand with movmem pattern
>> memmove (no overlap) -> transform to memcpy -> expand with movmem pattern
>> memmove (overlap) -> remains memmove -> glibc call
> ...
>> However in builtins.c expand_builtin_memmove() does not actually do the
>> expansion using the memmove pattern.
>
> Because it can't: the movmem pattern is not defined to require handling
> overlaps, and hence can't be used for any possibly overlapping
> memmove. (So, in a way the pattern is misnamed and should probably have
> been called cpymem from the beginning, alas there we are).
>
>> So here's my proposed set of fixes:
>> * Add new optab entries for nonoverlapping_memcpy and overlapping_memmove
>> cases.
>
> Wouldn't it be nicer to rename the current movmem pattern to cpymem
> wholesale for all ports (i.e. roughly a big s/movmem/cpymem/ over the
> whole tree) and then introduce a new optional movmem pattern with
> overlapping semantics?
Yeah that makes a lot of sense. I was unaware of that history, and was led
astray by the fact that the powerpc implementation of movemem works by
doing a bunch of loads into registers followed by a bunch of stores and
so (I think) would actually work for the overlap case.
Thanks,
Aaron
--
Aaron Sawdey, Ph.D. acsawdey@linux.vnet.ibm.com
050-2/C113 (507) 253-7520 home: 507/263-0782
IBM Linux Technology Center - PPC Toolchain
prev parent reply other threads:[~2019-05-15 13:16 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-14 19:21 Aaron Sawdey
2019-05-15 12:23 ` Richard Biener
2019-05-15 13:24 ` Aaron Sawdey
2019-05-15 14:02 ` Michael Matz
2019-05-15 14:11 ` Jakub Jelinek
2019-05-15 14:47 ` Michael Matz
2019-05-15 16:24 ` Aaron Sawdey
2019-05-15 16:31 ` Jakub Jelinek
2019-05-15 17:59 ` Aaron Sawdey
2019-05-15 18:01 ` Jakub Jelinek
2019-05-15 18:03 ` Aaron Sawdey
2019-05-15 13:10 ` Michael Matz
2019-05-15 13:16 ` Aaron Sawdey [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=8f95d652-aec3-7f7e-bf6b-a89aabddb9dc@linux.ibm.com \
--to=acsawdey@linux.ibm.com \
--cc=dje.gcc@gmail.com \
--cc=gcc@gcc.gnu.org \
--cc=jakub@redhat.com \
--cc=joseph@codesourcery.com \
--cc=law@redhat.com \
--cc=matz@suse.de \
--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).