public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Michael Matz <matz@suse.de>
To: Aaron Sawdey <acsawdey@linux.ibm.com>
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:10:00 -0000	[thread overview]
Message-ID: <alpine.LSU.2.21.1905151302540.8064@wotan.suse.de> (raw)
In-Reply-To: <ee8e07d1-1e34-15e9-1536-161c9c29b3e2@linux.ibm.com>

Hi,

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?


Ciao,
Michael.

  parent reply	other threads:[~2019-05-15 13:10 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 [this message]
2019-05-15 13:16   ` Aaron Sawdey

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.21.1905151302540.8064@wotan.suse.de \
    --to=matz@suse.de \
    --cc=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=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).